View source: R/groupRAR_functions.R
| BirthDeathUrn | R Documentation |
Simulating the birth and death urn procedure (number of arms \ge 2) with two-sided hypothesis testing in a clinical trial context.
BirthDeathUrn(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 ( |
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 birth and death urn works as follows. Initially the urn contains balls of K treatment types and an immigration ball. A ball is drawn at random with replacement. If it is the immigration ball, one ball of each treatment type is added to the urn, no patient is treated, and the next ball is drawn. This is repeated until a type i ball (i = 1, \ldots, K) is drawn, and then the patient is assigned to treatment i. After a success a type i ball is added to the urn, and after a failure a type i ball is removed (Hu and Rosenberger, 2006). More details can be found in Ivanova et al. (2000).
When the best success rate is at least 1/2 the urn concentrates on that arm, and the other arms can end with very few patients. The asymptotic tests can then be well above their nominal level under the null hypothesis, especially for K \ge 3. Use typeI = TRUE to check the type I error.
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 |
Hu, F. and Rosenberger, W. F. (2006). The Theory of Response-Adaptive Randomization in Clinical Trials. John Wiley & Sons.
Ivanova, A., Rosenberger, W. F., Durham, S. D. and Flournoy, N. (2000). A birth and death urn for randomized clinical trials: asymptotic methods. Sankhya, Series B, 62(1), 104-118.
## a simple use
bd.res <- BirthDeathUrn(k = 3, p = c(0.6, 0.7, 0.6), ssn = 200, Y0 = NULL,
nsim = 100, alpha = 0.05)
## view the output
bd.res
## view all simulation settings
bd.res[["method"]]
bd.res[["parameter"]]
## view the simulation results
bd.res[["propotion"]]
bd.res[["failure rate"]]
bd.res[["power"]]
bd.res[["data: assignment"]]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.