mixor (version 1.0.4)

mixor: Mixed-Effects Ordinal Regression Analysis

Description

This function fits mixed-effects ordinal and binary response models. Various link functions are supported including probit, logistic, and complementary log-log. For longitudinal data, the mixor function allows for individual varying intercepts and slopes across times.

Usage

mixor(formula, data, id, which.random.slope = NA, subset, weights, 
	exclude.fixed.effect = NA, CONV = 1e-04, empirical.prior = FALSE, 
	quadrature.dist = "Normal", nAGQ = 11, adaptive.quadrature = TRUE, 
	link = "probit", KG = 0, KS = 0, IADD = -1, indep.re = FALSE, 
	random.effect.mean = TRUE, UNID = 0, vcov = TRUE)

Arguments

formula

an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted.

data

an optional data.frame containing the variables in the model. Note the data.frame must be sorted by id prior to invoking the mixor function.

id

name of clustering variable in the data.frame

which.random.slope

which.random.slope=NA means no random slope, only a random intercept is fit. To specify a random slope, which.random.slope is the number of the predictor variable on the RHS of the model formula. More than one variable can have a random slope.

subset

an optional vector specifying a subset of observations to be used in the fitting process.

weights

when supplied, indicates differential weights are used; otherwise each id is weighted equally. weights are the frequency weights to be assigned to each id.

exclude.fixed.effect

the RHS of the model includes both fixed and random effects. Variables are identified as random effects using which.random.slope. If it is desired that a variable be included in the model without a fixed effect (random only), the number of that variable(s) in the RHS formula should be passed to exclude.fixed.effects.

CONV

convergence criteria, default is 0.0001.

empirical.prior

logical. If TRUE, uses empirical prior for random effects.

quadrature.dist

distribution for random effects. Either "Normal" (default) or "Uniform".

nAGQ

number of quadrature nodes per dimension. For one random effect, nAGQ=20 is reasonable but should be reduced to 5-10 for multiple random effects.

adaptive.quadrature

logical indicating whether adaptive quadrature (default) or non-adaptive quadrature is performed.

link

Link function, either "probit", "logit", or "cloglog"

KG

an optional integer reflecting the number of covariates to interact with threshold parameters (the first KG variables on the RHS of the model formula, so the order of the variables on the RHS of the model formula is important when using KG). Note that if KG is non-zero, KS must be zero.

KS

an optional integer reflecting the number of covariates used in scaling (the first KS variables on the RHS of the model formula, so the order of the variables on the RHS of the model formula is important when using KS). Note that if KS is non-zero, KG must be zero.

IADD

indicates how XB part of model is included; -1 subtract covariates and mean of random effects from thresholds; 1 add covariates and mean of random effects to thresholds. Default is -1 (subtract XB).

indep.re

logical. If TRUE, independent random effects. Default is FALSE which assumes correlated random effects.

random.effect.mean

logical. If TRUE, estimate the mean of the random effects.

UNID

indicator variable where 0 = random effects are multi-dimensional; 1 = random effects are variables related to a uni-dimensional random effect (e.g., item indicators of a latent variable).

vcov

logical. Default is vcov=TRUE which returns estimates of the the random-effect variance-covariance matrix. When vcov=FALSE, then estimates of the Cholesky (matrix square-root) of the random-effect variance-covariance matrix are returned.

Value

A list with components:

call

Model call formula

Deviance

Model deviance

Quadrature.points

number of quadrature nodes per dimension used in fit

Model

a matrix summarizing the model fit including columns Estimate, SE, Z, and P-value

varcov

The variance-covariance matrix

EBmean

empirical Bayes estimates of the means of the posterior distribution for each id

EBvar

empirical Bayes estimates of posterior variance/covariance for each id)

RIDGEMAX

Ridge

RLOGL

Log-likelihood

SE

a matrix corresponding the standard errors of the parameters estimates in coef

AIC

AIC

SBC

Schwarz criterion

AICD

Akaike information criterion

SBCD

deviance information criterion

MU

mean of random effects

ALPHA

fixed effects estimates

SIGMA

random effects variance-covariance matrix

GAM

thresholds

TAU

scaling parameter estimates when proportional odds are not assumed. Returns when KG is non-zero.

IADD

indicates how the XB part of model was included; -1 subtract covariates and mean of random effects from thresholds; 1 add covariates and mean of random effects to thresholds.

Y

the response from the fitted model.

X

the random effects terms from the fitted model.

W

the fixed effects terms from the fitted model.

MAXJ

the number of ordinal levels.

random.effect.mean

If TRUE, the mean of the random effects was estimated.

KS

integer reflecting the number of covariates that were specified to use in scaling (the first KS variables on the RHS of the model formula).

KG

integer reflecting the number of covariates that were specified to interact with the threshold parameters (the first KG variables on the RHS of the model formula).

id

name of clustering variable in the data.frame

which.random.slope

the number of the predictor variable on the RHS of the model formula having a random slope. When which.random.slope=NA, only a random intercept model was fit.

ICEN

if 1 indicates right-censoring was considered in the model fit.

link

Link function, either "probit", "logit", or "cloglog"

terms

terms from the fitted model.

Details

A typical model has the form response ~ terms where response is the (numeric) response vector and terms is a series of terms which specifies a linear predictor for response. The response can also be a censored survival response, of the form Surv(time,censorvariable)

References

Hedeker D. and Gibbons R.D. (1996) A computer program for mixed-effects ordinal regression analysis. Computer Methods and Programs in Biomedicine 49, 157-176. Hedeker D and Gibbons R.D. (2006) Longitudinal Data Analysis, Wiley, Hoboken, New Jesery.

See Also

See Also as summary.mixor, predict.mixor, coef.mixor, vcov.mixor, print.mixor

Examples

Run this code
# NOT RUN {
library("mixor")
data("SmokingPrevention")
# data frame must be sorted by id variable
SmokingPrevention<-SmokingPrevention[order(SmokingPrevention$class),]
# school model
Fitted.school<-mixor(thksord~thkspre+cc+tv+cctv, data=SmokingPrevention, 
     id=school, link="logit")
summary(Fitted.school)
vcov(Fitted.school)
# students in classrooms analysis 
Fitted.students<-mixor(thksord~thkspre+cc+tv+cctv, data=SmokingPrevention, 
     id=class, link="logit")
summary(Fitted.students)
coef(Fitted.students)
vcov(Fitted.students)
cm<-matrix(c(-1,-1,-1,0,0,0,0,0,
              0, 0, 0,0,0,0,0,0,
			  0, 0, 0,1,0,0,0,1),ncol=3,byrow=TRUE)
Contrasts(Fitted.students, contrast.matrix=cm)
# }

Run the code above in your browser using DataLab