| Title: | Mixed-Effects Ordinal Regression Analysis |
|---|---|
| Description: | Provides the function 'mixor' for fitting a mixed-effects ordinal and binary response models and associated methods for printing, summarizing, extracting estimated coefficients and variance-covariance matrix, and estimating contrasts for the fitted models. |
| Authors: | Kellie J. Archer [aut, cre] (ORCID: <https://orcid.org/0000-0003-1555-5781>), Donald Hedeker [aut], Rachel Nordgren [aut], Robert D. Gibbons [aut] |
| Maintainer: | Kellie J. Archer <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 1.0.7 |
| Built: | 2026-07-03 12:11:53 UTC |
| Source: | https://github.com/cran/mixor |
This package provides a function mixor for fitting mixed-effects ordinal and binary response models and associated methods for printing, summarizing, extracting estimated coefficients and the variance-covariance matrix, and estimating contrasts for the fitted models.
| Package: | mixor |
| Type: | Package |
| Title: | Mixed-Effects Ordinal Regression Analysis |
| Version: | 1.0.7 |
| Date: | 2026-07-02 |
| Authors@R: | c(person(c("Kellie J."), "Archer", email="[email protected]", role = c("aut","cre"), comment = c(ORCID="0000-0003-1555-5781")), person("Donald", "Hedeker", email="[email protected]", role = "aut"), person("Rachel", "Nordgren", email="[email protected]", role="aut"), person(c("Robert D."), "Gibbons", role = "aut")) |
| Maintainer: | Kellie J. Archer <[email protected]> |
| Description: | Provides the function 'mixor' for fitting a mixed-effects ordinal and binary response models and associated methods for printing, summarizing, extracting estimated coefficients and variance-covariance matrix, and estimating contrasts for the fitted models. |
| License: | GPL (>= 2) |
| Depends: | R (>= 4.6.0), survival |
| BuildResaveData: | best |
| Biarch: | yes |
| NeedsCompilation: | yes |
| SystemRequirements: | GNU make |
| LazyLoad: | true |
| Packaged: | 2026-07-03 00:29:44 UTC; archer.43 |
| Author: | Kellie J. Archer [aut, cre] (ORCID: <https://orcid.org/0000-0003-1555-5781>), Donald Hedeker [aut], Rachel Nordgren [aut], Robert D. Gibbons [aut] |
| Config/pak/sysreqs: | make |
| Repository: | https://cran.r-universe.dev |
| Date/Publication: | 2026-07-03 08:40:07 UTC |
| RemoteUrl: | https://github.com/cran/mixor |
| RemoteRef: | HEAD |
| RemoteSha: | a5f122bd1590927319146a3c84b53309c182a5b4 |
Index of help topics:
AIC.mixor Return AIC for a Fitted Mixor Model
BIC.mixor Return BIC for a Fitted Mixor Model
coef.mixor Extract Model Coefficients
concen Twins Trouble Concentrating Data
Contrasts Estimate Contrasts for Mixor Object
deviance.mixor Return the deviance for a Fitted Mixor Model
irt.data Armed Servces Vocational Aptitude Battery
logLik.mixor Return the log-likelihood for a Fitted Mixor
Model
mixor Mixed-Effects Ordinal Regression Analysis
mixor-deprecated Deprecated Functions in Package mixor
mixor-package Mixed-Effects Ordinal Regression Analysis
mixord Old Function Name Replaced with mixor
norcag Attitudes Towards Sex Data from the 1989
General Social Survey
plot.mixor Plot empirical Bayes estimates of random
effects for a Mixor Model Object
predict.mixor Predict Outcome From Mixor Fitted Model
print.mixor Printing Mixor Model Fits
schizophrenia National Institute of Mental Health
Schizophrenia Collaborative Study
SmokeOnset Smoking Onset Data
SmokingPrevention Television School and Family Smoking Prevention
and Cessation Project Data
summary.mixor Summarize Mixor Model Fit
vcov.mixor Return Variance-Covariance Matrix for a Mixor
Model Object
Further information is available in the following vignettes:
mixor |
An R Package for Longitudinal and Clustered Ordinal Response Modeling (source, pdf) |
This package provides a function mixor for fitting mixed-effects ordinal and binary response models and associated methods for printing, summarizing, extracting estimated coefficients and the variance-covariance matrix, and estimating contrasts for the fitted models.
Kellie J. Archer [aut, cre] (ORCID: <https://orcid.org/0000-0003-1555-5781>), Donald Hedeker [aut], Rachel Nordgren [aut], Robert D. Gibbons [aut] Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons Maintainer: Kellie J. Archer <[email protected]> Kellie J. Archer <[email protected]>
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.
See also mixor, and examples in norcag, irt.data, concen, SmokeOnset, schizophrenia
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", nAGQ=11) 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)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", nAGQ=11) 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)
Returns the AIC of a fitted mixor model.
## S3 method for class 'mixor' AIC(object, ...)## S3 method for class 'mixor' AIC(object, ...)
object |
a |
... |
other arguments. |
AIC of the fitted mixor model.
Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons
See Also as mixor, summary.mixor
library("mixor") data("schizophrenia") ### Random intercept SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, link="probit") summary(SCHIZO1.fit) AIC(SCHIZO1.fit)library("mixor") data("schizophrenia") ### Random intercept SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, link="probit") summary(SCHIZO1.fit) AIC(SCHIZO1.fit)
Returns the BIC of a fitted mixor model.
## S3 method for class 'mixor' BIC(object, ...)## S3 method for class 'mixor' BIC(object, ...)
object |
a |
... |
other arguments. |
BIC of the fitted mixor model.
Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons
See Also as mixor, summary.mixor
library("mixor") data("schizophrenia") ### Random intercept SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, link="probit") summary(SCHIZO1.fit) BIC(SCHIZO1.fit)library("mixor") data("schizophrenia") ### Random intercept SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, link="probit") summary(SCHIZO1.fit) BIC(SCHIZO1.fit)
coef.mixor is a generic function which extracts the model coefficients from a fitted model object fit using mixor
## S3 method for class 'mixor' coef(object, ...)## S3 method for class 'mixor' coef(object, ...)
object |
a |
... |
other arguments. |
Coefficients extracted from the model object.
Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons
See Also as mixor, summary.mixor
library("mixor") data("schizophrenia") ### Random intercept model SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, link="probit") coef(SCHIZO1.fit)library("mixor") data("schizophrenia") ### Random intercept model SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, link="probit") coef(SCHIZO1.fit)
Monozygotic and dizygotic twins trouble concentrating data
data(concen)data(concen)
A data frame with 16 observations on the following 6 variables.
IDa numeric vector indicating the unique twin pair ID
TConcenan indicator variable representing trouble concentrating (0 = absent, 1 = present)
inta numeric vector of ones; used in the stand-alone MIXOR program to represent the intercept
Mzan indicator variable representing MZ twins (1 = MZ, 0 = DZ)
Dzan indicator variable representing DZ twins (1 = DZ, 0 = MZ)
freqa numeric vector representing the frequency of the pattern
Ramakrishnan V. et al (1992) Elementary methods for the analysis of dichotomous outcomes in unselected samples of twins Genetic Epidemiology 9, 273-287.
library("mixor") data("concen") # sort the data by twin pair ID concen<-concen[order(concen$ID),] # common ICC probit model Common.ICC<-mixor(TConcen~Mz, data=concen, id=ID, weights=freq, link="probit", nAGQ=10, random.effect.mean=FALSE) summary(Common.ICC) # Varying ICC probit model Varying.ICC<-mixor(TConcen~Mz+Dz, data=concen, id=ID, weights=freq, which.random.slope=1:2, exclude.fixed.effect=2, link="probit", nAGQ=20, random.effect.mean=FALSE, UNID=1) summary(Varying.ICC)library("mixor") data("concen") # sort the data by twin pair ID concen<-concen[order(concen$ID),] # common ICC probit model Common.ICC<-mixor(TConcen~Mz, data=concen, id=ID, weights=freq, link="probit", nAGQ=10, random.effect.mean=FALSE) summary(Common.ICC) # Varying ICC probit model Varying.ICC<-mixor(TConcen~Mz+Dz, data=concen, id=ID, weights=freq, which.random.slope=1:2, exclude.fixed.effect=2, link="probit", nAGQ=20, random.effect.mean=FALSE, UNID=1) summary(Varying.ICC)
This function is used to specify and estimate contrasts of interest for a mixor object.
Contrasts(fit, contrast.matrix, digits=max(3, getOption("digits") - 2), signif.stars=TRUE, dig.tst = max(1, min(5, digits - 1)))Contrasts(fit, contrast.matrix, digits=max(3, getOption("digits") - 2), signif.stars=TRUE, dig.tst = max(1, min(5, digits - 1)))
fit |
A |
contrast.matrix |
A matrix of contrasts of interest. Each column in the contrast matrix should be of the same length as the |
digits |
minimum number of significant digits to be used for most numbers. |
signif.stars |
logical; if TRUE, P-values are additionally encoded visually as "significance stars" in order to help scanning of long coefficient tables. |
dig.tst |
minimum number of significant digits for the test statistics. |
A list containing the following components:
contrast.matrix |
a matrix specifying the contrasts of interest. |
Contrasts |
a matrix containing the estimates, SEs, Z-values, and p-values for the contrasts of interest. |
Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons
See Also as mixor, coef.mixor, vcov.mixor
library("mixor") data("SmokingPrevention") # data frame must be sorted by id variable SmokingPrevention<-SmokingPrevention[order(SmokingPrevention$class),] 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)library("mixor") data("SmokingPrevention") # data frame must be sorted by id variable SmokingPrevention<-SmokingPrevention[order(SmokingPrevention$class),] 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)
Returns the deviance of a fitted mixor model.
## S3 method for class 'mixor' deviance(object, ...)## S3 method for class 'mixor' deviance(object, ...)
object |
a |
... |
other arguments. |
Deviance of the fitted mixor model.
Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons
See Also as mixor, summary.mixor, logLik.mixor
library("mixor") data("schizophrenia") ### Random intercept SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, link="probit") summary(SCHIZO1.fit) deviance(SCHIZO1.fit)library("mixor") data("schizophrenia") ### Random intercept SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, link="probit") summary(SCHIZO1.fit) deviance(SCHIZO1.fit)
Arithmetic reasoning items from the Armed Servces Vocational Aptitude Battery
data(irt.data)data(irt.data)
A data frame with 128 observations on the following 13 variables.
IDa numeric vector indicating unique pattern identifier
Respitem response (0 = incorrect; 1 = correct)
inta numeric vector of ones; used in MIXOR stand-alone program to represent the intercept
Item1Arithmetic reasoning item 1 (0 = no; 1 = yes)
Item2Arithmetic reasoning item 2 (0 = no; 1 = yes)
Item3Arithmetic reasoning item 3 (0 = no; 1 = yes)
Item4Arithmetic reasoning item 4 (0 = no; 1 = yes)
SexFan indicator variable representing gender (0 = female; 1 = male)
SexItem1Gender by Item1 interaction
SexItem2Gender by Item2 interaction
SexItem3Gender by Item3 interaction
SexItem4Gender by Item4 interaction
freqfrequency weight of pattern
Mislevy R.J. (1985) Estimation of latent group effects Journal of the American Statistical Association 80, 993-997.
library("mixor") data("irt.data") ## Sort data by ID irt.data<-irt.data[order(irt.data$ID),] # 2 parameter logistic IRT model Fitted.irt<-mixor(Resp~Item1+Item2+Item3+Item4-1, data=irt.data, id=ID, weights=freq, which.random.slope=1:4, link="logit", nAGQ=10, random.effect.mean=FALSE, UNID=1, vcov=FALSE) summary(Fitted.irt) # 2 parameter logistic IRT model with Sex interations on item parameters Fitted.irt2<-mixor(Resp~Item1+Item2+Item3+Item4+SexItem1+SexItem2+SexItem3+SexItem4-1, data=irt.data, id=ID, weights=freq, which.random.slope=1:8, link="logit", nAGQ=10, random.effect.mean=FALSE, UNID=1, vcov=FALSE) summary(Fitted.irt2)library("mixor") data("irt.data") ## Sort data by ID irt.data<-irt.data[order(irt.data$ID),] # 2 parameter logistic IRT model Fitted.irt<-mixor(Resp~Item1+Item2+Item3+Item4-1, data=irt.data, id=ID, weights=freq, which.random.slope=1:4, link="logit", nAGQ=10, random.effect.mean=FALSE, UNID=1, vcov=FALSE) summary(Fitted.irt) # 2 parameter logistic IRT model with Sex interations on item parameters Fitted.irt2<-mixor(Resp~Item1+Item2+Item3+Item4+SexItem1+SexItem2+SexItem3+SexItem4-1, data=irt.data, id=ID, weights=freq, which.random.slope=1:8, link="logit", nAGQ=10, random.effect.mean=FALSE, UNID=1, vcov=FALSE) summary(Fitted.irt2)
Returns the log-likelihood of a fitted mixor model.
## S3 method for class 'mixor' logLik(object, ...)## S3 method for class 'mixor' logLik(object, ...)
object |
a |
... |
other arguments. |
Log-likelihood of the fitted mixor model.
Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons
See Also as mixor, summary.mixor, deviance.mixor
library("mixor") data("schizophrenia") ### Random intercept SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, link="probit") summary(SCHIZO1.fit) logLik(SCHIZO1.fit)library("mixor") data("schizophrenia") ### Random intercept SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, link="probit") summary(SCHIZO1.fit) logLik(SCHIZO1.fit)
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)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)
formula |
an object of class " |
data |
an optional |
id |
name of clustering variable in the |
which.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. |
exclude.fixed.effect |
the RHS of the model includes both fixed and random effects. Variables are identified as random effects using |
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 |
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 |
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 |
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 |
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 |
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)
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 |
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 |
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 |
which.random.slope |
the number of the predictor variable on the RHS of the model formula having a random slope. When |
ICEN |
if 1 indicates right-censoring was considered in the model fit. |
link |
Link function, either |
terms |
terms from the fitted model. |
This function is essentially a wrapper for the MIXOR stand-alone program by Hedeker and Gibbons with added generic methods in R to enhance functionality. Note that the Fortran wrapper requires missing values to be denoted by -9 rather than NA.
Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons
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
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)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)
These functions are provided for compatibility with older versions
of mixor only, and will be defunct at the next release.
The following functions are deprecated and will be made defunct; use the replacement indicated below:
mixord: mixor
Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons, Maintainer: Kellie J. Archer <[email protected]>
The mixord function has been deprecated. Please use the mixor function for fitting longitudinal/clustered ordinal response models
Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons
See Also as mixor, summary.mixor
Each subject provided ordinal responses on three items concerning their opinion on early teens (age 14-16) having sex before marriage (Item1), a man and a woman having sex before marriage (Item2), and a married person having sex with someone other than their spouse (Item3). Data are provided as frequencies by response pattern.
data(norcag)data(norcag)
A data frame with 105 observations on the following 6 variables.
IDa numeric vector indicating unique patient identifier
SexItemsordinal item response coded as 1 = always wrong; 2 = almost always wrong; 3 = wrong only sometimes; 4 = not wrong
inta numeric vector of ones; used in the stand-alone MIXOR program to indicate the intercept
Item2vs1attitude towards premarital vs teenage sex
Item3vs1attitude towards extramarital vs teenage sex
freqfrequency weight of the pattern
Agresti A. and Lang J.B. (1993) A proportional odds model with subject-specific effects for repeated ordered categorical responses, Biometrika 80, 527-534.
Hedeker D. and Mermelstein R.J. (1998) A multilevel thresholds of change model for analysis of stages of change data, Multivariate Behavioral Research 33, 427-455.
library("mixor") data("norcag") # random intercepts model assuming proportional odds for differences in item responses Fitted.norcag<-mixor(SexItems~Item2vs1+Item3vs1, data=norcag, id=ID, weights=freq, link="logit", nAGQ=20) summary(Fitted.norcag) # random intercepts model assuming non-proportional odds for differences in item responses Fitted.norcag.np<-mixor(SexItems~Item2vs1+Item3vs1, data=norcag, id=ID, weights=freq, link="logit", nAGQ=10, KG=2) summary(Fitted.norcag.np) # SCALING model Fitted.norcag.scale<-mixor(SexItems~Item2vs1+Item3vs1, data=norcag, id=ID, weights=freq, link="logit", nAGQ=10, KS=2) summary(Fitted.norcag.scale)library("mixor") data("norcag") # random intercepts model assuming proportional odds for differences in item responses Fitted.norcag<-mixor(SexItems~Item2vs1+Item3vs1, data=norcag, id=ID, weights=freq, link="logit", nAGQ=20) summary(Fitted.norcag) # random intercepts model assuming non-proportional odds for differences in item responses Fitted.norcag.np<-mixor(SexItems~Item2vs1+Item3vs1, data=norcag, id=ID, weights=freq, link="logit", nAGQ=10, KG=2) summary(Fitted.norcag.np) # SCALING model Fitted.norcag.scale<-mixor(SexItems~Item2vs1+Item3vs1, data=norcag, id=ID, weights=freq, link="logit", nAGQ=10, KS=2) summary(Fitted.norcag.scale)
Plot of empirical Bayes estimates of random effects from a fitted mixor model object.
## S3 method for class 'mixor' plot(x, ...)## S3 method for class 'mixor' plot(x, ...)
x |
a |
... |
other arguments. |
For each random effect, a histogram and normal quantile-quantile plot of empirical Bayes estimates.
Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons
See Also as mixor, summary.mixor
library("mixor") data("schizophrenia") ### Random intercept SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, link="probit") plot(SCHIZO1.fit)library("mixor") data("schizophrenia") ### Random intercept SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, link="probit") plot(SCHIZO1.fit)
predict method for class mixor.
## S3 method for class 'mixor' predict(object, newdata = NULL, na.action = na.fail, ...)## S3 method for class 'mixor' predict(object, newdata = NULL, na.action = na.fail, ...)
object |
an object of class |
newdata |
an optional data frame to be used for obtaining predictions when the random effects are zero. When |
na.action |
a function that indicates what should happen when |
... |
other arguments. |
This function returns fitted probabilities and the predicted class from a fitted mixor object. When the newdata parameter is specified, the random effects are taken to be zero and predictions are returned. Otherwise conditional predictions, which includes both fixed and random effects terms, for the observed data are returned.
predicted |
class specific probabilities from the fitted model. |
class |
predicted class, that having the largest fitted probability, from the fitted model. |
Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons
See Also mixor, print.mixor
library("mixor") data("schizophrenia") ### Random intercept SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, link="probit") pihat<-predict(SCHIZO1.fit) table(pihat$class, schizophrenia$imps79o) head(pihat$predicted)library("mixor") data("schizophrenia") ### Random intercept SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, link="probit") pihat<-predict(SCHIZO1.fit) table(pihat$class, schizophrenia$imps79o) head(pihat$predicted)
print method for class mixor.
## S3 method for class 'mixor' print(x, digits = max(3L, getOption("digits") - 3L), ...)## S3 method for class 'mixor' print(x, digits = max(3L, getOption("digits") - 3L), ...)
x |
an object of class |
digits |
the number of significant digits to use when printing. |
... |
further arguments passed to or from other methods. |
The function print.mixor prints the model call and coefficients from the mixor object.
Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons
See Also as mixor, summary.mixor, coef.mixor
library("mixor") data("schizophrenia") ### Random intercept SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, link="probit") print(SCHIZO1.fit) ### Random intercept and slope SCHIZO2.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, which.random.slope=2, link="probit") print(SCHIZO2.fit)library("mixor") data("schizophrenia") ### Random intercept SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, link="probit") print(SCHIZO1.fit) ### Random intercept and slope SCHIZO2.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, which.random.slope=2, link="probit") print(SCHIZO2.fit)
In the NIMH Schizophrenia Collaborative Study, patients were randomized to receive one of four medications, either placebo or one of three different anti-psychotic drugs. The protocol indicated subjects were to then be evaluated at weeks 0, 1, 3, 6 to assess severity of illness; additionally some measurements were made at weeks 2, 4, and 5.
data(schizophrenia)data(schizophrenia)
A data frame with 1603 observations on the following 9 variables.
ida numeric vector indicating the unique patient identifier
imps79a numeric vector from item 79 on the Inpatient Multidimensional Psychiatric Scale indicating severity of illness. The scores were applied to be interpreted as follows: 1 = normal, not ill at all; 2 = borderline mentally ill; 3 = mildly ill; 4 = moderately ill; 5 = markedly ill; 6 = severly ill; 7 = among the most extremely ill
imps79ba binary version of imps79
imps79oan ordinally scaled version of imps79
inta numeric vector of ones; used in stand-alone package to indicate intercept
TxDruga numeric vector indicating treatment with drug (1) or placebo (0)
Weeka numeric vector indicating time, in weeks
SqrtWeekthe square root of the Week variable
TxSWeeka variable representing the TxDrug x Week interaction
From https://voices.uchicago.edu/hedeker/files/2026/06/SCHIZX1.DAT_.txt
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.
library("mixor") data("schizophrenia") ### Random intercept SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, link="probit") summary(SCHIZO1.fit) ### Random intercept and slope SCHIZO2.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, which.random.slope=2, link="probit") summary(SCHIZO2.fit) # random intercept and trend with independent random effects; using logit link SCHIZO3.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, which.random.slope=2, indep.re=TRUE, link="logit") summary(SCHIZO3.fit)library("mixor") data("schizophrenia") ### Random intercept SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, link="probit") summary(SCHIZO1.fit) ### Random intercept and slope SCHIZO2.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, which.random.slope=2, link="probit") summary(SCHIZO2.fit) # random intercept and trend with independent random effects; using logit link SCHIZO3.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, which.random.slope=2, indep.re=TRUE, link="logit") summary(SCHIZO3.fit)
From the Television School and Family Smoking Prevention and Cessation Project, a study designed to increase knowledge of the effects of tobacco use in school-age children.
data(SmokeOnset)data(SmokeOnset)
A data frame with 1556 observations on the following 10 variables.
schoola numeric vector identifying the unique school in the Los Angeles area
classa numeric vector identifying classroom
studenta numeric vector identifying student
smkonseta numeric vector indicating time to smoking or right-censoring (post-intervention=1, 1 year follow-up=2, and 2 year follow-up=3). For these data right-censoring means that the observation was observed at the indicated timepoint (and had not smoked at that timepoint or at earlier timepoints), but was not observed at subsequent timepoints or thereafter.
eventa numeric vector indicating whether the student smoked (1) or did not (0)
inta numeric vector of ones; used in stand-alone MIXOR program to represent the intercept
SexMalea numeric vector indicating gender of the student (0=Female, 1=Male)
cca numeric vector indicating whether the school was randomized to a social-resistance classroom curriculum (1=Yes, 0=No)
tva numeric vector indicating whether the school was randomized to a media (television) intervention (1=Yes, 0=No)
cctva numeric vector indicating whether the school was randomized to CC combined with TV
Flay B.R., Brannon B.R., Johnson C.A. et al. (1989) The television, school and family smoking cessation and prevention project: I. Theoretical basis and program development, Preventive Medicine 17, 585-607.
Hedeker D., Siddiqui O. and Hu F.B. Random-effects regression analysis of correlated grouped-time survival data, Statistical Methods in Medical Research 9,161-179.
Hedeker D and Gibbons R.D. (2006) Longitudinal Data Analysis, Wiley, Hoboken, New Jesery.
library("mixor") data("SmokeOnset") require("survival") ### Grouped survival time example ### students in classrooms analysis Surv.mixor<-mixor(Surv(smkonset,event)~SexMale+cc+tv, data=SmokeOnset, id=class, link="cloglog", nAGQ=20, IADD=1) Surv.mixor vcov(Surv.mixor) ### students in schools analysis School.mixor<-mixor(Surv(smkonset,event)~SexMale+cc+tv, data=SmokeOnset, id=school, link="cloglog", nAGQ=20, IADD=1) School.mixor vcov(School.mixor) ### students in classrooms analysis with varying Sex effect across time intervals students.mixor<-mixor(Surv(smkonset,event)~SexMale+cc+tv, data=SmokeOnset, id=class, link="cloglog", KG=1, nAGQ=20, IADD=1) students.mixorlibrary("mixor") data("SmokeOnset") require("survival") ### Grouped survival time example ### students in classrooms analysis Surv.mixor<-mixor(Surv(smkonset,event)~SexMale+cc+tv, data=SmokeOnset, id=class, link="cloglog", nAGQ=20, IADD=1) Surv.mixor vcov(Surv.mixor) ### students in schools analysis School.mixor<-mixor(Surv(smkonset,event)~SexMale+cc+tv, data=SmokeOnset, id=school, link="cloglog", nAGQ=20, IADD=1) School.mixor vcov(School.mixor) ### students in classrooms analysis with varying Sex effect across time intervals students.mixor<-mixor(Surv(smkonset,event)~SexMale+cc+tv, data=SmokeOnset, id=class, link="cloglog", KG=1, nAGQ=20, IADD=1) students.mixor
From the Television School and Family Smoking Prevention and Cessation Project, a study designed to increase knowledge of the effects of tobacco use in school-age children.
data(SmokingPrevention)data(SmokingPrevention)
A data frame with 1600 observations on the following 9 variables.
schoola numeric vector identifying the Los Angeles school
classa numeric vector identifying classroom
thksorda numeric vector reflecting quartiles of the post-intervention tobacco and health knowledge scale scor
thksbina binary version of the post-intervention tobacco and health knowledge scale score
inta numeric vector of ones; used in the stand-alone MIXOR program to represent the intercept
thksprethe pre-intervention tobacco and health knowledge scale score
cca numeric vector indicating whether the school was randomized to a social-resistance classroom curriculum (1=Yes, 0=No
tva numeric vector indicating whether the school was randomized to a media (television) intervention (1=Yes, 0=No)
cctva numeric vector indicating whether the school was randomized to CC combined with TV
Flay B.R., Brannon B.R., Johnson C.A. et al. (1988) The television, school and family smoking cessation and prevention project: I. Theoretical basis and program development, Preventive Medicine 17, 585-607.
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.
library("mixor") data("SmokingPrevention") # sort dataset by id; note for these data sorting by class will also sort by school 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; not run #Fitted.students<-mixor(thksord~thkspre+cc+tv+cctv, data=SmokingPrevention, # id=class, link="logit") #summary(Fitted.students) #vcov(Fitted.students)library("mixor") data("SmokingPrevention") # sort dataset by id; note for these data sorting by class will also sort by school 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; not run #Fitted.students<-mixor(thksord~thkspre+cc+tv+cctv, data=SmokingPrevention, # id=class, link="logit") #summary(Fitted.students) #vcov(Fitted.students)
summary method for class mixor.
## S3 method for class 'mixor' summary(object, digits=max(3, getOption("digits") - 2), signif.stars=TRUE, dig.tst = max(1, min(5, digits - 1)), ...)## S3 method for class 'mixor' summary(object, digits=max(3, getOption("digits") - 2), signif.stars=TRUE, dig.tst = max(1, min(5, digits - 1)), ...)
object |
an object of class |
digits |
minimum number of significant digits to be used for most numbers. |
signif.stars |
logical; if TRUE, P-values are additionally encoded visually as "significance stars" in order to help scanning of long coefficient tables. |
dig.tst |
minimum number of significant digits for the test statistics. |
... |
other arguments. |
Prints the following items extracted from the fitted mixor object:
the call to mixor (model formula), mode Deviance, Log-likelihood, RIDGEMAX, AIC, SBC, and model paramter estimates along with their SE, Z, and p-value.
Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons
See Also mixor, print.mixor, coef.mixor
library("mixor") data("schizophrenia") ### Random intercept SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, link="probit") summary(SCHIZO1.fit)library("mixor") data("schizophrenia") ### Random intercept SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, link="probit") summary(SCHIZO1.fit)
Returns the variance-covariance matrix of a fitted mixor model object.
## S3 method for class 'mixor' vcov(object, ...)## S3 method for class 'mixor' vcov(object, ...)
object |
a |
... |
other arguments. |
A matrix of the estimated covariances between the parameter estimates in the model.
Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons
See Also as mixor, summary.mixor
library("mixor") data("schizophrenia") ### Random intercept SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, link="probit") summary(SCHIZO1.fit) vcov(SCHIZO1.fit)library("mixor") data("schizophrenia") ### Random intercept SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, id=id, link="probit") summary(SCHIZO1.fit) vcov(SCHIZO1.fit)