Learn R Programming

sjstats (version 0.2.0)

merMod_p: Get p-values for merMod objects

Description

This function computes p-values for mixed effects models (merMod-objects) that have been fitted with the lme4-package.

Usage

merMod_p(x, p.kr = TRUE)

Arguments

x
A fitted (generalized) linear (mixed) model (merMod-object).
p.kr
Logical, if TRUE, the computation of p-values is based on conditional F-tests with Kenward-Roger approximation for the df (see 'Details').

Value

A named vector with p-values for the model coefficients.

Details

For linear mixed models (lmerMod-objects), the computation of p-values (if p.kr = TRUE) is based on conditional F-tests with Kenward-Roger approximation for the df, using the pbkrtest-package. If pbkrtest is not available or p.kr = FALSE, or if x is a glmerMod-object, computation of p-values is based on normal-distribution assumption, treating the t-statistics as Wald z-statistics. If p-values already have been computed (e.g. for merModLmerTest)-objects from the lmerTest-package), these will be returned.

Examples

Run this code
library(lme4)
# fit model
fit <- lmer(Reaction ~ Days + (Days | Subject), data = sleepstudy)
merMod_p(fit)
merMod_p(fit, p.kr = FALSE)

Run the code above in your browser using DataLab