make.swt: Simulates a 'virtual' Stepped Wedge trial

View source: R/SWSamp.R

make.swtR Documentation

Simulates a 'virtual' Stepped Wedge trial

Description

Simulates trial data for a SWT with normally distributed outcome

Usage

make.swt(
  I = NULL,
  J = NULL,
  H = NULL,
  K,
  design = "cross-sec",
  mu = NULL,
  b.trt,
  b.time = NULL,
  sigma.y = NULL,
  sigma.e = NULL,
  rho,
  sigma.a = NULL,
  rho.ind = NULL,
  sigma.v = NULL,
  X = NULL,
  family = "gaussian",
  natural.scale = TRUE
)

Arguments

I

Number of clusters

J

Number of time points

H

Number of units randomised at each time point

K

Average size of each cluster

design

type of design. Can be 'cross-sec' (default) or 'cohort' (repeated measurements)

mu

baseline outcome value

b.trt

Treatment effect

b.time

Time effect

sigma.y

total standard deviation

sigma.e

individual standard deviation

rho

Intra-class correlation coefficient

sigma.a

the sd of the the cluster-level intercept (default at NULL)

rho.ind

individual-level ICC (for cohorts)

sigma.v

the sd of the cluster-level slope (by intervention, default at NULL)

X

A design matrix for the SWT. Default at NULL (will be computed automatically)

family

The model family to be used. Default value is 'gaussian' and other possibile choices are 'binomial' or 'poisson'

natural.scale

Indicator for whether the input is passed on the natural scale or on the scale of the linear predictor. By default is set to TRUE. In the case of family='gaussian' it does not have any effect, since the link for the linear predictor is the identity. But for family='binomial' or family='poisson', the user has to specify when the input is given on the logit or log scale

Value

data

A data frame containing the resulting simulated dataset

Author(s)

Gianluca Baio, Rosie Leach

References

Baio, G; Copas, A; Ambler, G; Hargreaves, J; Beard, E; and Omar, RZ Sample size calculation for a stepped wedge trial. Trials, 16:354. Aug 2015.

See Also

See Also sim.power


giabaio/SWSamp documentation built on Nov. 14, 2022, 2:24 p.m.