Sample data:
PatID Strata1 Strata2 Allocated TG
1 1 1 T1
2 1 2 T2
3 2 3 T1
4 1 3 .
5 2 2 .
6 1 3 .
7 1 3 .
8 2 4 .
I have patients with one of 2 strats (conditions).
I will have to calculate the Allocated TG based on strats as well as Allocated TG for all the previous patients.In the above example, Allocated TG is present for 3 patients for example.
For the 4th patient,the allocated TG will be calculated like this,
What is the value for Strata1.
If 1,count of how many previous patients are assigned to Allocated TG T1 when 1 count of how many previous patients are assigned to Allocated TG T2 when 1
If 2,count of how many previous patients are assigned to Allocated TG T1 when 1 count of how many previous patients are assigned to Allocated TG T2 when 1
Similarly, for the Strata2.The count of all the previous patients Allocated TG based on each strata.
After all that, i will get some value for each.Based on the output value, with which strata the allocation number is less, that TG(T1/T2) will be allocated.
After this, it has to calculate for PatID5.Again which has to calculate for the previous 4 patients.