Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

🎨 Visualisation toolbox for beautiful and publication-ready figures

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
NotificationsYou must be signed in to change notification settings

easystats/see

Repository files navigation

DOIdownloadstotal

“Damned are those who believe without seeing”

easystats is a collection of packages that operate in synergy toprovide a consistent and intuitive syntax when working with statisticalmodels in the R programming language (R Core Team, 2021). Mosteasystats packages return comprehensive numeric summaries of modelparameters and performance. Thesee package complements these numericsummaries with a host of functions and tools to produce a range ofpublication-ready visualizations for model parameters, predictions, andperformance diagnostics. As a core pillar ofeasystats, theseepackage helps users to utilize visualization for more informative,communicable, and well-rounded scientific reporting.

Installation

CRANsee status badgeR-CMD-checkcodecov

Thesee package is available on CRAN, while its latest developmentversion is available on R-universe (fromrOpenSci).

TypeSourceCommand
ReleaseCRANinstall.packages("see")
Developmentr-universeinstall.packages("see", repos = "https://easystats.r-universe.dev")
DevelopmentGitHubremotes::install_github("easystats/see")

Once you have downloaded the package, you can then load it using:

library("see")

Tip

Instead oflibrary(see), uselibrary(easystats). This will makeall features of the easystats-ecosystem available.

To stay updated, useeasystats::install_latest().

Plotting functions for ‘easystats’ packages

DocumentationBlogFeatures

Below we present one or two plotting methods for eacheasystatspackage, but many other methods are available. Interested readers areencouraged to explore the range of examples on the packagewebsite.

Theparameters package converts summaries of regression model objectsinto data frames (Lüdecke et al., 2020). Thesee package can take thistransformed object and, for example, create a dot-and-whisker plot forthe extracted regression estimates simply by passing theparametersclass object toplot().

library(parameters)library(see)model<- lm(wt~am*cyl,data=mtcars)plot(parameters(model))

Assee outputs objects of classggplot,ggplot2 functions can beadded as layers to the plot the same as with all otherggplot2visualizations. For example, we might add a title usinglabs() fromggplot2.

library(parameters)library(see)model<- lm(wt~am*cyl,data=mtcars)plot(parameters(model))+ggplot2::labs(title="A Dot-and-Whisker Plot")

Plotting functions for theparameters package are demonstratedinthisvignette.

Similarly, for Bayesian regression model objects, which are handled bythebayestestR package (Makowski et al., 2019), thesee packageprovides special plotting methods relevant for Bayesian models (e.g.,Highest Density Interval, orHDI). Users can fit the model and passthe model results, extracted viabayestestR, toplot().

library(bayestestR)library(rstanarm)library(see)set.seed(123)model<- stan_glm(wt~mpg,data=mtcars,refresh=0)result<- hdi(model,ci= c(0.5,0.75,0.89,0.95))plot(result)

Plotting functions for thebayestestR package are demonstratedinthisvignette.

Theperformance package is primarily concerned with checkingregression model assumptions (Lüdecke et al., 2021). Thesee packageoffers tools to visualize these assumption checks, such as the normalityof residuals. Users simply pass the fit model object to the relevantperformance function (check_normality() in the example below). Then,this result can be passed toplot() to produce aggplot2visualization of the check on normality of the residuals.

library(performance)library(see)model<- lm(wt~mpg,data=mtcars)check<- check_normality(model)plot(check,type="qq")

Plotting functions for theperformance package are demonstratedinthisvignette.

Theeffectsize package computes a variety of effect size metrics forfitted models to assesses the practical importance of observed effects(Ben-Shachar et al., 2020). In conjunction withsee, users are able tovisualize the magnitude and uncertainty of effect sizes by passing themodel object to the relevanteffectsize function (omega_squared() inthe following example), and then toplot().

library(effectsize)library(see)model<- aov(wt~am*cyl,data=mtcars)plot(omega_squared(model))

Plotting functions for theeffectsize package are demonstratedinthisvignette.

Themodelbased package computes model-based estimates and predictionsfrom fitted models (Makowski et al., 2020a).see provides methods toquickly visualize these model predictions. For the following example towork, you need to have installed theemmeans package first.

library(modelbased)library(see)data(mtcars)mtcars$gear<- as.factor(mtcars$gear)model<- lm(mpg~wt*gear,data=mtcars)predicted<- estimate_expectation(model,data="grid")plot(predicted,show_data=TRUE)

One can also visualizemarginal means (i.e., the mean at each factorlevel averaged over other predictors) usingestimate_means(), that isthen passed toplot().

means<- estimate_means(model)plot(means)

Plotting functions for themodelbased package are demonstratedinthisvignette.

Thecorrelation package provides a unified syntax and human-readablecode to carry out many types of correlation analysis (Makowski et al.,2020b). A user can runsummary(correlation(data)) to create aconstruct a correlation matrix for the variables in a dataframe. Withsee, this matrix can be passed toplot() to visualize thesecorrelations in a correlation matrix.

