title: Zelen's Play the Winner Rule Randomization Scheme
body: <p>Does anybody know how to implement this algorithm in R? I have a total of 100 patients that I need to randomize and I want to know what is the chance of a greater than 55%-45% split (i.e. 45 or fewer subjects will be assigned one of the treatments and 55 or more on the other treatment)? Assuming the response rates are 0.6 and 0.5 for treatment A and B, respectively. I need to do this based on 1000 simulations of Zelen's Play The Winner Rule.</p>
  
  <p>The key idea behind Zelen's rule is that you need to know the outcome of the previous patients in order to assign the next patient so basically we'd have somehing like this:</p>
  
  <p>For the first patient we use rbinom (1,1,1/2) (assign him to either A or B with equal probab), then for group A we know that the response rate is 0.6 so rbinom(1,1,0.6) to see if patient responds; if he responds we assign the next patient to A, otherwise to B</p>
  
  <p>Similarly, for group B we know the response rate is 0.5 so rbinom(1,1,0.5) to see whether patient responds. If he responds, then next patient gets assigned to B; otherwise to A.</p>
  
  <p>If split is greater than 55-45% then count as 1; otherwise 0. Finally, simulate 1000 times to count the number of splits greater than 55-45 and then calculate probability of this event happening: n/1000</p>