Learn R Programming

sjPlot (version 1.8.1)

sjp.glmm: Plot odds ratios (forest plots) of multiple fitted glm's

Description

Plot odds ratios (forest plots) of multiple fitted glm's with confidence intervalls in one plot.

Usage

sjp.glmm(..., title = NULL, labelDependentVariables = NULL,
  legendDepVarTitle = "Dependent Variables", legendPValTitle = "p-level",
  stringModel = "Model", axisLabels.y = NULL, axisTitle.x = "Odds Ratios",
  axisLimits = NULL, breakTitleAt = 50, breakLabelsAt = 25,
  breakLegendAt = 20, gridBreaksAt = 0.5, transformTicks = TRUE,
  geom.size = 3, geom.spacing = 0.4, geom.colors = "Set1",
  fade.ns = TRUE, usePShapes = FALSE, interceptLineType = 2,
  interceptLineColor = "grey70", coord.flip = TRUE, showIntercept = FALSE,
  showAxisLabels.y = TRUE, showValueLabels = TRUE, labelDigits = 2,
  showPValueLabels = TRUE, hideLegend = FALSE, facet.grid = FALSE,
  printPlot = TRUE)

Arguments

Value

(Insisibily) returns the ggplot-object with the complete plot (plot) as well as the data frame that was used for setting up the ggplot-object (df).

Examples

Run this code
# prepare dummy variables for binary logistic regression
y1 <- ifelse(swiss$Fertility < median(swiss$Fertility), 0, 1)
y2 <- ifelse(swiss$Infant.Mortality < median(swiss$Infant.Mortality), 0, 1)
y3 <- ifelse(swiss$Agriculture<median(swiss$Agriculture), 0, 1)

# Now fit the models. Note that all models share the same predictors
# and only differ in their dependent variable (y1, y2 and y3)
fitOR1 <- glm(y1 ~ swiss$Education + swiss$Examination + swiss$Catholic,
              family = binomial(link = "logit"))
fitOR2 <- glm(y2 ~ swiss$Education + swiss$Examination + swiss$Catholic,
              family = binomial(link = "logit"))
fitOR3 <- glm(y3 ~ swiss$Education + swiss$Examination + swiss$Catholic,
              family = binomial(link = "logit"))

# plot multiple models
sjp.glmm(fitOR1, fitOR2, fitOR3, facet.grid = TRUE, fade.ns = FALSE)

# plot multiple models with legend labels and point shapes instead of value  labels
sjp.glmm(fitOR1, fitOR2, fitOR3,
         labelDependentVariables = c("Fertility",
                                     "Infant Mortality",
                                     "Agriculture"),
         showValueLabels = FALSE,
         showPValueLabels = FALSE,
         usePShapes = TRUE)

# plot multiple models from nested lists parameter
all.models <- list()
all.models[[1]] <- fitOR1
all.models[[2]] <- fitOR2
all.models[[3]] <- fitOR3

sjp.glmm(all.models)

Run the code above in your browser using DataLab