samplesize: Sample size calculation in SCCS

View source: R/samplesize.R

samplesizeR Documentation

Sample size calculation in SCCS

Description

The function calculates the sample size required for an SCCS analysis.

Usage

samplesize(eexpo, risk, astart, aend, p, alpha=0.05, power=0.8, eage=NULL,
          agegrp=NULL)

Arguments

eexpo

the design value of the exposure related relative incidence.

risk

a positive number showing the duration the risk period. It should not be greater than the duration of the shortest age group, if age groups are specified.

astart

age at start of the observation period. It is an integer greater or equal to 0, that is the same start of observation for all cases.

aend

age at end of an observation period. It is an integer greater than 0, that is the same end of observation for all cases.

p

a vector/scalar of proportions of exposed in each age group, the default is p=1 where there are no age effects and all cases are exposed.

alpha

level of significance e.g 0.05.

power

the power required to detect the relative incidence specified in eexpo, e.g 0.8.

eage

age related relative incidence parameters, the reference group is the first one.

agegrp

a vector of cut points of the age groups where each value represents the start of an age category. The first element in the vector is the start of the second age group. The first age group starts at the minimum of astart, the start of observation period. The default is NULL (i.e no age effects included).

Value

a sample size is produced.

Author(s)

Yonas Ghebremichael-Weldeselassie, Heather Whitaker, Paddy Farrington.

References

Musonda, P., Farrington, C. P., and Whitaker, H. (2006). Sample sizes for self-controlled case series studies. Statistics in Medicine 25, 2618–2631.

Farrington P., Whitaker H., and Ghebremichael-Weldeselassie Y. (2018). Self-controlled Case Series Studies: A modelling Guide with R. Boca Raton: Chapman & Hall/CRC Press.

Examples


# Sample size for exposure RI = 2.5 with 21 days risk period, 
# all cases exposed. The level of significance is 0.05 
# with 80% power. The sample size of when p=1 is: 

   ss1 <- samplesize(eexpo=2.5, risk=21, astart=366, aend=730,
                 p=1, alpha=0.05, power=0.8)

   ss1


# the sample size of events from cases exposed or not when 75% of the 
# population are exposed

   ss2 <- samplesize(eexpo=2.5, risk=21, astart=366, aend=730,
                 p=0.75, alpha=0.05, power=0.8)


   ss2

# Sample size when age effect is included and the proportions of the  
# target exposed population which are exposed in each age group
# are p=c(0.50,0.35,0.1,0.05): 

   ss3 <- samplesize(eexpo=2.5, risk=21, astart=366, aend=730,
                 p=c(0.50,0.35,0.1,0.05), alpha=0.05, power=0.8,
                 eage=c(1.2,1.6,2.0), agegrp=c(457,548,639))

   ss3
 
# Suppose that the sample is from the entire population with 75% exposed,
# then p=0.75*c(0.50,0.35,0.1,0.05)  

  ss4 <- samplesize(eexpo=2.5, risk=21, astart=366, aend=730,
                 p=0.75*c(0.50,0.35,0.1,0.05), alpha=0.05, power=0.8,
                 eage=c(1.2,1.6,2.0), agegrp=c(457,548,639)) 
  ss4 
 

SCCS documentation built on July 5, 2022, 5:05 p.m.