main.function {exact.n} | R Documentation |
Provide sample size solutions for target size and power.
Description
Function gives smallest values for n1 as function of n0 that achieve target size and power.
Usage
main.function(
alpha,
delta,
beta = 0.75,
p0 = 0.5,
type = 2,
plt = FALSE,
out = (-1),
b.lim = 5,
prin = TRUE
)
Arguments
alpha |
value of nominal size of test |
delta |
value of clinically relevant difference |
beta |
scalar target for power |
p0 |
single value or range of values for baseline probability |
type |
type of maximisation (see n1.get documentation) |
plt |
If TRUE, plot n1 solutions versus |
out |
More solutions output if out > 0 than out < 0 (see details) |
b.lim |
maximum imbalance of sample sizes |
prin |
If TRUE, error messages will be printed. |
Details
If out > 0 all solutions (including n1=Inf) are returned. If out=0, infinite values are suppressed. If out < 0, only output satisfying the balance criterion are output.
Value
list with elements n0 and n1
Note
The appropriate data file needs to have been downloaded corresponding to the desired value of alpha and delta. This can be done with the fetch.data() function.
Author(s)
Chris J. Lloyd
References
C.J. Lloyd (2022) Exact samples sizes for clinical trials subject to size and power constraints. Preprint. doi:10.13140/RG.2.2.11828.94085
Examples
# We are interested in designs with power at least 0.75 when exact size
# 0.025 and delta=0.20. Therefore, you would need to have downloaded
# LIB.a025.d20 using fetch(0.015,0.20). The example below instead uses
# the toy data that comes with the package. The baseline probability is
# assumed to be between 0.3 and 0.5.
rdata_file = system.file('files', 'LIB.a025.d20.Rdata', package = 'exact.n')
load(rdata_file)
#' main.function(.025,0.20,p0=c(0.3,0.5),beta=0.75,plt=TRUE)
# The value of the function is the minimum value of n1 for a range
# of values of n0. The sample size ratio is limited to 5 by default.