Obtain pvalues for a mixedmodel from lmer().
Description
Fits and calculates pvalues for all effects in a mixed
model fitted with lmer
. The default
behavior (currently the only behavior implemented)
calculates type 3 like pvalues using the KenwardRogers
approximation for degreesoffreedom implemented in
KRmodcomp
. print
,
summary
, and anova
methods for the returned
object of class "mixed"
are available (all return
the same data.frame).
Usage
1 2 
Arguments
fixed 
character vector specifying the fixed part of the model. 
random 
character vector specifying the random part of the model (in the current implementation this random part is fit with all models). 
dv 
character vector specifying the dependent variable 
data 
data.frame containing the data. Should have
all the variables present in 
type 
type of sums of squares on which effects are
based. Currently only type 3 ( 
method 
character vector indicating which methods
for obtaining pvalues should be used. Currently only

... 
further arguments passed to 
Details
Type 3 sums of squares are obtained by fitting a model in which only the corresponding effect is missing.
See Judd, Westfall, and Kenny (2012) for examples of how to specify the random effects structure for factorial experiments.
Value
An object of class "mixed"
(i.e., a list) with the
following elements:

anova.table
a data.frame containing the statistics returned fromKRmodcomp
. 
full.model
the"mer"
object returned from fitting the full mixed model. 
restricted.models
a list of"mer"
objects from fitting the restricted models (i.e., each model lacks the corresponding effect) 
tests
a list of objects returned by the function for obtaining the pvalues (objects are of class"KRmodcomp"
whenmethod = "KR"
). 
type
Thetype
argument used when calling this function. 
method
Themethod
argument used when calling this function.
The following methods exist for objects of class
"mixed"
: print
, summary
, and
anova
(all return the same data.frame).
Note
This functions may take some time especially with complex random structures.
Author(s)
Henrik Singmann with contributions from Ben Bolker and Joshua Wiley.
References
Judd, C. M., Westfall, J., & Kenny, D. A. (2012). Treating stimuli as a random factor in social psychology: A new and comprehensive solution to a pervasive but largely ignored problem. Journal of Personality and Social Psychology, 103(1), 54–69. doi:10.1037/a0028347
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23  ## Not run:
# example data from package languageR:
# Lexical decision latencies elicited from 21 subjects for 79 English concrete nouns, with variables linked to subject or word.
data(lexdec, package = "languageR")
# using the simplest model
m1 < mixed("Correct + Trial + PrevType * meanWeight + Frequency + NativeLanguage * Length", "(1Subject) + (1Word)", "RT", data = lexdec)
anova(m1)
# gives:
## Effect df1 df2 Fstat p.value
## 1 (Intercept) 1 96.64 13573.0985 0.000
## 2 Correct 1 1627.73 8.1452 0.004
## 3 Trial 1 1592.43 7.5738 0.006
## 4 PrevType 1 1605.39 0.1700 0.680
## 5 meanWeight 1 75.39 14.8545 0.000
## 6 Frequency 1 76.08 56.5348 0.000
## 7 NativeLanguage 1 27.12 0.6953 0.412
## 8 Length 1 75.83 8.6959 0.004
## 9 PrevType:meanWeight 1 1601.18 6.1823 0.013
## 10 NativeLanguage:Length 1 1555.49 14.2445 0.000
## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.