Learn R Programming

fullfact (version 1.5.2)

powerLmer2: Power analysis for normal data 2

Description

Extracts the power values of dam, sire, and dam by sire variance components from a linear mixed-effect model using the lmer function of the lme4 package. Options to include one random position and/or one random block effect(s).

Usage

powerLmer2(varcomp, nval, alpha = 0.05, nsim = 100, position = NULL, block = NULL,
ml = F)

Value

Prints a data frame with the sample sizes, variance component inputs, variance component outputs, and power values.

Arguments

varcomp

Vector of known dam, sire, dam by sire, residual, and position and/or block variance components, i.e. c(dam, sire, dam x sire, residual, position/block). If there is a position and a block c(..., residual, position, block).

nval

Vector of known dam, sire, offspring per family, and offspring per position or number of blocks sample sizes, i.e. c(dam, sire, offspring, position/block). If there is a position and a block c(..., offspring, position, block).

alpha

Statistical significance value. Default is 0.05.

nsim

Number of simulations. Default is 100.

position

Optional number of positions.

block

Optional vector of dams and sires per block, e.g. c(2,2).

ml

Default is FALSE for restricted maximum likelihood. Change to TRUE for maximum likelihood.

Details

Extracts the dam, sire, dam, dam by sire, and position and/or block power values. Power values are calculated by stochastically simulation data and then calculating the proportion of significance values less than alpha for each component (Bolker 2008). Significance values for the random effects are determined using likelihood ratio tests (Bolker et al. 2009).

References

Bolker BM. 2008. Ecological models and data in R. Princeton University Press, New Jersey.

Bolker BM, Brooks ME, Clark CJ, Geange SW, Poulsen JR, Stevens MHH, White J-SS. 2009. Generalized linear mixed models: a practical guide for ecology and evolution. Trends in Ecology and Evolution 24(3): 127-135. DOI: 10.1016/j.tree.2008.10.008

Lynch M, Walsh B. 1998. Genetics and Analysis of Quantitative Traits. Sinauer Associates, Massachusetts.

See Also

powerLmer, powerLmer3

Examples

Run this code
#100 simulations
#position only, e.g. 8 tanks
if (FALSE) powerLmer2(varcomp=c(0.2030,0,0.1798,0.5499,0.1077),nval=c(8,8,20,160),position=8)
#block only, e.g. four 2 x 2
if (FALSE) powerLmer2(varcomp=c(0.2030,0,0.1798,0.5499,0.1077),nval=c(8,8,20,4),block=c(2,2))
#position and block
if (FALSE) powerLmer2(varcomp=c(0.2030,0,0.1798,0.5499,0.1077,0.1077),nval=c(8,8,20,40,4),
position=8,block=c(2,2))

Run the code above in your browser using DataLab