介绍
在典型的探索性数据分析工作流程中,数据可视化和统计建模是两个不同的阶段:可视化技术为建模提供直观图形界面信息,而根据建模的结果又可以使用不同的可视化方法。 ggstatsplot包的中心思想是:将这两个阶段以具有统计细节的图形形式组合成一个阶段,这使得数据探索更加简单快捷。
功能模块
ggstatsplot包含众多的函数模块,其中主要在小提琴图、柱状图、散点图以及百分比图等可视化上。
Function | Plot | Description |
---|---|---|
ggbetweenstats |
violin plots | for comparisons between groups/conditions |
ggwithinstats |
violin plots | for comparisons within groups/conditions |
gghistostats |
histograms | for distribution about numeric variable |
ggdotplotstats |
dot plots/charts | for distribution about labeled numeric variable |
ggpiestats |
pie charts | for categorical data |
ggbarstats |
bar charts | for categorical data |
ggscatterstats |
scatterplots | for correlations between two variables |
ggcorrmat |
correlation matrices | for correlations between multiple variables |
ggcoefstats |
dot-and-whisker plots | for regression models and meta-analysis |
统计方法
支持的统计方法有:参数、非参数、贝叶斯、t-test、方差分析、相关分析和列联表等分析(parametric, nonparametric, robust, and bayesian versions of t-test/anova, correlation analyses, contingency table
analysis, meta-analysis, and regression analyses)。
Functions | Description | Parametric | Non-parametric | Robust | Bayes Factor |
---|---|---|---|---|---|
ggbetweenstats |
Between group/condition comparisons | Yes | Yes | Yes | Yes |
ggwithinstats |
Within group/condition comparisons | Yes | Yes | Yes | Yes |
gghistostats , ggdotplotstats |
Distribution of a numeric variable | Yes | Yes | Yes | Yes |
ggcorrmat |
Correlation matrix | Yes | Yes | Yes | Yes |
ggscatterstats |
Correlation between two variables | Yes | Yes | Yes | Yes |
ggpiestats , ggbarstats |
Association between categorical variables | Yes | NA |
NA |
Yes |
ggpiestats , ggbarstats |
Equal proportions for categorical variable levels | Yes | NA |
NA |
Yes |
ggcoefstats |
Regression model coefficients | Yes | Yes | Yes | Yes |
ggcoefstats |
Random-effects meta-analysis | Yes | No | Yes | Yes |
图形展示统计信息如下
安装
- 在window系统下,通过CRAN直接安装已完成版本;
1 | install.packages("ggstatsplot") |
- Linux下安装,需要安装较多的依赖包(centos 8);
1 | # ubuntu : sudo apt-get |
实例
ggbetweenstats
该函数可创建小提琴图,箱形图或两者的混合,并在图形中包含组间或条件间的统计检验的结果。
1 | set.seed(123) |
ggscatterstats
该函数可创建散点图并包含坐标分布的统计信息的图形。
1 | # for reproducibility |
ggpiestats
This function creates a pie chart for categorical or nominal variables with results from contingency table analysis (Pearson’s chi-squared test for between-subjects design and McNemar’s chi-squared test for within-subjects design) included in the subtitle of the plot
1 | # for reproducibility |
引用
参考文章如引起任何侵权问题,可以与我联系,谢谢。