Learn R Programming

MPDiR (version 0.1-12)

polmer: Ordinal Regression with Mixed-effects

Description

Regression models are fit responses that are ordered factors with (or without) random effects.

Usage

polmer(formula, data, lnk = "logit", which.lme4 = "lme4.0",  ...)

Arguments

formula
a formula object that may include random effect terms using the format of lmer.
data
a data frame that includes the terms of the formula object as columns.
lnk
character specifying a link function, default logit.)
which.lme4
character indicating which version of lme4 to use.
...
additional named arguments passed along to glmer or glm.

Value

  • An object of class mer or glm depending on whether or not any random effect terms are included in the formula object.

Details

This function is a wrapper that calls glmer from the lme4 package if any random effect terms appear in the formula or glm, if not. The response term should be of class integer, as the function will coerce it to ordered. In the formula object, the random effect should be specified as the second level of random effect with the intercept removed. See the example below. This is a glitch for the moment.

See Also

glm, glmer, polr

Examples

Run this code
data(Faces)
	if(require(lme4.0, quietly = TRUE)){
	# no random effects specified - calls glm
	Faces.glm <- polmer(SimRating ~ sibs, Faces)
	# random effect of observer - call glmer
	#  GLITCH: must specify random effect as second level of factor (levels of sibs are 0/1)
	
	Faces.glmer <- polmer(SimRating ~ sibs + (sibs1 - 1 | Obs),
		Faces)
	}

Run the code above in your browser using DataLab