Learn R Programming

languageR (version 0.2)

aovlmer.fnc: Compute p-values for factors in mixed models

Description

This function computes p-values for factors in a mixed-effects model. A p-value is returned based on an MCMC sample, as well as the anova table output by lmer extended with the p-values based on denominator degrees of freedom equal to the number of observations minus the number of fixed-effects coefficients. For small datasets, this p-value is anticonservative.

Usage

aovlmer.fnc(object, mcmc, which, noMCMC, ...)

Arguments

object
An lmer model for a continuous response variable fitted with lmer.
mcmc
A Markov chain Monte Carlo sample obtained with mcmcsamp for the lmer model.
which
A vector of integers or strings denoting the rows in the table of coefficients that specify the coefficients for the factor.
noMCMC
A logical indicating whether MCMC sampling should be skipped, in which case a data frame with a standard ANOVA table is returned.
...
Other optional arguments.

Value

  • When noMCMC == FALSE, a list with components
  • MCMCA list with the empirical p-value for the hypothesis that the columns of an MCMC sample specified by which have mean zero versus a general multivariate distribution with elliptical contours, and the rownames specified by which.
  • FtestsAn anova table listing the (anticonservative) p-value based on the F-test. This table is also returned when noMCMC is set to TRUE.

See Also

See also lmer, mcmcsamp.

Examples

Run this code
library(lme4, keep.source=FALSE)
	library(coda)
	data(latinsquare)
	l.lmer = lmer(RT~SOA+(1|Word)+(1|Subject), data=latinsquare)
	mcmc = mcmcsamp(l.lmer, n=10000)
	aovlmer.fnc(l.lmer, mcmc, c("SOAmedium", "SOAshort"))

Run the code above in your browser using DataLab