sjPlot | sjPlot - Data Visualization for Statistics in Social Science | Data Visualization library
kandi X-RAY | sjPlot Summary
kandi X-RAY | sjPlot Summary
Collection of plotting and table output functions for data visualization. Results of various 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, mixed effects models, PCA and correlation matrices, cluster analyses, scatter plots, Likert scales, effects plots of interaction terms in regression models, constructing index or score variables and much more.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of sjPlot
sjPlot Key Features
sjPlot Examples and Code Snippets
Community Discussions
Trending Discussions on sjPlot
QUESTION
I am trying to use sjplot to create html tables for output for a glm (actually a mixed effects model, but I will keep it simple), and I can't figure out how to print estimates and se for predictors. Here is an example:
...ANSWER
Answered 2022-Mar-07 at 14:46You need to include the argument transform = NULL
to prevent tab_model
from automatically exponentiating the estimates into odds ratios:
QUESTION
I am trying to make an interaction plot in sjPlot showing percent probabiliites of my outcome under two conditions of my predictive variable. Everything works perfectly, except the show.values = T and sort.est = T arguments, which don't seem to do anything. Is there a way to get this to work? Or, if not, how can I extract the dataframe sjPlot is using to create this figure? Looking for some way to either label or tabulate the displayed probability values. Thank you!
Here is some example data and what I have so far:
...ANSWER
Answered 2022-Mar-06 at 22:30sjPlot
produces a ggplot object, so you can examine the aesthetic mappings and underlying data. After a bit of digging around you will find the default mapping is already correct for the x, y placements of text labels, so all you need to do is add a geom_text
to the plot, and only need to specify the labels as an aesthetic mapping. You can get the labels from a column called predicted
stored in the ggplot object.
The upshot is that if you add the following layer to your plot:
QUESTION
I fitted a glm model and had to transform some variables with log1p. I now want to create a ggpredict plot with a backtransformed scale. I transformed the variables before using the glm function.
here's a sample of a few variables of my original data and my code:
...ANSWER
Answered 2022-Mar-02 at 23:46When I can't get the built-in plot method to do what I want, I use ggpredict()
to get the predicted values and build the plot myself. I couldn't make your model work (you only gave us responses where case=1
) so I'm making up my own, slightly simpler example.
Load package and fit model:
QUESTION
I have imputed data saved as a mids
object and am trying to adapt my usual workflow around imputed data. However, I cannot figure out how to use sjPlot's tab_corr()
and tab_df()
and psych's describe
on a mids
object.
My goal is to generate a table of descriptive statistics and a correlation matrix without averaging the imputed datasets together. I was able to generate correlations using miceadds::micombine.cor
, but the output isn't formatted like a typical correlation matrix. I also can individually compute means, SDs, etc. of variables from the mids
object, but I'm looking for something that will generate a table.
ANSWER
Answered 2022-Feb-12 at 00:27The previous code was incorrect. I have created two functions, mice_df
and mice_cor
(link to Github repo here) that will generate a correlation matrix and a table of descriptive statistics from a mids
object using Rubin's Rules.
gtsummary
will neatly format models based on mids
objects.
QUESTION
I have a summary regression model I want to put into a table. However, it keeps coming up with an error. Not sure what I am doing wrong here. I have included a reproducible data and steps I have taken below.
...ANSWER
Answered 2022-Feb-10 at 00:41You shouldn't assign the output of tab_model()
to a variable - that prevents it from writing the HTML file. If you just run tab_model()
without assigning it to test
you'll be fine.
The following works for me:
QUESTION
Is there a way to add the Statistic for each variable as a column in a tbl_regresion()
with {gtsummary}? In Psychology is not uncommon for reviewers to expect this column in the tables.
When using {sjPlot}, just need to add the show.stat
parameter, and the Statistic column will appear showing the t value
from summary(model)
.
ANSWER
Answered 2022-Feb-07 at 15:13Yep! The statistic column is already in the table, but it's hidden by default. You can unhide it (and other columns) with the modify_column_unhide()
function. Example below!
QUESTION
I have historically used sjPlot
to create APA-style regression tables that export directly as a docx
. Unfortunately, models based on imputed data (mipo
objects) are not currently compatible with tab_model
.
I am looking for a function similar to tab_model
that can export APA-style regression tables directly to a Word Document in a single chunk without having to knit. Most packages I found (e.g., stargazer
) seem to require knitting to create the table. Alternatively, if anyone knows a workaround to get mipo
objects to work with tab_model
, I would be most appreciative.
ANSWER
Answered 2021-Dec-20 at 13:00mice
relies on broom::tidy()
and broom::glance()
within the pool()
function. So I think the solution may be found in the combination of tab_model()
with a broom object, such as here: https://github.com/strengejacke/sjPlot/issues/385.
QUESTION
I would like to plot the estimates of the fixed effects of an lme4::lmer model. Currently, the sjPlot::plot_model output includes two additional plots that I do not want: SD (Observations) and SD (Intercept). How can I remove these two additional plots?
...ANSWER
Answered 2021-Nov-23 at 13:29Have you tried reinstalling all the packages and restarting your RStudio session? It's possible that you overwrote some sort of default because I can't reproduce the images that you have attached. I'm using the most recent version of sjPlot from CRAN (2.8.9).
This is what I get when I run your code, slightly modified to call the plot to plot window:
QUESTION
I have a dataset in a long format of 60 repeated measurements taken within 19 patients (ID
). Patients have had a differing amount of measurements (2 measurements [n=11], followed by 5 measurements [n=5], 3 [n=1], 4 [n=1], and 6 measurements [n=1], with varying time-intervals (fu_time
measured in years). The data looks as follows:
ANSWER
Answered 2021-Nov-16 at 23:10A bit off-topic, but I suggest parameters::model_parameters()
for your summary tables:
QUESTION
ANSWER
Answered 2021-Nov-03 at 16:45An option is to specify results = 'asis'
in the chunk along with using knit_print
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install sjPlot
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page