Description Usage Arguments Details Value Source See Also Examples
n.nb.inar1
calculates the required sample size for proving a desired alternative when testing for
a rate ratio between two groups unequal to one. Also gives back power for a specified sample size. See 'Details' for more information.
1 2 3 4 5 6 7 8 9 10 11 12 | n.nb.inar1(
alpha,
power = NULL,
delta,
muC,
size,
rho,
tp,
k,
npow = NULL,
nmax = Inf
)
|
alpha |
level (type I error) to which the hypothesis is tested. |
power |
power (1 - type II error) to which an alternative should be proven. |
delta |
the rate ratio which is to be proven. |
muC |
the rate observed within the control group. |
size |
dispersion parameter (the shape parameter of the gamma mixing distribution). Must be strictly positive, need not be integer (see |
rho |
correlation coefficient of the underlying autoregressive correlation structure. Must be between 0 and 1 (see |
tp |
number of observed time points. (see |
k |
sample size allocation factor between groups: see 'Details'. |
npow |
sample size for which a power is to be calculated. Can not be specified if power is also specified. |
nmax |
maximum total sample size of both groups. If maximum is reached a warning message is broadcasted. |
When testing for differences between rates μ_C and μ_T of two groups, a control and a treatment group respectively, we usually test for the ratio between the two rates, i.e. μ_T/μ_C = 1. The ratio of the two rates is refered to as δ, i.e. δ = μ_T/μ_C.
n.nb.inar1
gives back the required sample size for the control and treatment group required to prove an existing
alternative theta
with a specified power power
when testing the null hypothesis H_0: μ_T/μ_C ≥ 1 to level alpha
.
If power
is not specified but instead npow
, the power achieved with a total sample size of npow
is calculated.
For sample sizes n_C and n_T of the control and treatment group, respectively, the argument k
is the
sample size allocation factor, i.e. k = n_T/n_C.
rnbinom.inar1
returns the required sample size within the control group and treatment group.
rnbinom.inar1
uses code contributed by Thomas Asendorf.
rnbinom.inar1
for information on the NB-INAR(1) model, fit.nb.inar1
for calculating
initial parameters required when performing sample size estimation, bssr.nb.inar1
for blinded
sample size reestimation within a running trial.
1 2 3 4 5 6 7 8 9 10 | #Calculate required sample size to find significant difference with
#80% probability when testing the Nullhypothesis H_0: mu_T/mu_C >= 1
#assuming the true effect delta is 0.8 and rate, size and correlation
#parameter in the control group are 2, 1 and 0.5, respectively.
estimate<-n.nb.inar1(alpha=0.025, power=0.8, delta=0.8, muC=2, size=1, rho=0.5, tp=7, k=1)
summary(estimate)
estimate<-n.nb.inar1(alpha=0.025, npow=200, delta=0.8, muC=2, size=1, rho=0.5, tp=7, k=1)
summary(estimate)
|
Loading required package: mvtnorm
Loading required package: multcomp
Loading required package: survival
Loading required package: TH.data
Loading required package: MASS
Attaching package: 'TH.data'
The following object is masked from 'package:MASS':
geyser
Loading required package: Rcpp
Loading required package: geepack
Initial Sample Size Calculation
---------------------------------
alpha level: 0.025
testing power: 0.8
rate ratio: 0.8
rate control group 2
dispersion parameter: 1
correlation parameter: 0.5
time points: 7
allocation factor: 1
Sample Size
---------------------------------
control group: 171
treatment group: 171Initial Sample Size Calculation
---------------------------------
alpha level: 0.025
testing power: 0.57
rate ratio: 0.8
rate control group 2
dispersion parameter: 1
correlation parameter: 0.5
time points: 7
allocation factor: 1
Sample Size
---------------------------------
control group: 100
treatment group: 100
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.