Package 'mixor'

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

Help Index


Mixed-Effects Ordinal Regression Analysis

Description

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.

Details

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.

Author(s)

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]>

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.

See Also

See also mixor, and examples in norcag, irt.data, concen, SmokeOnset, schizophrenia

Examples

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)

Return AIC for a Fitted Mixor Model

Description

Returns the AIC of a fitted mixor model.

Usage

## S3 method for class 'mixor'
AIC(object, ...)

Arguments

object

a mixor object.

...

other arguments.

Value

AIC of the fitted mixor model.

Author(s)

Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons

See Also

See Also as mixor, summary.mixor

Examples

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)

Return BIC for a Fitted Mixor Model

Description

Returns the BIC of a fitted mixor model.

Usage

## S3 method for class 'mixor'
BIC(object, ...)

Arguments

object

a mixor object.

...

other arguments.

Value

BIC of the fitted mixor model.

Author(s)

Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons

See Also

See Also as mixor, summary.mixor

Examples

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)

Extract Model Coefficients

Description

coef.mixor is a generic function which extracts the model coefficients from a fitted model object fit using mixor

Usage

## S3 method for class 'mixor'
coef(object, ...)

Arguments

object

a mixor object.

...

other arguments.

Value

Coefficients extracted from the model object.

Author(s)

Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons

See Also

See Also as mixor, summary.mixor

Examples

library("mixor")
data("schizophrenia")
### Random intercept model
SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, 
   id=id, link="probit")
coef(SCHIZO1.fit)

Twins Trouble Concentrating Data

Description

Monozygotic and dizygotic twins trouble concentrating data

Usage

data(concen)

Format

A data frame with 16 observations on the following 6 variables.

ID

a numeric vector indicating the unique twin pair ID

TConcen

an indicator variable representing trouble concentrating (0 = absent, 1 = present)

int

a numeric vector of ones; used in the stand-alone MIXOR program to represent the intercept

Mz

an indicator variable representing MZ twins (1 = MZ, 0 = DZ)

Dz

an indicator variable representing DZ twins (1 = DZ, 0 = MZ)

freq

a numeric vector representing the frequency of the pattern

References

Ramakrishnan V. et al (1992) Elementary methods for the analysis of dichotomous outcomes in unselected samples of twins Genetic Epidemiology 9, 273-287.

Examples

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)

Estimate Contrasts for Mixor Object

Description

This function is used to specify and estimate contrasts of interest for a mixor object.

Usage

Contrasts(fit, contrast.matrix, digits=max(3, getOption("digits") - 2), 
   signif.stars=TRUE, dig.tst = max(1, min(5, digits - 1)))

Arguments

fit

A mixor object.

contrast.matrix

A matrix of contrasts of interest. Each column in the contrast matrix should be of the same length as the coef vector of the fitted mixor object.

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.

Value

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.

Author(s)

Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons

See Also

See Also as mixor, coef.mixor, vcov.mixor

Examples

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)

Return the deviance for a Fitted Mixor Model

Description

Returns the deviance of a fitted mixor model.

Usage

## S3 method for class 'mixor'
deviance(object, ...)

Arguments

object

a mixor object.

...

other arguments.

Value

Deviance of the fitted mixor model.

Author(s)

Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons

See Also

See Also as mixor, summary.mixor, logLik.mixor

Examples

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)

Armed Servces Vocational Aptitude Battery

Description

Arithmetic reasoning items from the Armed Servces Vocational Aptitude Battery

Usage

data(irt.data)

Format

A data frame with 128 observations on the following 13 variables.

ID

a numeric vector indicating unique pattern identifier

Resp

item response (0 = incorrect; 1 = correct)

int

a numeric vector of ones; used in MIXOR stand-alone program to represent the intercept

Item1

Arithmetic reasoning item 1 (0 = no; 1 = yes)

Item2

Arithmetic reasoning item 2 (0 = no; 1 = yes)

Item3

Arithmetic reasoning item 3 (0 = no; 1 = yes)

