wlsMixedPower: wlsMixedPower

Description Usage Arguments Value Examples

View source: R/MainFunction.R

Description

This is the work-horse function of the SteppedPower package. It calls the constructor functions for the design matrix $X$ and covariance matrix $V$, and then calculates the variance of the intervention effect via $$Var(trteff)=(X'V^-1X)^-1[1,1]$$

Usage

1
2
3
wlsMixedPower(EffSize, sigma, tau, family = gaussian(),
  timepoints = NULL, N = NULL, sig.level = 0.05, DesMat = NULL,
  Cl = NULL, delay = NULL, design = "SWD")

Arguments

EffSize

numeric, raw effect

sigma

numeric, residual error of cluster means if no N given. Else residual error on individual level

tau

numeric, standard deviation of random intercepts

sig.level

numeric, significance level, defaults to 0.05

Cl

integer (vector), number of clusters per wave (in SWD), or number in control and intervention (in parallel designs)

delay

numeric (possibly vector), value between 0 and 1 specifing the intervention effect in the first (second ... ) intervention phase *not implemented*

design

character, defines the type of design. Options are "SWD" and "parallel", defaults to "SWD".

Value

a list of lenght two. First element is the power, second element the weights of cluster per period for estimating the treatment effect

Examples

1
2
wlsMixedPower(EffSize=1,Cl=c(1,1,1,1,1),sigma=2 ,        tau=0.2, N=c(1,1,1,1,1) )
wlsMixedPower(EffSize=1,Cl=c(1,1,1,1,1),sigma=2*sqrt(2) ,tau=0.2, N=c(2,2,2,2,2) )

PMildenb/SteppedPower documentation built on Dec. 7, 2018, 7:59 a.m.