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.
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)
an object of class "formula
" (or one that can be coerced to that class): a symbolic description of the model to be fitted.
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.
name of clustering variable in the data.frame
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.
an optional vector specifying a subset of observations to be used in the fitting process.
when supplied, indicates differential weights are used; otherwise each id is weighted equally. weights
are the frequency weights to be assigned to each id.
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
.
convergence criteria, default is 0.0001.
logical. If TRUE, uses empirical prior for random effects.
distribution for random effects. Either "Normal"
(default) or "Uniform"
.
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.
logical indicating whether adaptive quadrature (default) or non-adaptive quadrature is performed.
Link function, either "probit"
, "logit"
, or "cloglog"
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.
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.
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).
logical. If TRUE, independent random effects. Default is FALSE which assumes correlated random effects.
logical. If TRUE, estimate the mean of the random effects.
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).
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.
A list with components:
Model call formula
Model deviance
number of quadrature nodes per dimension used in fit
a matrix summarizing the model fit including columns Estimate, SE, Z, and P-value
The variance-covariance matrix
empirical Bayes estimates of the means of the posterior distribution for each id
empirical Bayes estimates of posterior variance/covariance for each id)
Ridge
Log-likelihood
a matrix corresponding the standard errors of the parameters estimates in coef
AIC
Schwarz criterion
Akaike information criterion
deviance information criterion
mean of random effects
fixed effects estimates
random effects variance-covariance matrix
thresholds
scaling parameter estimates when proportional odds are not assumed. Returns when KG
is non-zero.
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.
the response from the fitted model.
the random effects terms from the fitted model.
the fixed effects terms from the fitted model.
the number of ordinal levels.
If TRUE, the mean of the random effects was estimated.
integer reflecting the number of covariates that were specified to use in scaling (the first KS variables on the RHS of the model formula).
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).
name of clustering variable in the data.frame
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.
if 1 indicates right-censoring was considered in the model fit.
Link function, either "probit"
, "logit"
, or "cloglog"
terms from the fitted model.
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)
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 as summary.mixor
, predict.mixor
, coef.mixor
, vcov.mixor
, print.mixor
# 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