Learn R Programming

lmSupport (version 2.9.13)

modelPower: Calculate power for GLM tests

Description

Wrapper to calculate power for tests of paramter estimates or full model in GLM based on Cohen's tables and using pwr.f2.test in pwr packag. Allows use of partial eta squared or delta R2 rather than just f2 as effect size. If you provide power, it returns N, if you provide N, it returns power. You must specify effect size as either f2, partial eta2, or delta R2 with model R2. You must also specify the number of parameters in the compact (pc) and augmented (pa) for the model comparison that will test the effect.

Usage

modelPower(pc=NULL, pa=NULL, N=NULL, alpha=0.05, power=NULL, 
f2=NULL, peta2=NULL, dR2=NULL, R2=NULL)

Arguments

pc

Number of parameters in the compact model; i.e., intercept + all parameters excluding the effect of interest; This is the numerator df of the F test for the effect

pa

Number of parameters in the augmented model; i.e., the intercept and all parameters including the effect of interest

N

sample size

alpha

alpha for statistical test

power

power for statistical test

f2

f2 effect size

peta2

partial eta2 effect size

dR2

delta R2 effect size; if provided must also specify R2

R2

Model R2, only need if using Delta R2 as effect size

Value

Returns either power or N from analysis

See Also

pwr.f2.test

Examples

Run this code
# NOT RUN {
modelPower(pc=3, pa=4, power=.90, peta2=.157)
modelPower(pc=1, pa=3, N=100, peta2=.157, alpha=.01)
# }

Run the code above in your browser using DataLab