##
## Error: Can’t combine name height
## Run rlang::last_error() to see where the error occurred.
## In addition: Warning message:
## In is.na(y) : is.na() applied to non-(list or vector) of type ‘language’
Place your data in the data argument
Welch Two Sample t-test
data: mass by gender
t = -2.8744, df = 2.7808, p-value = 0.06986
alternative hypothesis: true difference in means between group feminine and group masculine is not equal to 0
95 percent confidence interval:
-63.417398 4.648771
sample estimates:
mean in group feminine mean in group masculine
56.33333 85.71765
Use the _placeholder
Welch Two Sample t-test
data: mass by gender
t = -2.8744, df = 2.7808, p-value = 0.06986
alternative hypothesis: true difference in means between group feminine and group masculine is not equal to 0
95 percent confidence interval:
-63.417398 4.648771
sample estimates:
mean in group feminine mean in group masculine
56.33333 85.71765
data = argumentchisq.test() expects vectors or tables, not data frames.
Pearson's Chi-squared test
data: starwars$sex and starwars$gender
X-squared = 77.883, df = 3, p-value < 2.2e-16
Pearson's Chi-squared test
data: table(starwars$sex, starwars$gender)
X-squared = 77.883, df = 3, p-value < 2.2e-16
ggstatsplotAn extension of the ggplot2 package for creating graphics with details from statistical tests included in the information-rich plots themselves.
| ggstatsplot | ||||||
|---|---|---|---|---|---|---|
| Summary of of available plots and types of statistical analyses | ||||||
| Function | Plot | Description |
type =
|
|||
| parametric | nonparametric | robust | bayesian | |||
| ggbetweenstats | violin/box/dot plots | Between group/condition comparisons | Yes | Yes | Yes | Yes |
| ggwithinstats | violin/box/dot plots | Within group/condition comparisons | Yes | Yes | Yes | Yes |
| gghistostats | histograms | Distribution of a numeric variable | Yes | Yes | Yes | Yes |
| ggdotplotstats | dot plots/charts | Distribution about labeled numeric variable | Yes | Yes | Yes | Yes |
| ggscatterstats | scatterplots | Correlation between two variables | Yes | Yes | Yes | Yes |
| ggcorrmat | correlation matrices | Correlations between multiple variables | Yes | Yes | No | Yes |
| ggpiestats | pie charts | Categorical data | Yes | Yes | No | Yes |
| ggbarstats | bar charts | Categorical data | Yes | Yes | Yes | Yes |
| ggcoefstats | dot-and-whisker plots | Random-effects meta-analysis | Yes | No | Yes | Yes |
| Read more here: https://indrajeetpatil.github.io/ggstatsplot/index.html | ||||||
ggbetweenstats() - Between group/condition comparisonsggstatsplotThe output is a ggplot object that you can modify further
ggstatsplotChanging standardized effect size measure to Cohens D.
ggbetweenstats() - Between group/condition comparisonsggbetweenstats() - Between group/condition comparisonsggbarstats()ggbarstats()ggcormat() type = “parametric”ggcormat() type = “nonparametric”gtsummaryPublication-ready analytical and summary tables
Remember, gtsummary defaults to nonparametric descriptive statistics and tests.
See section Tables
rstatixProvides a simple and intuitive pipe-friendly framework, coherent with the ‘tidyverse’ design philosophy, for performing basic statistical tests, including t-test, Wilcoxon test, ANOVA, Kruskal-Wallis and correlation analyses.
Good if you know the test you want to apply.
https://rpkgs.datanovia.com/rstatix/
rstatix# A tibble: 1 × 6
.y. n statistic df p method
* <chr> <int> <dbl> <int> <dbl> <chr>
1 height 48 10.5 2 0.00519 Kruskal-Wallis
see more tests here: https://rpkgs.datanovia.com/rstatix/
rstatix# A tibble: 2 × 7
sex .y. n statistic df p method
* <chr> <chr> <int> <dbl> <int> <dbl> <chr>
1 Female heightcm 2056 122. 5 1.33e-24 Kruskal-Wallis
2 Male heightcm 4152 253. 6 7.62e-52 Kruskal-Wallis
see more tests here: https://rpkgs.datanovia.com/rstatix/
statsExpressionsA consistent syntax to do statistical analysis with tidy data (in pipe-friendly manner)
The Workhorse that produces the statistical estimates and expressions for ggstatsplot
https://indrajeetpatil.github.io/statsExpressions/
statsExpressionsone_sample_test()two_sample_test()oneway_anova()corr_test()contingency_table()type =statsExpressionstibble# A tibble: 1 × 18
parameter1 parameter2 mean.parameter1 mean.parameter2 statistic df.error
<chr> <chr> <dbl> <dbl> <dbl> <dbl>
1 height gender 164. 182. -3.93 7.81
p.value method alternative effectsize estimate conf.level
<dbl> <chr> <chr> <chr> <dbl> <dbl>
1 0.00460 Welch Two Sample t-test two.sided Hedges' g -1.66 0.95
conf.low conf.high conf.method conf.distribution n.obs expression
<dbl> <dbl> <chr> <chr> <int> <list>
1 -2.80 -0.478 ncp t 30 <language>
statsExpressionsexpression column contains the pre-formatted text with statistical details.list(italic("t")["Welch"] * "(" * 7.81 * ")" == "-3.93", italic(p) ==
"4.60e-03", widehat(italic("g"))["Hedges"] == "-1.66", CI["95%"] ~
"[" * "-2.80", "-0.48" * "]", italic("n")["obs"] == "30")
statsExpressionspull() or $
The stat$method gave us a p.value of stat |> pull(p.value)
Will translate to:
The Welch Two Sample t-test gave us a p.value of 0.004597
sharpiro_test from rstatix