Item4

Arithmetic reasoning item 4 (0 = no; 1 = yes)

SexF

an indicator variable representing gender (0 = female; 1 = male)

SexItem1

Gender by Item1 interaction

SexItem2

Gender by Item2 interaction

SexItem3

Gender by Item3 interaction

SexItem4

Gender by Item4 interaction

freq

frequency weight of pattern

References

Mislevy R.J. (1985) Estimation of latent group effects Journal of the American Statistical Association 80, 993-997.

Examples

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)

Return the log-likelihood for a Fitted Mixor Model

Description

Returns the log-likelihood of a fitted mixor model.

Usage

## S3 method for class 'mixor'
logLik(object, ...)

Arguments

object

a mixor object.

...

other arguments.

Value

Log-likelihood of the fitted mixor model.

Author(s)

Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons

See Also

See Also as mixor, summary.mixor, deviance.mixor

Examples

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)

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.

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)

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.

Note

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.

Author(s)

Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons

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

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)

Deprecated Functions in Package mixor

Description

These functions are provided for compatibility with older versions of mixor only, and will be defunct at the next release.

Details

The following functions are deprecated and will be made defunct; use the replacement indicated below:

Author(s)

Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons, Maintainer: Kellie J. Archer <[email protected]>


Old Function Name Replaced with mixor

Description

The mixord function has been deprecated. Please use the mixor function for fitting longitudinal/clustered ordinal response models

Author(s)

Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons

See Also

See Also as mixor, summary.mixor


Attitudes Towards Sex Data from the 1989 General Social Survey

Description

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.

Usage

data(norcag)

Format

A data frame with 105 observations on the following 6 variables.

ID

a numeric vector indicating unique patient identifier

SexItems

ordinal item response coded as 1 = always wrong; 2 = almost always wrong; 3 = wrong only sometimes; 4 = not wrong

int

a numeric vector of ones; used in the stand-alone MIXOR program to indicate the intercept

Item2vs1

attitude towards premarital vs teenage sex

Item3vs1

attitude towards extramarital vs teenage sex

freq

frequency weight of the pattern

Source

Agresti A. and Lang J.B. (1993) A proportional odds model with subject-specific effects for repeated ordered categorical responses, Biometrika 80, 527-534.

References

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.

Examples

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 empirical Bayes estimates of random effects for a Mixor Model Object

Description

Plot of empirical Bayes estimates of random effects from a fitted mixor model object.

Usage

## S3 method for class 'mixor'
plot(x, ...)

Arguments

x

a mixor object.

...

other arguments.

Value

For each random effect, a histogram and normal quantile-quantile plot of empirical Bayes estimates.

Author(s)

Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons

See Also

See Also as mixor, summary.mixor

Examples

library("mixor")
data("schizophrenia")
### Random intercept
SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, 
     id=id, link="probit")
plot(SCHIZO1.fit)

Predict Outcome From Mixor Fitted Model

Description

predict method for class mixor.

Usage

## S3 method for class 'mixor'
predict(object, newdata = NULL, na.action = na.fail, ...)

Arguments

object

an object of class mixor.

newdata

an optional data frame to be used for obtaining predictions when the random effects are zero. When newdata is not supplied, the random effects estimates are used in obtaining model predictions. All variables used in the mixor model, the fixed and the random effects models, as well as the grouping factors, must be present in the data frame.

na.action

a function that indicates what should happen when newdata contains NAS. The default action (na.fail) causes the function to print an error message and terminate if there are any incomplete observations.

...

other arguments.

Details

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.

Value

predicted

class specific probabilities from the fitted model.

class

predicted class, that having the largest fitted probability, from the fitted model.

Author(s)

Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons

See Also

See Also mixor, print.mixor

Examples

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)

Printing Mixor Model Fits

Description

print method for class mixor.

Usage

## S3 method for class 'mixor'
print(x, digits = max(3L, getOption("digits") - 3L), ...)

Arguments

x

an object of class mixor.

digits

