nparam: Number of parameters in model

View source: R/evalCriterion.R

nparamR Documentation

Number of parameters in model

Description

In the case of lm(), the result is the number of coefficients For a linear mixed model fit with lmer() there are 3 options. "edf": effective degrees of freedom as computed by sum of diagonal values of the hat matrix return by lmer() . "countLevels", returns the number of fixed effects + number of levels in random effects + 1 for residual variance term. This treats each level of a random effect as a parameter. "lme4", returns number of fixed effects + number of variance components. Here a random effect with 10 levels is only counted as 1 parameter. This tends to underpenalize.

Usage

nparam(object, nparamsMethod = c("edf", "countLevels", "lme4"))

Arguments

object

model fit by lm() or lmer()

nparamsMethod

"edf": effective degrees of freedom. "countLevels" count number of levels in each random effect. "lme4" number of variance compinents, as used by lme4. See description in nparam

Details

Number of parameters in model from lm() or lmer()

Value

number of parameters


GabrielHoffman/mvBIC documentation built on Sept. 5, 2022, 1:57 a.m.