Learn R Programming

sjPlot (version 1.8.1)

sjp.lmm: Plot beta coefficients of multiple fitted lm's

Description

Plot beta coefficients (estimates) with confidence intervalls of multiple fitted linear models in one plot.

Usage

sjp.lmm(..., title = NULL, labelDependentVariables = NULL,
  legendDepVarTitle = "Dependent Variables", legendPValTitle = "p-level",
  stringModel = "Model", axisLabels.y = NULL, axisTitle.x = "Estimates",
  axisLimits = NULL, breakTitleAt = 50, breakLabelsAt = 25,
  breakLegendAt = 20, gridBreaksAt = NULL, 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
# Now fit the models. Note that all models share the same predictors
# and only differ in their dependent variable
library(sjmisc)
data(efc)

# fit three models
fit1 <- lm(barthtot ~ c160age + c12hour + c161sex + c172code, data = efc)
fit2 <- lm(neg_c_7 ~ c160age + c12hour + c161sex + c172code, data = efc)
fit3 <- lm(tot_sc_e ~ c160age + c12hour + c161sex + c172code, data = efc)

# plot multiple models
sjp.lmm(fit1, fit2, fit3, facet.grid = TRUE, fade.ns = FALSE)

# plot multiple models with legend labels and point shapes instead of value  labels
sjp.lmm(fit1, fit2, fit3,
         axisLabels.y = c("Carer's Age",
                          "Hours of Care",
                          "Carer's Sex",
                          "Educational Status"),
         labelDependentVariables = c("Barthel Index",
                                     "Negative Impact",
                                     "Services used"),
         showValueLabels = FALSE,
         showPValueLabels = FALSE,
         usePShapes = TRUE)

# plot multiple models from nested lists parameter
all.models <- list()
all.models[[1]] <- fit1
all.models[[2]] <- fit2
all.models[[3]] <- fit3

sjp.lmm(all.models)

Run the code above in your browser using DataLab