Description Usage Arguments Details Value Note Author(s) References See Also Examples
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.
1 2 3 4 5 | 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 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)
|
Loading required package: survival
Call:
mixor(formula = thksord ~ thkspre + cc + tv + cctv, data = SmokingPrevention,
id = school, link = "logit")
Deviance = 4239.486
Log-likelihood = -2119.743
RIDGEMAX = 0.2
AIC = -2127.743
SBC = -2133.072
Estimate Std. Error z value P(>|z|)
(Intercept) 0.088180 0.313111 0.2816 0.77823
thkspre 0.403280 0.042928 9.3944 < 2e-16 ***
cc 0.924101 0.371345 2.4885 0.01283 *
tv 0.275213 0.315155 0.8733 0.38252
cctv -0.466194 0.406211 -1.1477 0.25111
Random.(Intercept) 0.073498 0.049480 1.4854 0.13743
Threshold2 1.241768 0.088310 14.0614 < 2e-16 ***
Threshold3 2.420359 0.083617 28.9456 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Intercept) thkspre cc tv
(Intercept) 0.098038380 -0.0016292741 -0.0927395980 -0.085558825
thkspre -0.001629274 0.0018427733 -0.0004062879 -0.003222260
cc -0.092739598 -0.0004062879 0.1378968669 0.086972881
tv -0.085558825 -0.0032222604 0.0869728815 0.099322570
cctv 0.091733417 0.0015967494 -0.1384613619 -0.099993295
Random.(Intercept) 0.001493140 0.0009901739 -0.0033952610 -0.004351205
Threshold2 0.012913169 0.0010487855 -0.0124376451 -0.011246805
Threshold3 0.009452837 0.0016778290 -0.0087083931 -0.010787624
cctv Random.(Intercept) Threshold2 Threshold3
(Intercept) 0.091733417 0.0014931404 0.012913169 0.009452837
thkspre 0.001596749 0.0009901739 0.001048786 0.001677829
cc -0.138461362 -0.0033952610 -0.012437645 -0.008708393
tv -0.099993295 -0.0043512047 -0.011246805 -0.010787624
cctv 0.165007083 0.0045724987 0.012871837 0.009753890
Random.(Intercept) 0.004572499 0.0024482246 0.000995455 0.001304427
Threshold2 0.012871837 0.0009954550 0.007798735 0.005784051
Threshold3 0.009753890 0.0013044269 0.005784051 0.006991873
Call:
mixor(formula = thksord ~ thkspre + cc + tv + cctv, data = SmokingPrevention,
id = class, link = "logit")
Deviance = 4230.766
Log-likelihood = -2115.383
RIDGEMAX = 0
AIC = -2123.383
SBC = -2135.004
Estimate Std. Error z value P(>|z|)
(Intercept) 0.075750 0.153514 0.4934 0.621701
thkspre 0.414797 0.040822 10.1612 < 2.2e-16 ***
cc 0.861324 0.187239 4.6001 4.222e-06 ***
tv 0.205859 0.168025 1.2252 0.220510
cctv -0.301123 0.251755 -1.1961 0.231660
Random.(Intercept) 0.188630 0.066243 2.8476 0.004406 **
Threshold2 1.273406 0.062949 20.2293 < 2.2e-16 ***
Threshold3 2.478912 0.080216 30.9029 < 2.2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Intercept) thkspre cc tv
0.07575035 0.41479744 0.86132413 0.20585925
cctv Random.(Intercept) Threshold2 Threshold3
-0.30112255 0.18862954 1.27340629 2.47891177
(Intercept) thkspre cc tv
(Intercept) 2.356667e-02 -0.0033425314 -0.016115374 -1.554730e-02
thkspre -3.342531e-03 0.0016664078 0.000215435 -1.005232e-04
cc -1.611537e-02 0.0002154350 0.035058258 1.558126e-02
tv -1.554730e-02 -0.0001005232 0.015581257 2.823231e-02
cctv 1.425335e-02 0.0009160829 -0.033842031 -2.793812e-02
Random.(Intercept) -8.011787e-05 0.0002697499 0.001749551 -1.948124e-03
Threshold2 -1.793964e-04 0.0008120776 0.001349416 8.913283e-04
Threshold3 2.950014e-04 0.0010213593 0.000698184 4.116407e-05
cctv Random.(Intercept) Threshold2 Threshold3
(Intercept) 0.0142533511 -8.011787e-05 -0.0001793964 2.950014e-04
thkspre 0.0009160829 2.697499e-04 0.0008120776 1.021359e-03
cc -0.0338420310 1.749551e-03 0.0013494164 6.981840e-04
tv -0.0279381163 -1.948124e-03 0.0008913283 4.116407e-05
cctv 0.0633804946 1.241640e-03 -0.0003811800 1.260757e-03
Random.(Intercept) 0.0012416404 4.388076e-03 0.0006060819 1.702859e-03
Threshold2 -0.0003811800 6.060819e-04 0.0039625142 3.838976e-03
Threshold3 0.0012607567 1.702859e-03 0.0038389758 6.434629e-03
1 2 3
(Intercept) -1 -1 -1
thkspre 0 0 0
cc 0 0 0
tv 0 0 0
cctv 0 0 0
Random.(Intercept) 0 0 0
Threshold2 0 1 0
Threshold3 0 0 1
Estimate Std. Error z value P(>|z|)
1 -0.07575 0.15351 -0.4934 0.6217
2 1.19766 0.16700 7.1717 7.405e-13 ***
3 2.40316 0.17150 14.0128 < 2.2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.