library(correlation)library(see)results<- summary(correlation(iris))plot(results,show_data="points")

Plotting functions for thecorrelation package are demonstratedinthisvignette.

Themes

Modern

library(ggplot2)ggplot(iris, aes(x=Sepal.Width,y=Sepal.Length,color=Species))+  geom_point2()+  theme_modern()

Lucid

library(ggplot2)p<- ggplot(iris, aes(x=Sepal.Width,y=Sepal.Length,color=Species))+  geom_point2()p+ theme_lucid()

Blackboard

p+ theme_blackboard()

Abyss

p+ theme_abyss()

Palettes

This is just one example of the available palettes. Seethisvignettefor a detailed overview of palettes and color scales.

Material design

p1<- ggplot(iris, aes(x=Species,y=Sepal.Length,fill=Species))+  geom_boxplot()+  theme_modern(axis.text.angle=45)+  scale_fill_material_d()p2<- ggplot(iris, aes(x=Species,y=Sepal.Length,fill=Species))+  geom_violin()+  theme_modern(axis.text.angle=45)+  scale_fill_material_d(palette="ice")p3<- ggplot(iris, aes(x=Petal.Length,y=Petal.Width,color=Sepal.Length))+  geom_point2()+  theme_modern()+  scale_color_material(discrete=FALSE)

Multiple plots

Theplots() function allows us to plot the figures side by side.

plots(p1,p2,p3,n_columns=2)

Theplots() function can also be used to addtags (i.e., labelsfor subfigures).

plots(p1,p2,p3,n_columns=2,tags= paste("Fig.",1:3))

Geoms

Better looking points

geom_points2() andgeom_jitter2() allow points without borders andcontour.

normal<- ggplot(iris, aes(x=Petal.Width,y=Sepal.Length))+  geom_point(size=8,alpha=0.3)+  theme_modern()new<- ggplot(iris, aes(x=Petal.Width,y=Sepal.Length))+  geom_point2(size=8,alpha=0.3)+  theme_modern()plots(normal,new,n_columns=2)

Half-violin Half-dot plot

Create a half-violin half-dot plot, useful for visualising thedistribution and the sample size at the same time.

ggplot(iris, aes(x=Species,y=Sepal.Length,fill=Species))+  geom_violindot(fill_dots="black")+  theme_modern()+  scale_fill_material_d()

Radar chart (Spider plot)

library(datawizard)# prepare the data in tidy formatdata<-iris|>datawizard::data_group("Species")|>datawizard::data_summary(Sepal.Length= mean(Sepal.Length),Sepal.Width= mean(Sepal.Width),Petal.Length= mean(Petal.Length),Petal.Width= mean(Petal.Width)  )|>datawizard::reshape_longer(c("Sepal.Length","Sepal.Width","Petal.Length","Petal.Width"  ))data|>  ggplot(aes(x=name,y=value,color=Species,group=Species,fill=Species  ))+  geom_polygon(linewidth=1,alpha=0.1)+  coord_radar()+  theme_radar()

Contributing and Support

In case you want to file an issue or contribute in another way to thepackage, please followthisguide.For questions about the functionality, you may either contact us viaemail or also file an issue.

Code of Conduct

Please note that this project is released with aContributor Code ofConduct. Byparticipating in this project you agree to abide by its terms.

References

Ben-Shachar, M. S., Lüdecke, D., & Makowski, D. (2020).effectsize: Estimation of effect sizeindices and standardized parameters.Journal of Open Source Software,5(56), 2815.https://doi.org/10.21105/joss.02815

Lüdecke, D., Ben-Shachar, M. S., Patil, I., & Makowski, D. (2020).Extracting, computing and exploring the parameters of statistical modelsusing R.Journal of Open Source Software,5(53), 2445.https://doi.org/10.21105/joss.02445

Lüdecke, D., Ben-Shachar, M. S., Patil, I., Waggoner, P., & Makowski, D.(2021).performance: An R package forassessment, comparison and testing of statistical models.Journal ofOpen Source Software,6(60), 3139.https://doi.org/10.21105/joss.03139

Makowski, D., Ben-Shachar, M. S., & Lüdecke, D. (2019).bayestestR: Describing effects and theiruncertainty, existence and significance within the Bayesian framework.Journal of Open Source Software,4(40), 1541.https://doi.org/10.21105/joss.01541

Makowski, D., Ben-Shachar, M. S., Patil, I., & Lüdecke, D. (2020a).Estimation of model-based predictions, contrasts and means.CRAN.https://github.com/easystats/modelbased

Makowski, D., Ben-Shachar, M. S., Patil, I., & Lüdecke, D. (2020b).Methods and algorithms for correlation analysis in R.Journal of OpenSource Software,5(51), 2306.https://doi.org/10.21105/joss.02306

R Core Team. (2021).R: A language and environment for statisticalcomputing. R Foundation for Statistical Computing.https://www.R-project.org/


[8]ページ先頭

©2009-2025 Movatter.jp