View source: R/groupRAR_functions.R
| RPWRule | R Documentation |
Simulating the randomized play-the-winner rule (two arms) with two-sided hypothesis testing in a clinical trial context.
RPWRule(k, p, ssn, Y0 = NULL, nsim = 2000, alpha = 0.05, test.fun = NULL,
typeI = FALSE, seed = NULL)
k |
A positive integer. The number of treatment groups in the trial. Only |
p |
A vector of length |
ssn |
A positive integer. The total number of participants in each simulated trial. |
Y0 |
A vector of length |
nsim |
A positive integer. The number of simulated trials, with a default value of 2000. |
alpha |
A number between 0 and 1. The significance level of the two-sided test, with a default value of 0.05. |
test.fun |
An optional function |
typeI |
Logical. If |
seed |
An optional integer passed to |
The randomized play-the-winner rule allocates future subjects in a clinical trial to treatment groups based on the performance of previously treated subjects. A ball is drawn from the urn to assign the next subject. A success on a treatment adds a ball of the same type to the urn, and a failure adds a ball of the other type. This increases the chance that future patients are assigned to the better-performing treatment.
An object of class "grouprar", a list that is printed as a short summary (see print.grouprar), with the following elements.
method |
The name of the procedure. |
sample size |
The total sample size. |
parameter |
The true success rates used in the simulations, named |
propotion |
The mean allocation proportion of each arm over the simulations, named |
sd of propotion |
The standard deviation of the allocation proportion of each arm over the simulations. |
failure rate |
The mean failure rate over the simulations. |
sd of failure rate |
The standard deviation of the failure rate (or mean response) over the simulations. |
power |
The proportion of simulated trials that reject the null hypothesis of equal success rates. Simulations in which the test cannot be computed are dropped. |
data: failureRate |
The failure rate (or mean response) of each simulated trial. |
data: test |
The test decision of each simulated trial (1 = reject). |
data: assignment |
The treatment assignments of the last simulated trial. |
data: propotion |
A data frame with the allocation proportions of each simulated trial. |
data: allocation |
An |
type I error |
Only if |
Wei, L. J. and Durham, S. (1978). The randomized play-the-winner rule in medical trials. Journal of the American Statistical Association, 73(364), 840-843. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/01621459.1978.10480109")}
## a simple use
RPW.res <- RPWRule(k = 2, p = c(0.7, 0.8), ssn = 200, Y0 = NULL, nsim = 100, alpha = 0.05)
## view the output
RPW.res
## view all simulation settings
RPW.res[["method"]]
RPW.res[["parameter"]]
## view the simulation results
RPW.res[["propotion"]]
RPW.res[["failure rate"]]
RPW.res[["power"]]
RPW.res[["data: assignment"]]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.