polmer: Ordinal Regression with Mixed-effects

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/polmer.R

Description

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

Usage

1
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.

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.

Value

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

Author(s)

Kenneth Knoblauch

See Also

glm, glmer, polr

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
	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)
	}

Example output

Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called 'lme4.0'

MPDiR documentation built on May 2, 2019, 5:54 p.m.