bssr.nb.gf {spass} | R Documentation |
Blinded Sample Size Reestimation for Longitudinal Count Data with marginal Negative Binomial Distribution and underlying Gamma Frailty with Autoregressive Correlation Structure of Order One
Description
bssr.nb.gf
fits blinded observations and recalculates the sample size required for sustaining power at desired alternative when testing for
trend parameters in a Gamma frailty models. See 'Details' for more information.
Usage
bssr.nb.gf(
data,
alpha = 0.025,
power = 0.8,
delta,
h0 = 0,
tp,
k,
trend = c("constant", "exponential", "custom"),
approx = 20
)
Arguments
data |
a matrix or data frame containing count data which is to be fitted. Columns correspond to time points, rows to observations. |
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 relevant effect size, which is assumed to be true, see 'Details'. |
h0 |
the value against which h is tested, see 'Details'. |
tp |
number of observed time points. (see |
k |
sample size allocation factor between groups: see 'Details'. |
trend |
the trend which assumed to underlying in the data. |
approx |
numer of iterations in numerical calculation of the sandwich estimator, see 'Details'. |
Details
The function recalculates a sample size for testing in constant and exponential trends.
Under a constant trend, the means in control and experiment group are equal to \lambda_1
and \lambda_1 + \lambda_2
, respectively.
The treatment effect delta
is therefore equal to \lambda_2
.
Under an exponential trend, the means in control and experiment group are equal to exp(\lambda_1+t \cdot \lambda_2)
and \lambda_1 + t\cdot \lambda_2 + t\cdot \lambda_3
, respectively.
The treatment effect delta
is therefore equal to \lambda_3
.
bssr.nb.gf
returns the required sample size for the control and treatment group required to prove an existing
alternative delta
with a specified power power
when testing the null hypothesis H_0: \delta \ge h_0
at level alpha
.
Nuisance parameters are estimated through the blinded observations data
, thus not further required.
For sample sizes n_C
and n_T
of the control and treatment group, respectively, the argument k
is the desired
sample size allocation factor at the end of the study, i.e. k = n_T/n_C
.
Value
bssr.nb.gf
returns the required sample size within the control group and treatment group.
Source
bssr.nb.gf
uses code contributed by Thomas Asendorf.
See Also
rnbinom.gf
for information on the Gamma Frailty model, n.nb.gf
for calculating
initial sample size required when performing inference, fit.nb.gf
for calculating
initial parameters required when performing sample size estimation.
Examples
##The example is commented as it may take longer than 10 seconds to run.
##Please uncomment prior to execution.
##Example for constant rates
#set.seed(12)
#h<-function(lambda.eta){
# lambda.eta[2]
#}
#hgrad<-function(lambda.eta){
# c(0, 1, 0)
#}
##Calculate initial sample size
#estimate<-n.nb.gf(lambda=c(0,-0.3), size=1, rho=0.5, tp=6, k=1, h=h, hgrad=hgrad,
# h0=0, trend="constant", approx=20)
##Generate and permutate data with different nuisance parameters
#random<-get.groups(n=round(estimate$n/2), size=c(0.8, 0.8), lambda=c(0.5, -0.3),
# rho=c(0.4, 0.4), tp=6, trend="constant")
#random<-random[sample(1:nrow(random), nrow(random)), ]
##Recalculate sample size with data
#reestimate<-bssr.nb.gf(data=random, alpha=0.025, power=0.8, delta=-0.3, h0=0,
# tp=6, k=1, trend="constant", approx = 20)
#summary(reestimate)