bssr.nb.gf: Blinded Sample Size Reestimation for Longitudinal Count Data...

Description Usage Arguments Details Value Source See Also Examples

View source: R/bssr.nb.gf.r

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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 rnbinom.gf)

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 λ_1 and λ_1 + λ_2, respectively. The treatment effect delta is therefore equal to λ_2.

Under an exponential trend, the means in control and experiment group are equal to exp(λ_1+t \cdot λ_2) and λ_1 + t\cdot λ_2 + t\cdot λ_3, respectively. The treatment effect delta is therefore equal to λ_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: δ ≥ 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
##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)

spass documentation built on Jan. 13, 2021, 7:57 p.m.

Related to bssr.nb.gf in spass...