negbin.samp: Estimates sample sizes for desired power using simulation...

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/negbin.samp.R

Description

The function provides estimate of sample size for given power when there is over-dispersion. The data is simulated from Negative Binomial distribution.

Usage

1
negbin.samp(power, lambda1, k, disp, alpha, seed, numsim, sig)

Arguments

power

A vector of values between 0 and 1 representing desired power.

lambda1

Mean count under the null distribution. It can be a vector.

k

Fold change desired under the alternative distribution. It can be a vector.

disp

The over-dispersion parameter. 1 represent no pver-dispersion and values above one represent over-dispersion.

alpha

Type I error rate: a value between 0 and 1. It can be a vector.

seed

Value of seed to ensure reproducibility of results.

numsim

Number of simulations. 1000 is recommended.

sig

Number of significant digits after decimal.

Details

The test statistic used is the scaled difference. Please contact the authors for more details on algorithm.

Value

Power.Expected

Desired Power.

Mean.Null

Mean Count under Null distribution.

Effect.Size

Fold Change Under the alternate hypothesis.

Disp.Par

Over-dispersion parameter.

N.est

Estimated sample size.

Power.est

Estimated Power.

Std.Err

Standard Error.

Note

The alternative ecological parameterization is used for Negative binomial distribution.

Author(s)

Milan Bimali

References

None

See Also

rnbinom

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#--------------------------------------------------
power = c(0.7,0.8);lambda1=3;k=c(2,3);
disp=2;alpha=0.1;seed = 20;numsim=100
sample.negbin <- negbin.samp(power,lambda1,k,disp,alpha,seed,numsim)
head(sample.negbin)
# Another example (takes longer to run)
#power = seq(0.7,0.95,0.05);lambda1=3;k=c(2,2.5,3);
#disp=2;alpha=0.005;seed = 20;numsim=1000
#sample.negbin <- negbin.samp(power,lambda1,k,disp,alpha,seed,numsim)
#head(sample.negbin)

Example output

  Power.Expected Mean.Null Effect.Size Disp.Par Type.I.Error N.est Power.est
1            0.7         3           2        2          0.1    22      0.77
2            0.8         3           2        2          0.1    29      0.82
3            0.7         3           3        2          0.1    10      0.74
4            0.8         3           3        2          0.1    15      0.84
  Std.Err
1   0.042
2   0.038
3   0.044
4   0.037

RSPS documentation built on May 1, 2019, 10:17 p.m.