Comments (19)
Or plot multiple CIs one on top of each other?
See how something similar is now done in emmeans
here.
from see.
The only edge case that I see is in the case of multiple CIs, but we can easily detect that by checking the length of ci
which is stored in the parameters' attributes, and if length > 1 then pass the whole parameter table to the new reshape_ci
function, and then simply add the CI
as a facet... easy peasy
from see.
Yup, if tastefully implemented it could be nice
from see.
(tastefully = in a readable and aesthetically pleasing fashion ^^)
from see.
if tastefully implemented it could be nice
Like in sjPlot?
from see.
I don't know, does sjPlot handle multiple CIs π¬ ?
Also, by default, I very strongly favour geom_pointrange over error bars (i.e., I find simple lines ------x------
, as opposed to brackets ][------x------][
, sleeker)
from see.
@strengejacke I have misread your link, sjPlot also uses pointrange by default and sort-of boxplots to handle 2 different CIs for is that correct?
from see.
But yes, sjPlot is tasteful ^^
Nevertheless, it would be good to deal with multiple CIs in an automatic and systemic way
from see.
For Bayesian models, two HDIs are plotted by default:
I use geom_errorbar(), but you can use the width
-argument to remove the "brackets" from the line-ends.
from see.
Oh, we need to have information about the link-function (as atribute?), in order to choose the correct scale (see again https://strengejacke.github.io/sjPlot/articles/plot_model_estimates.html).
from see.
For model parameters? Why the link? It's always identity for model_parameters isn't it
from see.
Ok, I probably was thinking a bit too far ahead... Usually, in social science, you would rather want to present (e.g.) Odds or Incidence Rate Ratios instead of log-estimates.
from see.
We can add this feature in the future for sure
from see.
The plot might also benefit from the clean_names
attributes (currently used by parameters_table
).
Note to myself: as matter of fact, format_parameters()
might be improved to deal with cases of s(x)
, poly(x)
and bs(x)
.
from see.
This looks also nice, a "completely" different style...
from see.
Quick sketch:
library(ggplot2)
library(parameters)
model <- lm(mpg ~ wt + cyl + gear + hp, data = mtcars)
mp <- model_parameters(model, standardize = "refit")
ggplot(mp, aes(x = Parameter, y = Coefficient)) +
geom_errorbar(aes(ymin = CI_low, ymax = CI_high), alpha = .3, size = 4, width = 0, color = "#2196F3") +
geom_segment(aes(y = CI_low, yend = CI_low + .4, x = Parameter, xend = Parameter), size = 4, color = "#2196F3", alpha = .5) +
geom_segment(aes(y = CI_high, yend = CI_high - .4, x = Parameter, xend = Parameter), size = 4, color = "#2196F3", alpha = .5) +
see::geom_point2(color = "#2196F3", size = 2.5) +
coord_flip()+
see::theme_lucid()
Created on 2019-07-26 by the reprex package (v0.3.0)
from see.
Minimalist is the new maximalist:
library(ggplot2)
library(parameters)
model <- lm(mpg ~ wt + cyl + gear + hp, data = mtcars)
mp <- model_parameters(model, standardize = "refit")
# mp <- mp[mp$Parameter != "(Intercept)", ]
max_value <- max(abs(mp[["Coefficient"]]))
ggplot(mp, aes(x = Parameter, y = Coefficient, color = Coefficient)) +
geom_hline(aes(yintercept = 0), linetype = "dashed") +
geom_pointrange(aes(ymin = CI_low, ymax= CI_high), size = 1) +
scale_color_gradientn(colours = c("red", "orange", "green"), limits=c(-max_value, max_value)) +
coord_flip() +
see::theme_modern(legend.position = "none")
Created on 2019-07-26 by the reprex package (v0.3.0)
from see.
For Multiple CIs is kinda tough to display it on one plot
library(ggplot2)
library(parameters)
library(rstanarm)
model <- stan_glm(mpg ~ wt + cyl + gear + hp, data = mtcars, refresh = 0)
mp <- model_parameters(model, ci = c(0.5, 0.7, 0.9))
#> Possible multicollinearity between hp and cyl (r = 0.78). This might lead to inappropriate results. See 'Details' in '?rope'.
max_value <- max(abs(mp[["Median"]]))
ggplot(mp, aes(x = Parameter, y = Median, color = Median)) +
geom_hline(aes(yintercept = 0), linetype = "dashed") +
geom_pointrange(aes(ymin = CI_low_90, ymax= CI_high_90), size = 0.5) +
geom_pointrange(aes(ymin = CI_low_70, ymax= CI_high_70), size = 1) +
geom_pointrange(aes(ymin = CI_low_50, ymax= CI_high_50), size = 2) +
scale_color_gradientn(colours = c("#f44336", "#FF9800", "#4CAF50"), limits=c(-max_value, max_value)) +
coord_flip() +
see::theme_modern(legend.position = "none")
Created on 2019-07-26 by the reprex package (v0.3.0)
from see.
Current implementation:
library(parameters)
library(see)
model <- glm(mpg ~ wt + cyl + gear + hp, data = mtcars)
mp <- model_parameters(model)
plot(mp)
mp <- model_parameters(model, ci = c(0.5, 0.7, 0.9))
plot(mp)
Created on 2019-07-30 by the reprex package (v0.3.0)
from see.
Related Issues (20)
- Option to only select fixed effects when plotting paramters of `gam()` model HOT 1
- Suggestion: `pretty_names` for `see:::plot.see_parameters_model()`
- Plotting the results of cluster analyses HOT 2
- Simplify `plot.parameters_model()` HOT 5
- Specifying jitter width is not working with visualisation_recipe
- Improved meta-analysis forest plotting
- `palette_colorhex()` requires R 4.1 to work
- DRY test datasets
- Reduce usage of pipes in the docs and tests
- Fix warning in `binned_residuals()` HOT 2
- plot.parameters_simulate formatting VS parameters_model formatting
- customize facet direction in plot.parameters_model HOT 2
- Figure legend in check predictions
- Error in model_parameters.aov plot() method? HOT 2
- Error in plot method with `describe_distribution()` HOT 1
- Plot method for `data_tabulate()`? HOT 2
- Improve plot() for check_predictions() HOT 11
- show_intercept = FALSE doesn't work for brms ordinal models HOT 5
- Relicensing `{see}` HOT 4
- Errors retrieving models when stan_glm is run inside a function
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from see.