Title: | Model Multivariate Ordinal Responses Including Response Styles |
---|---|
Description: | In the case of multivariate ordinal responses, parameter estimates can be severely biased if personal response styles are ignored. This packages provides methods to account for personal response styles and to explain the effects of covariates on the response style, as proposed by Schauberger and Tutz 2021 <doi:10.1177/1471082X20978034>. The method is implemented both for the multivariate cumulative model and the multivariate adjacent categories model. |
Authors: | Gunther Schauberger |
Maintainer: | Gunther Schauberger <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1-3 |
Built: | 2024-11-19 06:51:43 UTC |
Source: | CRAN |
A model for multivariate ordinal responses. The response is modelled using a mixed model approach that is also capable of the inclusion of response style effects of the respondents.
Gunther Schauberger
[email protected]
https://orcid.org/0000-0002-0392-1580
Schauberger, Gunther and Tutz, Gerhard (2021): Multivariate Ordinal Random Effects Models Including Subject and Group Specific Response Style Effects, Statistical Modelling, doi:10.1177/1471082X20978034
multordRS
ctrl.multordRS
plot.MultOrdRS
data(tenseness) ## create a small subset of the data to speed up calculations set.seed(1860) tenseness <- tenseness[sample(1:nrow(tenseness), 300),] ## scale all metric variables to get comparable parameter estimates tenseness$Age <- scale(tenseness$Age) tenseness$Income <- scale(tenseness$Income) ## two formulas, one without and one with explanatory variables (gender and age) f.tense0 <- as.formula(paste("cbind(",paste(names(tenseness)[1:4],collapse=","),") ~ 1")) f.tense1 <- as.formula(paste("cbind(",paste(names(tenseness)[1:4],collapse=","),") ~ Gender + Age")) #### ## Adjacent Categories Models #### ## Multivariate adjacent categories model, without response style, without explanatory variables m.tense0 <- multordRS(f.tense0, data = tenseness, control = ctrl.multordRS(RS = FALSE, cores = 2)) m.tense0 ## Multivariate adjacent categories model, with response style as a random effect, ## without explanatory variables m.tense1 <- multordRS(f.tense0, data = tenseness) m.tense1 ## Multivariate adjacent categories model, with response style as a random effect, ## without explanatory variables for response style BUT for location m.tense2 <- multordRS(f.tense1, data = tenseness, control = ctrl.multordRS(XforRS = FALSE)) m.tense2 ## Multivariate adjacent categories model, with response style as a random effect, with ## explanatory variables for location AND response style m.tense3 <- multordRS(f.tense1, data = tenseness) m.tense3 plot(m.tense3) #### ## Cumulative Models #### ## Multivariate cumulative model, without response style, without explanatory variables m.tense0.cumul <- multordRS(f.tense0, data = tenseness, control = ctrl.multordRS(RS = FALSE), model = "cumulative") m.tense0.cumul ## Multivariate cumulative model, with response style as a random effect, ## without explanatory variables m.tense1.cumul <- multordRS(f.tense0, data = tenseness, model = "cumulative") m.tense1.cumul ## Multivariate cumulative model, with response style as a random effect, ## without explanatory variables for response style BUT for location m.tense2.cumul <- multordRS(f.tense1, data = tenseness, control = ctrl.multordRS(XforRS = FALSE), model = "cumulative") m.tense2.cumul ## Multivariate cumulative model, with response style as a random effect, with ## explanatory variables for location AND response style m.tense3.cumul <- multordRS(f.tense1, data = tenseness, model = "cumulative") m.tense3.cumul plot(m.tense3.cumul) ################################################################ ## Examples from Schauberger and Tutz (2020) ## Data from the German Longitudinal Election Study (GLES) 2017 ################################################################ #### ## Source: German Longitudinal Election Study 2017 ## Rossteutscher et al. 2017, https://doi.org/10.4232/1.12927 #### ## load GLES data data(GLES17) ## scale data GLES17[,7:11] <- scale(GLES17[,7:11]) ## define formula f.GLES <- as.formula(cbind(RefugeeCrisis, ClimateChange, Terrorism, Globalization, Turkey, NuclearEnergy) ~ Age + Gender + Unemployment + EastWest + Abitur) ## fit adjacent categories model without and with response style parameters m.GLES0 <- multordRS(f.GLES, data = GLES17, control = ctrl.multordRS(RS = FALSE, cores = 6)) m.GLES <- multordRS(f.GLES, data = GLES17, control = ctrl.multordRS(cores = 6)) m.GLES0 m.GLES plot(m.GLES, main = "Adjacent categories model") ## fit cumulative model without and with response style parameters (takes pretty long!!!) m.GLES20 <- multordRS(f.GLES, data = GLES17, model="cumul", control = ctrl.multordRS(opt.method = "nlminb", cores = 6, RS = FALSE)) m.GLES2 <- multordRS(f.GLES, data = GLES17, model="cumul", control = ctrl.multordRS(opt.method = "nlminb", cores = 6)) m.GLES20 m.GLES2 plot(m.GLES2, main = "Cumulative model")
data(tenseness) ## create a small subset of the data to speed up calculations set.seed(1860) tenseness <- tenseness[sample(1:nrow(tenseness), 300),] ## scale all metric variables to get comparable parameter estimates tenseness$Age <- scale(tenseness$Age) tenseness$Income <- scale(tenseness$Income) ## two formulas, one without and one with explanatory variables (gender and age) f.tense0 <- as.formula(paste("cbind(",paste(names(tenseness)[1:4],collapse=","),") ~ 1")) f.tense1 <- as.formula(paste("cbind(",paste(names(tenseness)[1:4],collapse=","),") ~ Gender + Age")) #### ## Adjacent Categories Models #### ## Multivariate adjacent categories model, without response style, without explanatory variables m.tense0 <- multordRS(f.tense0, data = tenseness, control = ctrl.multordRS(RS = FALSE, cores = 2)) m.tense0 ## Multivariate adjacent categories model, with response style as a random effect, ## without explanatory variables m.tense1 <- multordRS(f.tense0, data = tenseness) m.tense1 ## Multivariate adjacent categories model, with response style as a random effect, ## without explanatory variables for response style BUT for location m.tense2 <- multordRS(f.tense1, data = tenseness, control = ctrl.multordRS(XforRS = FALSE)) m.tense2 ## Multivariate adjacent categories model, with response style as a random effect, with ## explanatory variables for location AND response style m.tense3 <- multordRS(f.tense1, data = tenseness) m.tense3 plot(m.tense3) #### ## Cumulative Models #### ## Multivariate cumulative model, without response style, without explanatory variables m.tense0.cumul <- multordRS(f.tense0, data = tenseness, control = ctrl.multordRS(RS = FALSE), model = "cumulative") m.tense0.cumul ## Multivariate cumulative model, with response style as a random effect, ## without explanatory variables m.tense1.cumul <- multordRS(f.tense0, data = tenseness, model = "cumulative") m.tense1.cumul ## Multivariate cumulative model, with response style as a random effect, ## without explanatory variables for response style BUT for location m.tense2.cumul <- multordRS(f.tense1, data = tenseness, control = ctrl.multordRS(XforRS = FALSE), model = "cumulative") m.tense2.cumul ## Multivariate cumulative model, with response style as a random effect, with ## explanatory variables for location AND response style m.tense3.cumul <- multordRS(f.tense1, data = tenseness, model = "cumulative") m.tense3.cumul plot(m.tense3.cumul) ################################################################ ## Examples from Schauberger and Tutz (2020) ## Data from the German Longitudinal Election Study (GLES) 2017 ################################################################ #### ## Source: German Longitudinal Election Study 2017 ## Rossteutscher et al. 2017, https://doi.org/10.4232/1.12927 #### ## load GLES data data(GLES17) ## scale data GLES17[,7:11] <- scale(GLES17[,7:11]) ## define formula f.GLES <- as.formula(cbind(RefugeeCrisis, ClimateChange, Terrorism, Globalization, Turkey, NuclearEnergy) ~ Age + Gender + Unemployment + EastWest + Abitur) ## fit adjacent categories model without and with response style parameters m.GLES0 <- multordRS(f.GLES, data = GLES17, control = ctrl.multordRS(RS = FALSE, cores = 6)) m.GLES <- multordRS(f.GLES, data = GLES17, control = ctrl.multordRS(cores = 6)) m.GLES0 m.GLES plot(m.GLES, main = "Adjacent categories model") ## fit cumulative model without and with response style parameters (takes pretty long!!!) m.GLES20 <- multordRS(f.GLES, data = GLES17, model="cumul", control = ctrl.multordRS(opt.method = "nlminb", cores = 6, RS = FALSE)) m.GLES2 <- multordRS(f.GLES, data = GLES17, model="cumul", control = ctrl.multordRS(opt.method = "nlminb", cores = 6)) m.GLES20 m.GLES2 plot(m.GLES2, main = "Cumulative model")
Control function for multordRS, a model for multivariate ordinal responses including response styles
ctrl.multordRS( RS = TRUE, thresholds.acat = c("full", "shift", "minimal"), XforRS = TRUE, opt.method = c("L-BFGS-B", "nlminb"), Q = 10, cores = 5, lambda = 0.01 )
ctrl.multordRS( RS = TRUE, thresholds.acat = c("full", "shift", "minimal"), XforRS = TRUE, opt.method = c("L-BFGS-B", "nlminb"), Q = 10, cores = 5, lambda = 0.01 )
RS |
Logical value indicating whether response style should be modelled. |
thresholds.acat |
Type of parametrization used for thresholds: |
XforRS |
Logical value indicating whether also covariate effects on the
response style should be considered. Only relevant if |
opt.method |
Specifies optimization algorithm used by |
Q |
Number of nodes to be used (per dimension) in Gauss-Hermite-Quadrature. If |
cores |
Number of cores to be used in parallelized computation. |
lambda |
Tuning parameter for internal ridge penalty. It is supposed to be set to a small value to stabilize estimates. |
Returns list of control parameters used in multordRS
.
Gunther Schauberger
[email protected]
https://orcid.org/0000-0002-0392-1580
Schauberger, Gunther and Tutz, Gerhard (2021): Multivariate Ordinal Random Effects Models Including Subject and Group Specific Response Style Effects, Statistical Modelling, doi:10.1177/1471082X20978034
multordRS
MultOrdRS-package
plot.MultOrdRS
data(tenseness) ## create a small subset of the data to speed up calculations set.seed(1860) tenseness <- tenseness[sample(1:nrow(tenseness), 300),] ## scale all metric variables to get comparable parameter estimates tenseness$Age <- scale(tenseness$Age) tenseness$Income <- scale(tenseness$Income) ## two formulas, one without and one with explanatory variables (gender and age) f.tense0 <- as.formula(paste("cbind(",paste(names(tenseness)[1:4],collapse=","),") ~ 1")) f.tense1 <- as.formula(paste("cbind(",paste(names(tenseness)[1:4],collapse=","),") ~ Gender + Age")) #### ## Adjacent Categories Models #### ## Multivariate adjacent categories model, without response style, ## without explanatory variables m.tense0 <- multordRS(f.tense0, data = tenseness, control = ctrl.multordRS(RS = FALSE)) m.tense0 ## Multivariate adjacent categories model, with response style as a random effect, ## without explanatory variables m.tense1 <- multordRS(f.tense0, data = tenseness) m.tense1 ## Multivariate adjacent categories model, with response style as a random effect, ## without explanatory variables for response style BUT for location m.tense2 <- multordRS(f.tense1, data = tenseness, control = ctrl.multordRS(XforRS = FALSE)) m.tense2 ## Multivariate adjacent categories model, with response style as a random effect, with ## explanatory variables for location AND response style m.tense3 <- multordRS(f.tense1, data = tenseness) m.tense3 plot(m.tense3) #### ## Cumulative Models #### ## Multivariate cumulative model, without response style, without explanatory variables m.tense0.cumul <- multordRS(f.tense0, data = tenseness, control = ctrl.multordRS(RS = FALSE), model = "cumulative") m.tense0.cumul ## Multivariate cumulative model, with response style as a random effect, ## without explanatory variables m.tense1.cumul <- multordRS(f.tense0, data = tenseness, model = "cumulative") m.tense1.cumul ## Multivariate cumulative model, with response style as a random effect, ## without explanatory variables for response style BUT for location m.tense2.cumul <- multordRS(f.tense1, data = tenseness, control = ctrl.multordRS(XforRS = FALSE), model = "cumulative") m.tense2.cumul ## Multivariate cumulative model, with response style as a random effect, with ## explanatory variables for location AND response style m.tense3.cumul <- multordRS(f.tense1, data = tenseness, model = "cumulative") m.tense3.cumul plot(m.tense3.cumul) ################################################################ ## Examples from Schauberger and Tutz (2020) on ## Data from the German Longitudinal Election Study (GLES) 2017 ################################################################# #### ## Source: German Longitudinal Election Study 2017 ## Rossteutscher et al. 2017, https://doi.org/10.4232/1.12927 #### ## load GLES data data(GLES17) ## scale data GLES17[,7:11] <- scale(GLES17[,7:11]) ## define formula f.GLES <- as.formula(cbind(RefugeeCrisis, ClimateChange, Terrorism, Globalization, Turkey, NuclearEnergy) ~ Age + Gender + Unemployment + EastWest + Abitur) ## fit adjacent categories model without and with response style parameters m.GLES0 <- multordRS(f.GLES, data = GLES17, control = ctrl.multordRS(RS = FALSE, cores = 6)) m.GLES <- multordRS(f.GLES, data = GLES17, control = ctrl.multordRS(cores = 6)) m.GLES0 m.GLES plot(m.GLES, main = "Adjacent categories model") ## fit cumulative model without and with response style parameters (takes pretty long!!!) m.GLES20 <- multordRS(f.GLES, data = GLES17, model="cumul", control = ctrl.multordRS(opt.method = "nlminb", cores = 6, RS = FALSE)) m.GLES2 <- multordRS(f.GLES, data = GLES17, model="cumul", control = ctrl.multordRS(opt.method = "nlminb", cores = 6)) m.GLES20 m.GLES2 plot(m.GLES2, main = "Cumulative model")
data(tenseness) ## create a small subset of the data to speed up calculations set.seed(1860) tenseness <- tenseness[sample(1:nrow(tenseness), 300),] ## scale all metric variables to get comparable parameter estimates tenseness$Age <- scale(tenseness$Age) tenseness$Income <- scale(tenseness$Income) ## two formulas, one without and one with explanatory variables (gender and age) f.tense0 <- as.formula(paste("cbind(",paste(names(tenseness)[1:4],collapse=","),") ~ 1")) f.tense1 <- as.formula(paste("cbind(",paste(names(tenseness)[1:4],collapse=","),") ~ Gender + Age")) #### ## Adjacent Categories Models #### ## Multivariate adjacent categories model, without response style, ## without explanatory variables m.tense0 <- multordRS(f.tense0, data = tenseness, control = ctrl.multordRS(RS = FALSE)) m.tense0 ## Multivariate adjacent categories model, with response style as a random effect, ## without explanatory variables m.tense1 <- multordRS(f.tense0, data = tenseness) m.tense1 ## Multivariate adjacent categories model, with response style as a random effect, ## without explanatory variables for response style BUT for location m.tense2 <- multordRS(f.tense1, data = tenseness, control = ctrl.multordRS(XforRS = FALSE)) m.tense2 ## Multivariate adjacent categories model, with response style as a random effect, with ## explanatory variables for location AND response style m.tense3 <- multordRS(f.tense1, data = tenseness) m.tense3 plot(m.tense3) #### ## Cumulative Models #### ## Multivariate cumulative model, without response style, without explanatory variables m.tense0.cumul <- multordRS(f.tense0, data = tenseness, control = ctrl.multordRS(RS = FALSE), model = "cumulative") m.tense0.cumul ## Multivariate cumulative model, with response style as a random effect, ## without explanatory variables m.tense1.cumul <- multordRS(f.tense0, data = tenseness, model = "cumulative") m.tense1.cumul ## Multivariate cumulative model, with response style as a random effect, ## without explanatory variables for response style BUT for location m.tense2.cumul <- multordRS(f.tense1, data = tenseness, control = ctrl.multordRS(XforRS = FALSE), model = "cumulative") m.tense2.cumul ## Multivariate cumulative model, with response style as a random effect, with ## explanatory variables for location AND response style m.tense3.cumul <- multordRS(f.tense1, data = tenseness, model = "cumulative") m.tense3.cumul plot(m.tense3.cumul) ################################################################ ## Examples from Schauberger and Tutz (2020) on ## Data from the German Longitudinal Election Study (GLES) 2017 ################################################################# #### ## Source: German Longitudinal Election Study 2017 ## Rossteutscher et al. 2017, https://doi.org/10.4232/1.12927 #### ## load GLES data data(GLES17) ## scale data GLES17[,7:11] <- scale(GLES17[,7:11]) ## define formula f.GLES <- as.formula(cbind(RefugeeCrisis, ClimateChange, Terrorism, Globalization, Turkey, NuclearEnergy) ~ Age + Gender + Unemployment + EastWest + Abitur) ## fit adjacent categories model without and with response style parameters m.GLES0 <- multordRS(f.GLES, data = GLES17, control = ctrl.multordRS(RS = FALSE, cores = 6)) m.GLES <- multordRS(f.GLES, data = GLES17, control = ctrl.multordRS(cores = 6)) m.GLES0 m.GLES plot(m.GLES, main = "Adjacent categories model") ## fit cumulative model without and with response style parameters (takes pretty long!!!) m.GLES20 <- multordRS(f.GLES, data = GLES17, model="cumul", control = ctrl.multordRS(opt.method = "nlminb", cores = 6, RS = FALSE)) m.GLES2 <- multordRS(f.GLES, data = GLES17, model="cumul", control = ctrl.multordRS(opt.method = "nlminb", cores = 6)) m.GLES20 m.GLES2 plot(m.GLES2, main = "Cumulative model")
Data from the German Longitudinal Election Study (GLES) from 2017 (Rossteutscher et al., 2017, https://doi.org/10.4232/1.12927). The GLES is a long-term study of the German electoral process. It collects pre- and post-election data for several federal elections, the data used here originate from the pre-election study for 2017.
A data frame containing data from the German Longitudinal Election Study with 2036 observations. The data contain socio-demographic information about the participants as well as their responses to items about specific political fears.
How afraid are you due to the refugee crisis? (Likert scale from 1 (not afraid at all) to 7 (very afraid))
How afraid are you due to the global climate change? (Likert scale from 1 (not afraid at all) to 7 (very afraid))
How afraid are you due to the international terrorism? (Likert scale from 1 (not afraid at all) to 7 (very afraid))
How afraid are you due to the globalization? (Likert scale from 1 (not afraid at all) to 7 (very afraid))
How afraid are you due to the political developments in Turkey? (Likert scale from 1 (not afraid at all) to 7 (very afraid))
How afraid are you due to the use of nuclear energy? (Likert scale from 1 (not afraid at all) to 7 (very afraid))
Age in years
0: male, 1: female
0: West Germany, 1: East Germany
High School Diploma, 1: Abitur/A levels, 0: else
1: currently unemployed, 0: else
https://www.gesis.org/en/gles/about-gles and doi:10.4232/1.12927
Rossteutscher, S., Schmitt-Beck, R., Schoen, H., Wessels, B., Wolf, C., Bieber, I., Stovsand, L.-C., Dietz, M., and Scherer, P. (2017). Pre-election cross section (GLES 2017). GESIS Data Archive, Cologne, ZA6800 Data file Version 2.0.0., doi:10.4232/1.12927.
Schauberger, Gunther and Tutz, Gerhard (2021): Multivariate Ordinal Random Effects Models Including Subject and Group Specific Response Style Effects, Statistical Modelling, doi:10.1177/1471082X20978034
############################################################### ## Examples from Schauberger and Tutz (2020) ## Data from the German Longitudinal Election Study (GLES) 2017 ############################################################### #### ## Source: German Longitudinal Election Study 2017 ## Rossteutscher et al. 2017, https://doi.org/10.4232/1.12927 #### ## load GLES data data(GLES17) ## scale data GLES17[,7:11] <- scale(GLES17[,7:11]) ## define formula f.GLES <- as.formula(cbind(RefugeeCrisis, ClimateChange, Terrorism, Globalization, Turkey, NuclearEnergy) ~ Age + Gender + Unemployment + EastWest + Abitur) ## fit adjacent categories model without and with response style parameters m.GLES0 <- multordRS(f.GLES, data = GLES17, control = ctrl.multordRS(RS = FALSE, cores = 6)) m.GLES <- multordRS(f.GLES, data = GLES17, control = ctrl.multordRS(cores = 6)) m.GLES0 m.GLES plot(m.GLES, main = "Adjacent categories model") ## fit cumulative model without and with response style parameters (takes pretty long!!!) m.GLES20 <- multordRS(f.GLES, data = GLES17, model="cumul", control = ctrl.multordRS(opt.method = "nlminb", cores = 6, RS = FALSE)) m.GLES2 <- multordRS(f.GLES, data = GLES17, model="cumul", control = ctrl.multordRS(opt.method = "nlminb", cores = 6)) m.GLES20 m.GLES2 plot(m.GLES2, main = "Cumulative model")
############################################################### ## Examples from Schauberger and Tutz (2020) ## Data from the German Longitudinal Election Study (GLES) 2017 ############################################################### #### ## Source: German Longitudinal Election Study 2017 ## Rossteutscher et al. 2017, https://doi.org/10.4232/1.12927 #### ## load GLES data data(GLES17) ## scale data GLES17[,7:11] <- scale(GLES17[,7:11]) ## define formula f.GLES <- as.formula(cbind(RefugeeCrisis, ClimateChange, Terrorism, Globalization, Turkey, NuclearEnergy) ~ Age + Gender + Unemployment + EastWest + Abitur) ## fit adjacent categories model without and with response style parameters m.GLES0 <- multordRS(f.GLES, data = GLES17, control = ctrl.multordRS(RS = FALSE, cores = 6)) m.GLES <- multordRS(f.GLES, data = GLES17, control = ctrl.multordRS(cores = 6)) m.GLES0 m.GLES plot(m.GLES, main = "Adjacent categories model") ## fit cumulative model without and with response style parameters (takes pretty long!!!) m.GLES20 <- multordRS(f.GLES, data = GLES17, model="cumul", control = ctrl.multordRS(opt.method = "nlminb", cores = 6, RS = FALSE)) m.GLES2 <- multordRS(f.GLES, data = GLES17, model="cumul", control = ctrl.multordRS(opt.method = "nlminb", cores = 6)) m.GLES20 m.GLES2 plot(m.GLES2, main = "Cumulative model")
A model for multivariate ordinal responses. The response is modelled using a mixed model approach that is also capable of the inclusion of response style effects of the respondents.
multordRS( formula, data = NULL, control = ctrl.multordRS(), se = TRUE, model = c("acat", "cumulative") )
multordRS( formula, data = NULL, control = ctrl.multordRS(), se = TRUE, model = c("acat", "cumulative") )
formula |
Formula containing the (multivariate) ordinal response on the left side and the explanatory variables on the right side. |
data |
Data frame containing the ordinal responses as well as the explanatory variables from the |
control |
Control argument for |
se |
Should standard errors be calculated for the regression coefficients? Default is |
model |
Specifies, which type of model is used, either the (multivariate) adjacent categories model ( |
beta.thresh |
Matrix containing all threshold parameters for the respective model. |
beta.shift |
Vector containing all shift parameters. Only relevant if |
beta.X |
Vector containing parameter estimates for the location effects of the explanatory variables. |
beta.XRS |
Vector containing parameter estimates for the response style effects of the explanatory variables. |
Sigma |
Estimate of the variance (or covariance matrix) of the random effects. The estimate is a matrix if person-specific random response style effects are considered in the model (i.e. if |
Y |
Matrix containing the explanatory variables. |
X |
Data frame containing the multivariate ordinal response, one row per obeservation, one column per response variable. |
se.thresh |
Matrix containing all standard errors of the threshold parameters for the respective model. |
se.shift |
Vector containing all standard errors of the shift parameters. Only relevant if |
se.X |
Vector containing standard errors of the parameter estimates for the location effects of the explanatory variables. |
se.XRS |
Vector containing standard errors of the parameter estimates for the response style effects of the explanatory variables. |
coef.vec |
Complete vector of all parameter estimates (for internal use). |
se.vec |
Complete vector of all standard errors (for internal use). |
design.values |
Some values of the design matrix (for internal use). |
loglik |
(Marginal) Log Likelihood |
call |
Function call |
df |
Degrees of freedom |
control |
Control argument from function call |
Gunther Schauberger
[email protected]
https://orcid.org/0000-0002-0392-1580
Schauberger, Gunther and Tutz, Gerhard (2021): Multivariate Ordinal Random Effects Models Including Subject and Group Specific Response Style Effects, Statistical Modelling, doi:10.1177/1471082X20978034
ctrl.multordRS
MultOrdRS-package
plot.MultOrdRS
data(tenseness) ## create a small subset of the data to speed up calculations set.seed(1860) tenseness <- tenseness[sample(1:nrow(tenseness), 300),] ## scale all metric variables to get comparable parameter estimates tenseness$Age <- scale(tenseness$Age) tenseness$Income <- scale(tenseness$Income) ## two formulas, one without and one with explanatory variables (gender and age) f.tense0 <- as.formula(paste("cbind(",paste(names(tenseness)[1:4],collapse=","),") ~ 1")) f.tense1 <- as.formula(paste("cbind(",paste(names(tenseness)[1:4],collapse=","),") ~ Gender + Age")) #### ## Adjacent Categories Models #### ## Multivariate adjacent categories model, without response style, without explanatory variables m.tense0 <- multordRS(f.tense0, data = tenseness, control = ctrl.multordRS(RS = FALSE, cores = 2)) m.tense0 ## Multivariate adjacent categories model, with response style as a random effect, ## without explanatory variables m.tense1 <- multordRS(f.tense0, data = tenseness) m.tense1 ## Multivariate adjacent categories model, with response style as a random effect, ## without explanatory variables for response style BUT for location m.tense2 <- multordRS(f.tense1, data = tenseness, control = ctrl.multordRS(XforRS = FALSE)) m.tense2 ## Multivariate adjacent categories model, with response style as a random effect, with ## explanatory variables for location AND response style m.tense3 <- multordRS(f.tense1, data = tenseness) m.tense3 plot(m.tense3) #### ## Cumulative Models #### ## Multivariate cumulative model, without response style, without explanatory variables m.tense0.cumul <- multordRS(f.tense0, data = tenseness, control = ctrl.multordRS(RS = FALSE), model = "cumulative") m.tense0.cumul ## Multivariate cumulative model, with response style as a random effect, ## without explanatory variables m.tense1.cumul <- multordRS(f.tense0, data = tenseness, model = "cumulative") m.tense1.cumul ## Multivariate cumulative model, with response style as a random effect, ## without explanatory variables for response style BUT for location m.tense2.cumul <- multordRS(f.tense1, data = tenseness, control = ctrl.multordRS(XforRS = FALSE), model = "cumulative") m.tense2.cumul ## Multivariate cumulative model, with response style as a random effect, with ## explanatory variables for location AND response style m.tense3.cumul <- multordRS(f.tense1, data = tenseness, model = "cumulative") m.tense3.cumul plot(m.tense3.cumul) ################################################################ ## Examples from Schauberger and Tutz (2020) ## Data from the German Longitudinal Election Study (GLES) 2017 ################################################################# #### ## Source: German Longitudinal Election Study 2017 ## Rossteutscher et al. 2017, https://doi.org/10.4232/1.12927 #### ## load GLES data data(GLES17) ## scale data GLES17[,7:11] <- scale(GLES17[,7:11]) ## define formula f.GLES <- as.formula(cbind(RefugeeCrisis, ClimateChange, Terrorism, Globalization, Turkey, NuclearEnergy) ~ Age + Gender + Unemployment + EastWest + Abitur) ## fit adjacent categories model without and with response style parameters m.GLES0 <- multordRS(f.GLES, data = GLES17, control = ctrl.multordRS(RS = FALSE, cores = 6)) m.GLES <- multordRS(f.GLES, data = GLES17, control = ctrl.multordRS(cores = 6)) m.GLES0 m.GLES plot(m.GLES, main = "Adjacent categories model") ## fit cumulative model without and with response style parameters (takes pretty long!!!) m.GLES20 <- multordRS(f.GLES, data = GLES17, model="cumul", control = ctrl.multordRS(opt.method = "nlminb", cores = 6, RS = FALSE)) m.GLES2 <- multordRS(f.GLES, data = GLES17, model="cumul", control = ctrl.multordRS(opt.method = "nlminb", cores = 6)) m.GLES20 m.GLES2 plot(m.GLES2, main = "Cumulative model")
data(tenseness) ## create a small subset of the data to speed up calculations set.seed(1860) tenseness <- tenseness[sample(1:nrow(tenseness), 300),] ## scale all metric variables to get comparable parameter estimates tenseness$Age <- scale(tenseness$Age) tenseness$Income <- scale(tenseness$Income) ## two formulas, one without and one with explanatory variables (gender and age) f.tense0 <- as.formula(paste("cbind(",paste(names(tenseness)[1:4],collapse=","),") ~ 1")) f.tense1 <- as.formula(paste("cbind(",paste(names(tenseness)[1:4],collapse=","),") ~ Gender + Age")) #### ## Adjacent Categories Models #### ## Multivariate adjacent categories model, without response style, without explanatory variables m.tense0 <- multordRS(f.tense0, data = tenseness, control = ctrl.multordRS(RS = FALSE, cores = 2)) m.tense0 ## Multivariate adjacent categories model, with response style as a random effect, ## without explanatory variables m.tense1 <- multordRS(f.tense0, data = tenseness) m.tense1 ## Multivariate adjacent categories model, with response style as a random effect, ## without explanatory variables for response style BUT for location m.tense2 <- multordRS(f.tense1, data = tenseness, control = ctrl.multordRS(XforRS = FALSE)) m.tense2 ## Multivariate adjacent categories model, with response style as a random effect, with ## explanatory variables for location AND response style m.tense3 <- multordRS(f.tense1, data = tenseness) m.tense3 plot(m.tense3) #### ## Cumulative Models #### ## Multivariate cumulative model, without response style, without explanatory variables m.tense0.cumul <- multordRS(f.tense0, data = tenseness, control = ctrl.multordRS(RS = FALSE), model = "cumulative") m.tense0.cumul ## Multivariate cumulative model, with response style as a random effect, ## without explanatory variables m.tense1.cumul <- multordRS(f.tense0, data = tenseness, model = "cumulative") m.tense1.cumul ## Multivariate cumulative model, with response style as a random effect, ## without explanatory variables for response style BUT for location m.tense2.cumul <- multordRS(f.tense1, data = tenseness, control = ctrl.multordRS(XforRS = FALSE), model = "cumulative") m.tense2.cumul ## Multivariate cumulative model, with response style as a random effect, with ## explanatory variables for location AND response style m.tense3.cumul <- multordRS(f.tense1, data = tenseness, model = "cumulative") m.tense3.cumul plot(m.tense3.cumul) ################################################################ ## Examples from Schauberger and Tutz (2020) ## Data from the German Longitudinal Election Study (GLES) 2017 ################################################################# #### ## Source: German Longitudinal Election Study 2017 ## Rossteutscher et al. 2017, https://doi.org/10.4232/1.12927 #### ## load GLES data data(GLES17) ## scale data GLES17[,7:11] <- scale(GLES17[,7:11]) ## define formula f.GLES <- as.formula(cbind(RefugeeCrisis, ClimateChange, Terrorism, Globalization, Turkey, NuclearEnergy) ~ Age + Gender + Unemployment + EastWest + Abitur) ## fit adjacent categories model without and with response style parameters m.GLES0 <- multordRS(f.GLES, data = GLES17, control = ctrl.multordRS(RS = FALSE, cores = 6)) m.GLES <- multordRS(f.GLES, data = GLES17, control = ctrl.multordRS(cores = 6)) m.GLES0 m.GLES plot(m.GLES, main = "Adjacent categories model") ## fit cumulative model without and with response style parameters (takes pretty long!!!) m.GLES20 <- multordRS(f.GLES, data = GLES17, model="cumul", control = ctrl.multordRS(opt.method = "nlminb", cores = 6, RS = FALSE)) m.GLES2 <- multordRS(f.GLES, data = GLES17, model="cumul", control = ctrl.multordRS(opt.method = "nlminb", cores = 6)) m.GLES20 m.GLES2 plot(m.GLES2, main = "Cumulative model")
Plot function for a MultOrdRS
object. Plots show coefficients of the explanatory variables, both with repect to location and response styles.
The coefficient pairs are displayed as stars, where the rays represent (1-alpha) confidence intervals.
## S3 method for class 'MultOrdRS' plot(x, alpha = 0.05, CIfactor = 0.9, xlab = expression(exp(gamma)), ylab = expression(exp(alpha)), xlim = range(c(1,betaX.KI)), ylim = range(c(1,betaXRS.KI)), ...)
## S3 method for class 'MultOrdRS' plot(x, alpha = 0.05, CIfactor = 0.9, xlab = expression(exp(gamma)), ylab = expression(exp(alpha)), xlim = range(c(1,betaX.KI)), ylim = range(c(1,betaXRS.KI)), ...)
x |
|
alpha |
Specifies the confidence level 1-alpha of the confidence interval. |
CIfactor |
Argument that helps to control the appearance (the width) of the stars that represent the confidence intervals of both parameters (location and response style) corresponding to one covariate. |
xlab |
Label for x-axis |
ylab |
Label for y-axis |
xlim |
Limits for x-axis |
ylim |
Limits for y-axis |
... |
Further plot arguments. |
No return value, called for side effects
Gunther Schauberger
[email protected]
https://orcid.org/0000-0002-0392-1580
Schauberger, Gunther and Tutz, Gerhard (2021): Multivariate Ordinal Random Effects Models Including Subject and Group Specific Response Style Effects, Statistical Modelling, doi:10.1177/1471082X20978034
data(tenseness) ## create a small subset of the data to speed up calculations set.seed(1860) tenseness <- tenseness[sample(1:nrow(tenseness), 300),] ## scale all metric variables to get comparable parameter estimates tenseness$Age <- scale(tenseness$Age) tenseness$Income <- scale(tenseness$Income) ## two formulas, one without and one with explanatory variables (gender and age) f.tense0 <- as.formula(paste("cbind(",paste(names(tenseness)[1:4],collapse=","),") ~ 1")) f.tense1 <- as.formula(paste("cbind(",paste(names(tenseness)[1:4],collapse=","),") ~ Gender + Age")) #### ## Adjacent Categories Models #### ## Multivariate adjacent categories model, without response style, without explanatory variables m.tense0 <- multordRS(f.tense0, data = tenseness, control = ctrl.multordRS(RS = FALSE)) m.tense0 ## Multivariate adjacent categories model, with response style as a random effect, ## without explanatory variables m.tense1 <- multordRS(f.tense0, data = tenseness) m.tense1 ## Multivariate adjacent categories model, with response style as a random effect, ## without explanatory variables for response style BUT for location m.tense2 <- multordRS(f.tense1, data = tenseness, control = ctrl.multordRS(XforRS = FALSE)) m.tense2 ## Multivariate adjacent categories model, with response style as a random effect, with ## explanatory variables for location AND response style m.tense3 <- multordRS(f.tense1, data = tenseness) m.tense3 plot(m.tense3) #### ## Cumulative Models #### ## Multivariate cumulative model, without response style, without explanatory variables m.tense0.cumul <- multordRS(f.tense0, data = tenseness, control = ctrl.multordRS(RS = FALSE), model = "cumulative") m.tense0.cumul ## Multivariate cumulative model, with response style as a random effect, ## without explanatory variables m.tense1.cumul <- multordRS(f.tense0, data = tenseness, model = "cumulative") m.tense1.cumul ## Multivariate cumulative model, with response style as a random effect, ## without explanatory variables for response style BUT for location m.tense2.cumul <- multordRS(f.tense1, data = tenseness, control = ctrl.multordRS(XforRS = FALSE), model = "cumulative") m.tense2.cumul ## Multivariate cumulative model, with response style as a random effect, with ## explanatory variables for location AND response style m.tense3.cumul <- multordRS(f.tense1, data = tenseness, model = "cumulative") m.tense3.cumul plot(m.tense3.cumul) ################################################################# ## Examples from Schauberger and Tutz (2020) ## Data from the German Longitudinal Election Study (GLES) 2017 ################################################################# #### ## Source: German Longitudinal Election Study 2017 ## Rossteutscher et al. 2017, https://doi.org/10.4232/1.12927 #### ## load GLES data data(GLES17) ## scale data GLES17[,7:11] <- scale(GLES17[,7:11]) ## define formula f.GLES <- as.formula(cbind(RefugeeCrisis, ClimateChange, Terrorism, Globalization, Turkey, NuclearEnergy) ~ Age + Gender + Unemployment + EastWest + Abitur) ## fit adjacent categories model without and with response style parameters m.GLES0 <- multordRS(f.GLES, data = GLES17, control = ctrl.multordRS(RS = FALSE, cores = 6)) m.GLES <- multordRS(f.GLES, data = GLES17, control = ctrl.multordRS(cores = 6)) m.GLES0 m.GLES plot(m.GLES, main = "Adjacent categories model") ## fit cumulative model without and with response style parameters (takes pretty long!!!) m.GLES20 <- multordRS(f.GLES, data = GLES17, model="cumul", control = ctrl.multordRS(opt.method = "nlminb", cores = 6, RS = FALSE)) m.GLES2 <- multordRS(f.GLES, data = GLES17, model="cumul", control = ctrl.multordRS(opt.method = "nlminb", cores = 6)) m.GLES20 m.GLES2 plot(m.GLES2, main = "Cumulative model")
data(tenseness) ## create a small subset of the data to speed up calculations set.seed(1860) tenseness <- tenseness[sample(1:nrow(tenseness), 300),] ## scale all metric variables to get comparable parameter estimates tenseness$Age <- scale(tenseness$Age) tenseness$Income <- scale(tenseness$Income) ## two formulas, one without and one with explanatory variables (gender and age) f.tense0 <- as.formula(paste("cbind(",paste(names(tenseness)[1:4],collapse=","),") ~ 1")) f.tense1 <- as.formula(paste("cbind(",paste(names(tenseness)[1:4],collapse=","),") ~ Gender + Age")) #### ## Adjacent Categories Models #### ## Multivariate adjacent categories model, without response style, without explanatory variables m.tense0 <- multordRS(f.tense0, data = tenseness, control = ctrl.multordRS(RS = FALSE)) m.tense0 ## Multivariate adjacent categories model, with response style as a random effect, ## without explanatory variables m.tense1 <- multordRS(f.tense0, data = tenseness) m.tense1 ## Multivariate adjacent categories model, with response style as a random effect, ## without explanatory variables for response style BUT for location m.tense2 <- multordRS(f.tense1, data = tenseness, control = ctrl.multordRS(XforRS = FALSE)) m.tense2 ## Multivariate adjacent categories model, with response style as a random effect, with ## explanatory variables for location AND response style m.tense3 <- multordRS(f.tense1, data = tenseness) m.tense3 plot(m.tense3) #### ## Cumulative Models #### ## Multivariate cumulative model, without response style, without explanatory variables m.tense0.cumul <- multordRS(f.tense0, data = tenseness, control = ctrl.multordRS(RS = FALSE), model = "cumulative") m.tense0.cumul ## Multivariate cumulative model, with response style as a random effect, ## without explanatory variables m.tense1.cumul <- multordRS(f.tense0, data = tenseness, model = "cumulative") m.tense1.cumul ## Multivariate cumulative model, with response style as a random effect, ## without explanatory variables for response style BUT for location m.tense2.cumul <- multordRS(f.tense1, data = tenseness, control = ctrl.multordRS(XforRS = FALSE), model = "cumulative") m.tense2.cumul ## Multivariate cumulative model, with response style as a random effect, with ## explanatory variables for location AND response style m.tense3.cumul <- multordRS(f.tense1, data = tenseness, model = "cumulative") m.tense3.cumul plot(m.tense3.cumul) ################################################################# ## Examples from Schauberger and Tutz (2020) ## Data from the German Longitudinal Election Study (GLES) 2017 ################################################################# #### ## Source: German Longitudinal Election Study 2017 ## Rossteutscher et al. 2017, https://doi.org/10.4232/1.12927 #### ## load GLES data data(GLES17) ## scale data GLES17[,7:11] <- scale(GLES17[,7:11]) ## define formula f.GLES <- as.formula(cbind(RefugeeCrisis, ClimateChange, Terrorism, Globalization, Turkey, NuclearEnergy) ~ Age + Gender + Unemployment + EastWest + Abitur) ## fit adjacent categories model without and with response style parameters m.GLES0 <- multordRS(f.GLES, data = GLES17, control = ctrl.multordRS(RS = FALSE, cores = 6)) m.GLES <- multordRS(f.GLES, data = GLES17, control = ctrl.multordRS(cores = 6)) m.GLES0 m.GLES plot(m.GLES, main = "Adjacent categories model") ## fit cumulative model without and with response style parameters (takes pretty long!!!) m.GLES20 <- multordRS(f.GLES, data = GLES17, model="cumul", control = ctrl.multordRS(opt.method = "nlminb", cores = 6, RS = FALSE)) m.GLES2 <- multordRS(f.GLES, data = GLES17, model="cumul", control = ctrl.multordRS(opt.method = "nlminb", cores = 6)) m.GLES20 m.GLES2 plot(m.GLES2, main = "Cumulative model")
Data from the Freiburg Complaint Checklist. The data contain all 8 items corresponding to the scale Tenseness for 1847 participants of the standardization sample of the Freiburg Complaint Checklist. Additionally, several person characteristics are available.
A data frame containing data from the Freiburg Complaint Checklist with 1847 observations. All items refer to the scale Tenseness and are measured on a 5-point Likert scale where low numbers correspond to low frequencies or low intensitites of the respective complaint and vice versa.
Do you have clammy hands?
Do you have sudden attacks of sweating?
Do you notice that you behave clumsy?
Are your hands wavering frequently, e.g. when lightning a cigarette or when holding a cup?
Do you notice that your hands are restless?
Do you notice that your feet are restless?
Do you notice unvoluntary twitching of your eyes?
Do you notice unvoluntary twitching of your mouth?
Gender of the participant
Does participant live alone in a houshold or together with others?
is the participant from East Germany (former GDR) or West Germany?
Age in 15 categories, treated as continuous variable
Does the participant have Abitur (a-levels)?
Income in 11 categories, treated as continuous variable
ZPID (2013). PsychData of the Leibniz Institute for Psychology Information ZPID. Trier: Center for Research Data in Psychology.
Fahrenberg, J. (2010). Freiburg Complaint Checklist [Freiburger Beschwerdenliste (FBL)]. Goettingen, Hogrefe.
data(tenseness) ## create a small subset of the data to speed up calculations set.seed(1860) tenseness <- tenseness[sample(1:nrow(tenseness), 300),] ## scale all metric variables to get comparable parameter estimates tenseness$Age <- scale(tenseness$Age) tenseness$Income <- scale(tenseness$Income) ## two formulas, one without and one with explanatory variables (gender and age) f.tense0 <- as.formula(paste("cbind(",paste(names(tenseness)[1:4],collapse=","),") ~ 1")) f.tense1 <- as.formula(paste("cbind(",paste(names(tenseness)[1:4],collapse=","),") ~ Gender + Age")) #### ## Adjacent Categories Models #### ## Multivariate adjacent categories model, without response style, without explanatory variables m.tense0 <- multordRS(f.tense0, data = tenseness, control = ctrl.multordRS(RS = FALSE)) m.tense0 ## Multivariate adjacent categories model, with response style as a random effect, ## without explanatory variables m.tense1 <- multordRS(f.tense0, data = tenseness) m.tense1 ## Multivariate adjacent categories model, with response style as a random effect, ## without explanatory variables for response style BUT for location m.tense2 <- multordRS(f.tense1, data = tenseness, control = ctrl.multordRS(XforRS = FALSE)) m.tense2 ## Multivariate adjacent categories model, with response style as a random effect, with ## explanatory variables for location AND response style m.tense3 <- multordRS(f.tense1, data = tenseness) m.tense3 plot(m.tense3) #### ## Cumulative Models #### ## Multivariate cumulative model, without response style, without explanatory variables m.tense0.cumul <- multordRS(f.tense0, data = tenseness, control = ctrl.multordRS(RS = FALSE), model = "cumulative") m.tense0.cumul ## Multivariate cumulative model, with response style as a random effect, ## without explanatory variables m.tense1.cumul <- multordRS(f.tense0, data = tenseness, model = "cumulative") m.tense1.cumul ## Multivariate cumulative model, with response style as a random effect, ## without explanatory variables for response style BUT for location m.tense2.cumul <- multordRS(f.tense1, data = tenseness, control = ctrl.multordRS(XforRS = FALSE), model = "cumulative") m.tense2.cumul ## Multivariate cumulative model, with response style as a random effect, ## with explanatory variables ## for location AND response style m.tense3.cumul <- multordRS(f.tense1, data = tenseness, model = "cumulative") m.tense3.cumul plot(m.tense3.cumul)
data(tenseness) ## create a small subset of the data to speed up calculations set.seed(1860) tenseness <- tenseness[sample(1:nrow(tenseness), 300),] ## scale all metric variables to get comparable parameter estimates tenseness$Age <- scale(tenseness$Age) tenseness$Income <- scale(tenseness$Income) ## two formulas, one without and one with explanatory variables (gender and age) f.tense0 <- as.formula(paste("cbind(",paste(names(tenseness)[1:4],collapse=","),") ~ 1")) f.tense1 <- as.formula(paste("cbind(",paste(names(tenseness)[1:4],collapse=","),") ~ Gender + Age")) #### ## Adjacent Categories Models #### ## Multivariate adjacent categories model, without response style, without explanatory variables m.tense0 <- multordRS(f.tense0, data = tenseness, control = ctrl.multordRS(RS = FALSE)) m.tense0 ## Multivariate adjacent categories model, with response style as a random effect, ## without explanatory variables m.tense1 <- multordRS(f.tense0, data = tenseness) m.tense1 ## Multivariate adjacent categories model, with response style as a random effect, ## without explanatory variables for response style BUT for location m.tense2 <- multordRS(f.tense1, data = tenseness, control = ctrl.multordRS(XforRS = FALSE)) m.tense2 ## Multivariate adjacent categories model, with response style as a random effect, with ## explanatory variables for location AND response style m.tense3 <- multordRS(f.tense1, data = tenseness) m.tense3 plot(m.tense3) #### ## Cumulative Models #### ## Multivariate cumulative model, without response style, without explanatory variables m.tense0.cumul <- multordRS(f.tense0, data = tenseness, control = ctrl.multordRS(RS = FALSE), model = "cumulative") m.tense0.cumul ## Multivariate cumulative model, with response style as a random effect, ## without explanatory variables m.tense1.cumul <- multordRS(f.tense0, data = tenseness, model = "cumulative") m.tense1.cumul ## Multivariate cumulative model, with response style as a random effect, ## without explanatory variables for response style BUT for location m.tense2.cumul <- multordRS(f.tense1, data = tenseness, control = ctrl.multordRS(XforRS = FALSE), model = "cumulative") m.tense2.cumul ## Multivariate cumulative model, with response style as a random effect, ## with explanatory variables ## for location AND response style m.tense3.cumul <- multordRS(f.tense1, data = tenseness, model = "cumulative") m.tense3.cumul plot(m.tense3.cumul)