Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
My sjPlot package for data visualization has just been updated on CRAN. I’ve added some features to existing function, which I want to introduce here.
Plotting linear models
So far, plotting model assumptions of linear models or plotting slopes for each estimate of linear models were spread over several functions. Now, these plot types have been integrated into the sjp.lm
function, where you can select the plot type with the type
parameter. Furthermore, plotting standardized coefficients now also plot the related confidence intervals.
Detailed examples can be found here:
www.strengejacke.de/sjPlot/sjp.lm
Plotting generalized linear models
Beside odds ratios, you now can also plot the predicted probabilities of the outcome for each predictor of generalized linear models. In case you have continuous variables, these kind of plots may be more intuitive than an odds ratio value.
Detailed examples can be found here:
www.strengejacke.de/sjPlot/sjp.glm
Plotting (generalized) linear mixed effects models
The plotting function for creating plots of (generalized) linear mixed effects models (sjp.lmer
and sjp.glmer
) also got new plot types over the course of the last weeks.
For sjp.lmer
, we have
re
(default) for estimates of random effectsfe
for estimates of fixed effectsfe.std
for standardized estimates of fixed effectsfe.cor
for correlation matrix of fixed effectsre.qq
for a QQ-plot of random effects (random effects quantiles against standard normal quantiles)fe.ri
for fixed effects slopes depending on the random intercept.
and for sjp.glmer
, we have
re
(default) for odds ratios of random effectsfe
for odds ratios of fixed effectsfe.cor
for correlation matrix of fixed effectsre.qq
for a QQ-plot of random effects (random effects quantiles against standard normal quantiles)fe.pc
orfe.prob
to plot probability curves (predicted probabilities) of all fixed effects coefficients. Use facet.grid to decide whether to plot each coefficient as separate plot or as integrated faceted plot.ri.pc
orri.prob
to plot probability curves (predicted probabilities) of random intercept variances for all fixed effects coefficients. Use facet.grid to decide whether to plot each coefficient as separate plot or as integrated faceted plot.
Detailed examples can be found here:
www.strengejacke.de/sjPlot/sjp.lmer and www.strengejacke.de/sjPlot/sjp.glmer
Plotting interaction terms of (generalized) linear (mixed effects) models
Another function, where new features were added, is sjp.int
(formerly known as sjp.lm.int). This function is now kind of generic and can plot interactions of
- linar models (lm)
- generalized linar models (glm)
- linar mixed effects models (lme4::lmer)
- generalized linar mixed effects models (lme4::glmer)
For linear models (both normal and mixed effects), slopes of interaction terms are plotted. For generalized linear models, the predicted probabilities of the outcome towards the interaction terms is plotted.
Detailed examples can be found here:
www.strengejacke.de/sjPlot/sjp.int
Plotting Likert scales
Finally, a comprehensive documentation for the sjp.likert
function is finsihed, which can be found here:
www.strengejacke.de/sjPlot/sjp.likert
Tagged: data visualization, ggplot, R, rstats, sjPlot
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.