plot.MultOrdRS: Plot function for MultOrdRS

View source: R/plot.multordRS.R

plot.MultOrdRSR Documentation

Plot function for MultOrdRS

Description

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.

Usage

## 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)), ...)

Arguments

x

MultOrdRS object

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.

Value

No return value, called for side effects

Author(s)

Gunther Schauberger
gunther.schauberger@tum.de
https://orcid.org/0000-0002-0392-1580

References

Schauberger, Gunther and Tutz, Gerhard (2021): Multivariate Ordinal Random Effects Models Including Subject and Group Specific Response Style Effects, Statistical Modelling, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1177/1471082X20978034")}

See Also

multordRS, ctrl.multordRS

Examples


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")



MultOrdRS documentation built on May 29, 2024, 4:05 a.m.