the number of significant digits to use when printing.

...

further arguments passed to or from other methods.

Value

The function print.mixor prints the model call and coefficients from the mixor object.

Author(s)

Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons

See Also

See Also as mixor, summary.mixor, coef.mixor

Examples

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)

National Institute of Mental Health Schizophrenia Collaborative Study

Description

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.

Usage

data(schizophrenia)

Format

A data frame with 1603 observations on the following 9 variables.

id

a numeric vector indicating the unique patient identifier

imps79

a 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

imps79b

a binary version of imps79

imps79o

an ordinally scaled version of imps79

int

a numeric vector of ones; used in stand-alone package to indicate intercept

TxDrug

a numeric vector indicating treatment with drug (1) or placebo (0)

Week

a numeric vector indicating time, in weeks

SqrtWeek

the square root of the Week variable

TxSWeek

a variable representing the TxDrug x Week interaction

Source

From https://voices.uchicago.edu/hedeker/files/2026/06/SCHIZX1.DAT_.txt

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.

Examples

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)

Smoking Onset Data

Description

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.

Usage

data(SmokeOnset)

Format

A data frame with 1556 observations on the following 10 variables.

school

a numeric vector identifying the unique school in the Los Angeles area

class

a numeric vector identifying classroom

student

a numeric vector identifying student

smkonset

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

event

a numeric vector indicating whether the student smoked (1) or did not (0)

int

a numeric vector of ones; used in stand-alone MIXOR program to represent the intercept

SexMale

a numeric vector indicating gender of the student (0=Female, 1=Male)

cc

a numeric vector indicating whether the school was randomized to a social-resistance classroom curriculum (1=Yes, 0=No)

tv

a numeric vector indicating whether the school was randomized to a media (television) intervention (1=Yes, 0=No)

cctv

a numeric vector indicating whether the school was randomized to CC combined with TV

References

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.

Examples

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

Television School and Family Smoking Prevention and Cessation Project Data

Description

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.

Usage

data(SmokingPrevention)

Format

A data frame with 1600 observations on the following 9 variables.

school

a numeric vector identifying the Los Angeles school

class

a numeric vector identifying classroom

thksord

a numeric vector reflecting quartiles of the post-intervention tobacco and health knowledge scale scor

thksbin

a binary version of the post-intervention tobacco and health knowledge scale score

int

a numeric vector of ones; used in the stand-alone MIXOR program to represent the intercept

thkspre

the pre-intervention tobacco and health knowledge scale score

cc

a numeric vector indicating whether the school was randomized to a social-resistance classroom curriculum (1=Yes, 0=No

tv

a numeric vector indicating whether the school was randomized to a media (television) intervention (1=Yes, 0=No)

cctv

a numeric vector indicating whether the school was randomized to CC combined with TV

References

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.

Examples

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)

Summarize Mixor Model Fit

Description

summary method for class mixor.

Usage

## S3 method for class 'mixor'
summary(object, digits=max(3, getOption("digits") - 2), 
    signif.stars=TRUE, dig.tst = max(1, min(5, digits - 1)), ...)

Arguments

object

an object of class mixor.

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.

Value

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.

Author(s)

Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons

See Also

See Also mixor, print.mixor, coef.mixor

Examples

library("mixor")
data("schizophrenia")
### Random intercept
SCHIZO1.fit<-mixor(imps79o ~ TxDrug + SqrtWeek + TxSWeek, data=schizophrenia, 
     id=id, link="probit")
summary(SCHIZO1.fit)

Return Variance-Covariance Matrix for a Mixor Model Object

Description

Returns the variance-covariance matrix of a fitted mixor model object.

Usage

## S3 method for class 'mixor'
vcov(object, ...)

Arguments

object

a mixor object.

...

other arguments.

Value

A matrix of the estimated covariances between the parameter estimates in the model.

Author(s)

Kellie J. Archer, Donald Hedeker, Rachel Nordgren, Robert D. Gibbons

See Also

See Also as mixor, summary.mixor

Examples

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)