Questions tagged [sjplot]

sjPlot is a collection of several plotting and table output functions for data visualization o R.

About

Its a collection of several plotting and table output functions for data visualization. Results of several statistical analyses (that are commonly used in social sciences) can be visualized using this package, including simple and cross tabulated frequencies, histograms, box plots, (generalized) linear models (forest plots), PCA, correlations, cluster analyses, scatter plots etc.

Links

280 questions
2
votes
1 answer

How to make sjPlot::tab_model() html table to be numbered in a bookdown document

I want to add tables from models (besides other tables) in a bookdown document in order to have all of them automatically numbered. When using knitr::kable() it works well. But I haven't been able to do it with my first option for model tables…
Crimc
  • 195
  • 17
2
votes
2 answers

Adjusting facet order and legend labels when using plot_model function of sjplot

I have successfully used the plot_model function of sjplot to plot a multinomial logistic regression model. The regression contains an outcome (Info Sought, with 3 levels) and 2 continuous predictors (DSA, ASA). I have also changed the values of…
jjcii
  • 139
  • 3
  • 10
2
votes
2 answers

Is it possible to plot R glmer model predictions using Python?

I have an glmer model in R which I want to plot predictions for. I found the plot_model function from the sjPlot library and it works fine. Here is a MWE: library(lattice) cbpp$response <- sample(c(0,1), replace=TRUE, size=nrow(cbpp)) gm1 <-…
Marcelo Villa-Piñeros
  • 1,101
  • 2
  • 12
  • 24
2
votes
1 answer

Combine 2 Predicted Probabilities graphs in R with SjPlot Package

Lets say I have this code: dt <- data.frame(x = (1:9), z = c(6,5,3,7,8,3,1,6,7), y = c(1,0,1,1,0,0,0,1,0)) model1 <- glm(y ~ x + z, family = binomial(link = "logit"), data = dt) model2 <- glm(y ~ x + z, family = binomial(link =…
user9563072
2
votes
1 answer

Plotting multiple random effects in single plot mixed models

library("lme4") data(sleepstudy) fit1 <- lmer(Reaction ~ Days + (1|Subject), sleepstudy) To visualise the random effect, library(sjPlot) plot_model(fit1,type = "re",facet.grid = FALSE) In my orginal data, I have three random…
89_Simple
  • 3,393
  • 3
  • 39
  • 94
2
votes
1 answer

error in sjPlot sjp.xtab command used to get "cleanest" graphic?

I am trying to generate a bar plot with this data: library(sjPlot) library(sjstats) data("efc") i use the following to generate the default xtab plot from the sjPlot. sjp.xtab(x = efc$e42dep, grp = efc$c82cop1) But i prefer show only a…
Victor Espinoza
  • 318
  • 1
  • 9
2
votes
2 answers

Plotting mixed models' regression coefficients in R

I am having hard time trying to produce a grid with four coefficients' plot from four non-nested linear random effects models using the sj.plot package. I am not married to this package so feel free to suggest other routes (ggplot2 solutions better…
000andy8484
  • 563
  • 3
  • 16
1
vote
1 answer

Output a series of crosstabs using sjPlot into an RMarkdown document using knitr

I'm trying to use purrr::imap() to output a series of crosstab tables into a Flexdashboard. However, no matter what I try to output from the mapped function, all I get is an escaped HTML string instead of actual raw HTML. I'm pretty new to R and…
morphatic
  • 7,677
  • 4
  • 47
  • 61
1
vote
1 answer

Multi-level modelling with lmer plotting interactions with sjPlot

I am running a multi-level model with two continuous level 2 predictors (A and B) and a dichotomous level 1 predictor (cond, coded -1 and 1). Y is the dependent variable. M2<-lmer(Y ~ 1 + (1|subject) + A*cond + B*cond, data, na.action =…
jwin
  • 41
  • 6
1
vote
1 answer

I would like to plot those graph from sjPlot::plot_model() in R on the same line

plot1<-plot_model(m3,type = "pred",terms = c("anno","dimensione_capoluogo","rip."), colors = c("grey80","grey60","black"), grid=T, #T disegna in quadranti diversi, F fa multiline ci.lvl = NA, # rumuove intervalli di confidenza axis.title =…
Brex Led
  • 21
  • 2
1
vote
1 answer

coord_flip in plot_model sjplot

I would appreciate any help in flipping the axis as shown in the picture. I tried using the coord_flip() in plot_model (sjplot) but without any success . I tried coord_flip() / coord_flitp = TRUE but without any…
skpak
  • 79
  • 6
1
vote
1 answer

How to write for loop for sjt.xtab in R, a df of factors?

I'm trying to write a for loop to create tables using sjt.xtab() so it iterates through every variation in a dataframe. Ideally this would be generalizable to all other dataframes too so a function would probably be better. I have a dataframe called…
1
vote
2 answers

How to vertically stack panels of sjPlot in R?

I got a meaningful four-way interaction to plot using sjPlot in R, here is an example: colnames(iris) <- c("y", "a", "b", "c", "d") m0 <- lm(y ~ a * b * c * d, data = iris) sjPlot::plot_model(m0, type = "pred", terms = c("a", "b", "c", "d"))…
Juan_814
  • 51
  • 8
1
vote
1 answer

R plot_model - Change both font size and legend labels

I created a plot of an interaction using plot_model. The problem is that plot_model doesn't have a way to change the legend labels, so I had to add that using scale_color_manual. But that seems to override the changes I want to make to the size of…
1
vote
0 answers

Add a footnote to the bottom of a tab_model table in sjPlot (R)

Very straightforward question, but how can one add a footnote to the bottom of a table displaying two regression models next to each other? I have created two similar OLS regressions with lm and displayed their coefficients next to each other using…
flâneur
  • 633
  • 2
  • 8