View source: R/type1error.NIfrontier.binary.R
type1error.NIfrontier.binary | R Documentation |
A function that can be used to compute type 1 error rate for a non-inferiority trial with binary outcome designed using non-inferiority frontiers. The trial can aim to use one of several possible analysis methods and summary measures.
type1error.NIfrontier.binary(p.control.expected, NI.frontier, sig.level=0.025,
summary.measure="RD", print.out=TRUE, unfavourable=TRUE,
n.control, n.experim, n.rep=1000, M.boot=2000, BB.adj=0.0001,
test.type="LRT")
p.control.expected |
Expected event risk in the control arm. |
NI.frontier |
Non-inferiority frontier, a function whos eonly input should be the control event risk and that returns the NI margin for that risk expressed as the specified summary measure. |
sig.level |
One-sided significance level for testing. Default is 0.025, i.e. 2.5%. |
n.control |
The sample size in the control arm for which to estimate type1error. |
n.experim |
The sample size in the experimental arm for which to estimate type1error. |
summary.measure |
The population-level summary measure to be estimated, i.e. the scale on which we define the non-inferiority margin. Can be one of "RD" (Risk Difference), "RR" (Risk Ratio), "OR" (Odds Ratio) or "AS" (Arc-Sine difference). |
print.out |
Logical. If FALSE, no output is printed. |
test.type |
A string that indicates the type of test to be assumed for the sample size calculation. Currently, three options are supported: "Wald", "score" and "local". |
unfavourable |
A logical variable. If TRUE, the outcome is considered unfavourable. This is used to check that the NI margin specified is meaningful. |
n.rep |
The number of repetitions of the simulations to estimate type1error. |
M.boot |
Number of bootstrap samples if using a bootstrap-based analysis method. |
BB.adj |
Adjustment factor for "Berger.Boos" method. |
This function estimates type 1 error rate of a two-arm non-inferiority trial designed using non-inferiority frontiers for a given sample size, running a certain number n.rep of simulations under the null hypothesis and calculating estimated success rate of the trial with the desired design and analysis methods.
The estimated type1error. On screen, the Monte-Carlo Confidence Interval is printed as well.
NI.f<-function(p) {
marg<-ifelse(p<0.15,p, 0.15)
return(marg)
}
t1err<-type1error.NIfrontier.binary(p.control.expected=0.2, NI.frontier=NI.f, n.control=200, n.experim=200,
n.rep=500)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.