diff --git a/docs/404.html b/docs/404.html index cfe23ba..4170c41 100644 --- a/docs/404.html +++ b/docs/404.html @@ -73,7 +73,7 @@
diff --git a/docs/authors.html b/docs/authors.html index 8b7a9e6..bf96f52 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -73,7 +73,7 @@ diff --git a/docs/index.html b/docs/index.html index 60b5a5d..2820a0a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -39,7 +39,7 @@ @@ -120,7 +120,9 @@anova_test()
: an easy-to-use wrapper around car::Anova()
to perform different types of ANOVA tests, including independent measures ANOVA, repeated measures ANOVA and mixed ANOVA.get_anova_test_table()
: extract ANOVA table from anova_test()
results. Can apply sphericity correction automatically in the case of within-subject (repeated measures) designs. - welch_anova_test()
: Welch one-Way ANOVA test. A pipe-friendly wrapper around the base function stats::oneway.test()
. This is is an alternative to the standard one-way ANOVA in the situation where the homogeneity of variance assumption is violated.get_anova_test_table()
: extract ANOVA table from anova_test()
results. Can apply sphericity correction automatically in the case of within-subject (repeated measures) designs.
+welch_anova_test()
: Welch one-Way ANOVA test. A pipe-friendly wrapper around the base function stats::oneway.test()
. This is is an alternative to the standard one-way ANOVA in the situation where the homogeneity of variance assumption is violated.kruskal_test()
: perform kruskal-wallis rank sum testget_comparisons()
: Create a list of possible pairwise comparisons between groups.get_pvalue_position
: autocompute p-value positions for plotting significance using ggplot2.get_pvalue_position()
: autocompute p-value positions for plotting significance using ggplot2.
if(!require(devtools)) install.packages("devtools") -devtools::install_github("kassambara/rstatix")
NEWS.md
+ cor_plot()
now accepts additional arguments to pass to corrplot() (#66)car::Anova()
.get_comparisons()
now drops unused levels before creating possible comparisons (#67)get_summary_stats()
keeps the order of columns specified by the user (#46).two_sample_test()
now counts group sizes (n1
and n2
) by the number of non-NA
values #104
+shapiro_test()
function. Shapiro_test() throws an error if the input data contains column names “value” or “variable”. This is fixed now (#52).cor_test()
function, where there was a tidy evaluation conflict when the input data contains “x” and “y” as column names (#68).dunn_test()
documentation is updated to describe the discrepancy between the default behavior of the rstatix::dunn_test()
compared to other packages (dunn.test
and jamovi
). The default of the rstatix::dunn_test() function is to perform a two-sided Dunn test like the well known commercial softwares, such as SPSS and GraphPad. This is not the case for some other R packages (dunn.test and jamovi), where the default is to perform one-sided test (#50).get_summary_stats()
handles the user defined probabilities for grouped data (#78)add_x_position()
to better support different situations (#73).add_x_position()
to better support different situations (#73).dunn_test()
include estimate1
and estimate2
when the argument detailed = TRUE
is specified. The estimate1
and estimate2
values represent the mean rank values of the two groups being compared, respectively (#59).cor_spread()
doc updated, error is explicitly shown if the input data doesn’t contain the columns “var1”, “var2” and “cor” (#95)scales
added in the function get_y_position()
. If the specified value is “free” or “free_y”, then the step increase of y positions will be calculated by plot panels. Note that, using “free” or “free_y” gives the same result. A global step increase is computed when scales = “fixed” (#56).anova_test()
computes now repeated measures ANOVA without error when unused columns are present in the input data frame (#55)stack
added in get_y_position()
to compute p-values y position for stacked bar plots (#48).wilcox_test()
: Now, if detailed = TRUE
, an estimate of the location parameter (Only present if argument detailed = TRUE). This corresponds to the pseudomedian (for one-sample case) or to the difference of the location parameter (for two-samples case) (#45).
anova_test()
function: Changing R default contrast setting (contr.treatment
) into orthogonal contrasts (contr.sum
) to have comparable results to SPSS when users define the model using formula (@benediktclaus, #40).rstatix
and the ggpubr
package and makes it easy to program with tidyverse packages using non standard evaluation. - df_select - df_arrange - df_group_by - df_nest_by - df_split_by - df_unite - df_get_var_names - df_label_both - df_label_valuefreq_table()
the option na.rm
removes only missing values in the variables used to create the frequency table (@JuhlinF, #25).anova_test()
(@benediktclaus, #31)games_howell_test()
function : the t-statistic is now calculated using the absolute mean difference between groups (@GegznaV, #37).cohens_d()
function now supports Hedge’s correction. New argument hedge.correction
added . logical indicating whether apply the Hedges correction by multiplying the usual value of Cohen’s d by (N-3)/(N-2.25)
(for unpaired t-test) and by (n1-2)/(n1-1.25)
for paired t-test; where N is the total size of the two groups being compared (N = n1 + n2) (@IndrajeetPatil, #9).cohens_d()
outputs values with directionality. The absolute value is no longer returned. It can now be positive or negative depending on the data (@narunpat, #9).mu
is now considered when calculating cohens_d()
for one sample t-test (@mllewis, #22).tukey_hsd()
now handles situation where minus -
symbols are present in factor levels (@IndrajeetPatil, #19).identify_outliers
returns a basic data frame instead of tibble when nrow = 0 (for nice printing)prop_trend_test()
: Performs chi-squared test for trend in proportion. This test is also known as Cochran-Armitage trend test.
get_test_label()
and get_pwc_label()
return expression by defaultget_anova_table()
supports now an object of class grouped_anova_test
@@ -323,9 +352,9 @@ emmeans_test()
added for pairwise comparisons of estimated marginal means.comparison
removed from tukey_hsd()
results (breaking change).n
(sample count) added to statistical tests results: t_test()
, wilcox_test()
, sign_test()
, dunn_test()
and kruskal_test()
(@ShixiangWang, #4).adjust_pvalue()
now supports grouped data
detailed
arguments correctly propagated when grouped stats are performedsign_test()
added.get_summary_stats()
now supports type = “min”, “max”, “mean” or “median”cohens_d()
is now a data frame containing the Cohen’s d and the magnitude.detatiled
is now passed to compare_pairs()
.# Perform pairwise comparisons and adjust p-values ToothGrowth %>% t_test(len ~ dose) %>% - adjust_pvalue()#> # A tibble: 3 x 10 + adjust_pvalue()#> # A tibble: 3 x 10 #> .y. group1 group2 n1 n2 statistic df p p.adj p.adj.signif -#> <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <dbl> <chr> -#> 1 len 0.5 1 20 20 -6.48 38.0 1.27e- 7 2.54e- 7 **** -#> 2 len 0.5 2 20 20 -11.8 36.9 4.40e-14 1.32e-13 **** -#> 3 len 1 2 20 20 -4.90 37.1 1.91e- 5 1.91e- 5 ****+#> * <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <dbl> <chr> +#> 1 len 0.5 1 20 20 -6.48 38.0 1.27e- 7 2.54e- 7 **** +#> 2 len 0.5 2 20 20 -11.8 36.9 4.4 e-14 1.32e-13 **** +#> 3 len 1 2 20 20 -4.90 37.1 1.91e- 5 1.91e- 5 ****
+#> <dbl> <dbl> <dbl> <chr> +#> 1 141. 3.35e-20 20 Box's M-test for Homogeneity of Covariance Matri…#> # A tibble: 1 x 4 +box_m(iris[, -5], iris[, 5])#> # A tibble: 1 x 4 #> statistic p.value parameter method -#> <dbl> <dbl> <dbl> <chr> -#> 1 141. 3.35e-20 20 Box's M-test for Homogeneity of Covariance Matri…
+#> * <chr> <chr> <chr> <dbl> <int> <int> <ord> +#> 1 value post pre 1.75 5 5 large diff --git a/docs/reference/cor_mark_significant.html b/docs/reference/cor_mark_significant.html index 25414c6..4d664e2 100644 --- a/docs/reference/cor_mark_significant.html +++ b/docs/reference/cor_mark_significant.html @@ -75,7 +75,7 @@ diff --git a/docs/reference/cor_mat-1.png b/docs/reference/cor_mat-1.png index 5ca8caf..dadb1d4 100644 Binary files a/docs/reference/cor_mat-1.png and b/docs/reference/cor_mat-1.png differ diff --git a/docs/reference/cor_mat.html b/docs/reference/cor_mat.html index 77eb518..522c3ad 100644 --- a/docs/reference/cor_mat.html +++ b/docs/reference/cor_mat.html @@ -76,7 +76,7 @@ @@ -201,7 +201,7 @@# One-sample t test effect size -ToothGrowth %>% cohens_d(len ~ 1, mu = 0)#> # A tibble: 1 x 6 +ToothGrowth %>% cohens_d(len ~ 1, mu = 0)#> # A tibble: 1 x 6 #> .y. group1 group2 effsize n magnitude -#> * <chr> <chr> <chr> <dbl> <int> <ord> -#> 1 len 1 null model 2.46 60 large+#> * <chr> <chr> <chr> <dbl> <int> <ord> +#> 1 len 1 null model 2.46 60 large# Two indepedent samples t-test effect size -ToothGrowth %>% cohens_d(len ~ supp, var.equal = TRUE)#> # A tibble: 1 x 7 +ToothGrowth %>% cohens_d(len ~ supp, var.equal = TRUE)#> # A tibble: 1 x 7 #> .y. group1 group2 effsize n1 n2 magnitude -#> * <chr> <chr> <chr> <dbl> <int> <int> <ord> -#> 1 len OJ VC 0.495 30 30 small+#> * <chr> <chr> <chr> <dbl> <int> <int> <ord> +#> 1 len OJ VC 0.495 30 30 small# Paired samples effect size df <- data.frame( id = 1:5, @@ -290,10 +290,10 @@Examp #> 4 4 pre 120 #> 5 5 pre 140 #> 6 1 post 150
-df %>% cohens_d(value ~ treatment, paired = TRUE)#> # A tibble: 1 x 7 +df %>% cohens_d(value ~ treatment, paired = TRUE)#> # A tibble: 1 x 7 #> .y. group1 group2 effsize n1 n2 magnitude -#> * <chr> <chr> <chr> <dbl> <int> <int> <ord> -#> 1 value post pre 1.75 5 5 large
cor_pmat
: compute the correlation matrix but returns only the p-values of the tests.
cor_get_pval
: extract a correlation matrix p-values from an object of
-class cor_mat()
.
cor_mat()
. P-values are not adjusted.
font.label
= list(size = 1, color = "black", style = "bold")
.
+ additional options not listed (i.e. "tl.cex") here to pass to corrplot.
diff --git a/docs/reference/df_split_by.html b/docs/reference/df_split_by.html index f8d44f0..f475e53 100644 --- a/docs/reference/df_split_by.html +++ b/docs/reference/df_split_by.html @@ -77,7 +77,7 @@ @@ -188,118 +188,118 @@# Non standard evaluation ToothGrowth %>% - df_nest_by(dose, supp)#> # A tibble: 6 x 3 + df_nest_by(dose, supp)#> # A tibble: 6 x 3 #> supp dose data -#> <fct> <dbl> <list> -#> 1 VC 0.5 <tibble [10 × 1]> -#> 2 VC 1 <tibble [10 × 1]> -#> 3 VC 2 <tibble [10 × 1]> -#> 4 OJ 0.5 <tibble [10 × 1]> -#> 5 OJ 1 <tibble [10 × 1]> -#> 6 OJ 2 <tibble [10 × 1]>+#> <fct> <dbl> <list> +#> 1 VC 0.5 <tibble [10 × 1]> +#> 2 VC 1 <tibble [10 × 1]> +#> 3 VC 2 <tibble [10 × 1]> +#> 4 OJ 0.5 <tibble [10 × 1]> +#> 5 OJ 1 <tibble [10 × 1]> +#> 6 OJ 2 <tibble [10 × 1]>#> # A tibble: 6 x 3 #> supp dose data -#> <fct> <dbl> <list> -#> 1 VC 0.5 <tibble [10 × 1]> -#> 2 VC 1 <tibble [10 × 1]> -#> 3 VC 2 <tibble [10 × 1]> -#> 4 OJ 0.5 <tibble [10 × 1]> -#> 5 OJ 1 <tibble [10 × 1]> -#> 6 OJ 2 <tibble [10 × 1]>+#> <fct> <dbl> <list> +#> 1 VC 0.5 <tibble [10 × 1]> +#> 2 VC 1 <tibble [10 × 1]> +#> 3 VC 2 <tibble [10 × 1]> +#> 4 OJ 0.5 <tibble [10 × 1]> +#> 5 OJ 1 <tibble [10 × 1]> +#> 6 OJ 2 <tibble [10 × 1]>
Performs Dunn's test for pairwise multiple comparisons of the ranked data. The mean rank of the different groups is compared. Used for post-hoc test following Kruskal-Wallis test.
+The default of the rstatix::dunn_test()
function is to perform a
+ two-sided Dunn test like the well known commercial softwares, such as SPSS
+ and GraphPad. This is not the case for some other R packages
+ (dunn.test
and jamovi
), where the default is to perform
+ one-sided test. This discrepancy is documented at
+ https://github.com/kassambara/rstatix/issues/50.
dunn_test(data, formula, p.adjust.method = "holm", detailed = FALSE)@@ -163,15 +175,17 @@
group1,group2
: the compared groups in the pairwise tests.
n1,n2
: Sample counts.
estimate
: mean ranks difference.
estimate1, estimate2
: show the mean rank values of
- the two groups, respectively.
statistic
: Test statistic (z-value) used to compute the
- p-value.
estimate1, estimate2
: show the mean rank values of the two
+ groups, respectively.
statistic
: Test statistic (z-value) used
+ to compute the p-value.
p
: p-value.
p.adj
: the adjusted p-value.
method
: the statistical test used to compare groups.
p.signif, p.adj.signif
: the significance level of p-values and
- adjusted p-values, respectively.
p.adj
: the
+ adjusted p-value.
method
: the statistical test used to compare
+ groups.
p.signif, p.adj.signif
: the significance level of
+ p-values and adjusted p-values, respectively.
The returned object has an attribute called args, which is a list @@ -193,24 +207,24 @@
+#> * <fct> <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr> +#> 1 OJ len 0.5 1 10 10 2.83 4.59e-3 9.18e-3 ** +#> 2 OJ len 0.5 2 10 10 4.22 2.45e-5 7.34e-5 **** +#> 3 OJ len 1 2 10 10 1.39 1.66e-1 1.66e-1 ns +#> 4 VC len 0.5 1 10 10 2.62 8.87e-3 1.77e-2 * +#> 5 VC len 0.5 2 10 10 5.01 5.57e-7 1.67e-6 **** +#> 6 VC len 1 2 10 10 2.39 1.69e-2 1.77e-2 * @@ -246,39 +246,39 @@# Simple test -ToothGrowth %>% dunn_test(len ~ dose)#> # A tibble: 3 x 9 +ToothGrowth %>% dunn_test(len ~ dose)#> # A tibble: 3 x 9 #> .y. group1 group2 n1 n2 statistic p p.adj p.adj.signif -#> * <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr> -#> 1 len 0.5 1 20 20 3.55 3.78e- 4 7.56e- 4 *** -#> 2 len 0.5 2 20 20 6.36 1.98e-10 5.95e-10 **** -#> 3 len 1 2 20 20 2.81 4.99e- 3 4.99e- 3 **+#> * <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr> +#> 1 len 0.5 1 20 20 3.55 3.78e- 4 7.56e- 4 *** +#> 2 len 0.5 2 20 20 6.36 1.98e-10 5.95e-10 **** +#> 3 len 1 2 20 20 2.81 4.99e- 3 4.99e- 3 **#> # A tibble: 6 x 10 + dunn_test(len ~ dose)#> # A tibble: 6 x 10 #> supp .y. group1 group2 n1 n2 statistic p p.adj p.adj.signif -#> * <fct> <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr> -#> 1 OJ len 0.5 1 10 10 2.83 4.59e-3 9.18e-3 ** -#> 2 OJ len 0.5 2 10 10 4.22 2.45e-5 7.34e-5 **** -#> 3 OJ len 1 2 10 10 1.39 1.66e-1 1.66e-1 ns -#> 4 VC len 0.5 1 10 10 2.62 8.87e-3 1.77e-2 * -#> 5 VC len 0.5 2 10 10 5.01 5.57e-7 1.67e-6 **** -#> 6 VC len 1 2 10 10 2.39 1.69e-2 1.77e-2 *
+#> <fct> <dbl> <int> <dbl> +#> 1 OJ 0.5 10 33.3 +#> 2 OJ 1 10 33.3 +#> 3 OJ 2 10 33.3 +#> 4 VC 0.5 10 33.3 +#> 5 VC 1 10 33.3 +#> 6 VC 2 10 33.3 @@ -221,10 +221,10 @@#> # A tibble: 6 x 4 +ToothGrowth %>% freq_table(supp, dose)#> # A tibble: 6 x 4 #> supp dose n prop -#> <fct> <dbl> <int> <dbl> -#> 1 OJ 0.5 10 33.3 -#> 2 OJ 1 10 33.3 -#> 3 OJ 2 10 33.3 -#> 4 VC 0.5 10 33.3 -#> 5 VC 1 10 33.3 -#> 6 VC 2 10 33.3
diff --git a/docs/reference/get_mode.html b/docs/reference/get_mode.html index 294be30..8b9f22a 100644 --- a/docs/reference/get_mode.html +++ b/docs/reference/get_mode.html @@ -75,7 +75,7 @@ diff --git a/docs/reference/get_pvalue_position-1.png b/docs/reference/get_pvalue_position-1.png index 8491b7e..df137cb 100644 Binary files a/docs/reference/get_pvalue_position-1.png and b/docs/reference/get_pvalue_position-1.png differ diff --git a/docs/reference/get_pvalue_position.html b/docs/reference/get_pvalue_position.html index b109f30..b30043f 100644 --- a/docs/reference/get_pvalue_position.html +++ b/docs/reference/get_pvalue_position.html @@ -83,7 +83,7 @@ @@ -308,12 +308,12 @@# Simple test -ToothGrowth %>% games_howell_test(len ~ dose)#> # A tibble: 3 x 8 +ToothGrowth %>% games_howell_test(len ~ dose)#> # A tibble: 3 x 8 #> .y. group1 group2 estimate conf.low conf.high p.adj p.adj.signif -#> * <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <chr> -#> 1 len 0.5 1 9.13 5.69 12.6 0.000000376 **** -#> 2 len 0.5 2 15.5 12.3 18.7 0 **** -#> 3 len 1 2 6.37 3.19 9.54 0.0000557 ****+#> * <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <chr> +#> 1 len 0.5 1 9.13 5.69 12.6 0.000000376 **** +#> 2 len 0.5 2 15.5 12.3 18.7 0 **** +#> 3 len 1 2 6.37 3.19 9.54 0.0000557 ****#> # A tibble: 6 x 9 + games_howell_test(len ~ dose)#> # A tibble: 6 x 9 #> supp .y. group1 group2 estimate conf.low conf.high p.adj p.adj.signif -#> * <fct> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <chr> -#> 1 OJ len 0.5 1 9.47 4.68 14.3 0.000247 *** -#> 2 OJ len 0.5 2 12.8 8.56 17.1 0.00000376 **** -#> 3 OJ len 1 2 3.36 -0.501 7.22 0.094 ns -#> 4 VC len 0.5 1 8.79 5.78 11.8 0.00000196 **** -#> 5 VC len 0.5 2 18.2 13.6 22.7 0.000000134 **** -#> 6 VC len 1 2 9.37 4.87 13.9 0.000253 ***+#> * <fct> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <chr> +#> 1 OJ len 0.5 1 9.47 4.68 14.3 0.000247 *** +#> 2 OJ len 0.5 2 12.8 8.56 17.1 0.00000376 **** +#> 3 OJ len 1 2 3.36 -0.501 7.22 0.094 ns +#> 4 VC len 0.5 1 8.79 5.78 11.8 0.00000196 **** +#> 5 VC len 0.5 2 18.2 13.6 22.7 0.000000134 **** +#> 6 VC len 1 2 9.37 4.87 13.9 0.000253 ***
@@ -258,10 +258,12 @@#> # A tibble: 1 x 13 +ToothGrowth %>% get_summary_stats(len)#> # A tibble: 1 x 13 #> variable n min max median q1 q3 iqr mad mean sd se -#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> -#> 1 len 60 4.2 33.9 19.2 13.1 25.3 12.2 9.04 18.8 7.65 0.988 -#> # … with 1 more variable: ci <dbl>+#> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> +#> 1 len 60 4.2 33.9 19.2 13.1 25.3 12.2 9.04 18.8 7.65 0.988 +#> # … with 1 more variable: ci <dbl># Summary statistics of grouped data # Show only common summary ToothGrowth %>% group_by(dose, supp) %>% - get_summary_stats(len, type = "common")#> # A tibble: 6 x 12 + get_summary_stats(len, type = "common")#> # A tibble: 6 x 12 #> supp dose variable n min max median iqr mean sd se ci -#> <fct> <dbl> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> -#> 1 OJ 0.5 len 10 8.2 21.5 12.2 6.48 13.2 4.46 1.41 3.19 -#> 2 VC 0.5 len 10 4.2 11.5 7.15 4.95 7.98 2.75 0.869 1.96 -#> 3 OJ 1 len 10 14.5 27.3 23.4 5.35 22.7 3.91 1.24 2.80 -#> 4 VC 1 len 10 13.6 22.5 16.5 2.02 16.8 2.52 0.795 1.80 -#> 5 OJ 2 len 10 22.4 30.9 26.0 2.5 26.1 2.66 0.84 1.90 -#> 6 VC 2 len 10 18.5 33.9 26.0 5.42 26.1 4.80 1.52 3.43+#> <fct> <dbl> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> +#> 1 OJ 0.5 len 10 8.2 21.5 12.2 6.48 13.2 4.46 1.41 3.19 +#> 2 VC 0.5 len 10 4.2 11.5 7.15 4.95 7.98 2.75 0.869 1.96 +#> 3 OJ 1 len 10 14.5 27.3 23.4 5.35 22.7 3.91 1.24 2.80 +#> 4 VC 1 len 10 13.6 22.5 16.5 2.02 16.8 2.52 0.795 1.80 +#> 5 OJ 2 len 10 22.4 30.9 26.0 2.5 26.1 2.66 0.84 1.90 +#> 6 VC 2 len 10 18.5 33.9 26.0 5.42 26.1 4.80 1.52 3.43# Robust summary statistics -ToothGrowth %>% get_summary_stats(len, type = "robust")#> # A tibble: 1 x 4 +ToothGrowth %>% get_summary_stats(len, type = "robust")#> # A tibble: 1 x 4 #> variable n median iqr -#> <chr> <dbl> <dbl> <dbl> -#> 1 len 60 19.2 12.2+#> <fct> <dbl> <dbl> <dbl> +#> 1 len 60 19.2 12.2# Five number summary statistics -ToothGrowth %>% get_summary_stats(len, type = "five_number")#> # A tibble: 1 x 7 +ToothGrowth %>% get_summary_stats(len, type = "five_number")#> # A tibble: 1 x 7 #> variable n min max q1 median q3 -#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> -#> 1 len 60 4.2 33.9 13.1 19.2 25.3+#> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> +#> 1 len 60 4.2 33.9 13.1 19.2 25.3# Compute only mean and sd -ToothGrowth %>% get_summary_stats(len, type = "mean_sd")#> # A tibble: 1 x 4 +ToothGrowth %>% get_summary_stats(len, type = "mean_sd")#> # A tibble: 1 x 4 #> variable n mean sd -#> <chr> <dbl> <dbl> <dbl> -#> 1 len 60 18.8 7.65+#> <fct> <dbl> <dbl> <dbl> +#> 1 len 60 18.8 7.65# Compute full summary statistics but show only mean, sd, median, iqr ToothGrowth %>% - get_summary_stats(len, show = c("mean", "sd", "median", "iqr"))#> # A tibble: 1 x 6 #> variable n mean sd median iqr -#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> -#> 1 len 60 18.8 7.65 19.2 12.2+#> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> +#> 1 len 60 18.8 7.65 19.2 12.2
diff --git a/docs/reference/mcnemar_test.html b/docs/reference/mcnemar_test.html index 53b92d9..27aa9db 100644 --- a/docs/reference/mcnemar_test.html +++ b/docs/reference/mcnemar_test.html @@ -76,7 +76,7 @@ @@ -222,10 +222,10 @@#> # A tibble: 150 x 6 #> Sepal.Length Sepal.Width Petal.Length Petal.Width mahal.dist is.outlier -#> <dbl> <dbl> <dbl> <dbl> <dbl> <lgl> -#> 1 5.1 3.5 1.4 0.2 2.13 FALSE -#> 2 4.9 3 1.4 0.2 2.85 FALSE -#> 3 4.7 3.2 1.3 0.2 2.08 FALSE -#> 4 4.6 3.1 1.5 0.2 2.45 FALSE -#> 5 5 3.6 1.4 0.2 2.46 FALSE -#> 6 5.4 3.9 1.7 0.4 3.88 FALSE -#> 7 4.6 3.4 1.4 0.3 2.86 FALSE -#> 8 5 3.4 1.5 0.2 1.83 FALSE -#> 9 4.4 2.9 1.4 0.2 3.38 FALSE -#> 10 4.9 3.1 1.5 0.1 2.38 FALSE -#> # … with 140 more rows+#> <dbl> <dbl> <dbl> <dbl> <dbl> <lgl> +#> 1 5.1 3.5 1.4 0.2 2.13 FALSE +#> 2 4.9 3 1.4 0.2 2.85 FALSE +#> 3 4.7 3.2 1.3 0.2 2.08 FALSE +#> 4 4.6 3.1 1.5 0.2 2.45 FALSE +#> 5 5 3.6 1.4 0.2 2.46 FALSE +#> 6 5.4 3.9 1.7 0.4 3.88 FALSE +#> 7 4.6 3.4 1.4 0.3 2.86 FALSE +#> 8 5 3.4 1.5 0.2 1.83 FALSE +#> 9 4.4 2.9 1.4 0.2 3.38 FALSE +#> 10 4.9 3.1 1.5 0.1 2.38 FALSE +#> # … with 140 more rows# Compute distance by groups and filter outliers iris %>% group_by(Species) %>% doo(~mahalanobis_distance(.)) %>% - filter(is.outlier == TRUE)#> # A tibble: 0 x 7 -#> # … with 7 variables: Species <fct>, Sepal.Length <dbl>, Sepal.Width <dbl>, -#> # Petal.Length <dbl>, Petal.Width <dbl>, mahal.dist <dbl>, is.outlier <lgl>#> # A tibble: 0 x 7 +#> # … with 7 variables: Species <fct>, Sepal.Length <dbl>, Sepal.Width <dbl>, +#> # Petal.Length <dbl>, Petal.Width <dbl>, mahal.dist <dbl>, is.outlier <lgl>
+#> * <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> +#> 1 1st 2201 121. 1 3.4 e-28 1.02e-27 **** +#> 2 2nd 2201 47.8 1 4.65e-12 9.3 e-12 **** +#> 3 3rd 2201 24.9 1 6.18e- 7 6.18e- 7 **** +#> 4 Crew 2201 308. 1 5.51e-69 2.2 e-68 **** @@ -178,10 +178,10 @@# Comparing an observed proportion to an expected proportion #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -prop_test(x = 95, n = 160, p = 0.5, detailed = TRUE)#> # A tibble: 1 x 11 -#> n n1 estimate statistic p df conf.low conf.high method -#> * <dbl> <dbl> <dbl> <dbl> <dbl> <int> <dbl> <dbl> <chr> -#> 1 160 95 0.594 5.26 0.0219 1 0.513 0.670 Prop … -#> # … with 2 more variables: alternative <chr>, p.signif <chr>+prop_test(x = 95, n = 160, p = 0.5, detailed = TRUE)#> # A tibble: 1 x 11 +#> n n1 estimate statistic p df conf.low conf.high method +#> * <dbl> <dbl> <dbl> <dbl> <dbl> <int> <dbl> <dbl> <chr> +#> 1 160 95 0.594 5.26 0.0219 1 0.513 0.670 Prop test +#> # … with 2 more variables: alternative <chr>, p.signif <chr># Comparing two proportions #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # Data: frequencies of smokers between two groups @@ -274,12 +274,12 @@Examp #> group yes no #> grp1 490 10 #> grp2 400 100
# compare the proportion of smokers -prop_test(xtab, detailed = TRUE)#> # A tibble: 1 x 13 +prop_test(xtab, detailed = TRUE)#> # A tibble: 1 x 13 #> n n1 n2 estimate1 estimate2 statistic p df conf.low -#> * <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> -#> 1 1000 500 500 0.98 0.8 80.9 2.36e-19 1 0.141 -#> # … with 4 more variables: conf.high <dbl>, method <chr>, alternative <chr>, -#> # p.signif <chr>+#> * <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> +#> 1 1000 500 500 0.98 0.8 80.9 2.36e-19 1 0.141 +#> # … with 4 more variables: conf.high <dbl>, method <chr>, alternative <chr>, +#> # p.signif <chr># Homogeneity of proportions between groups #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # H0: the proportion of smokers is similar in the four groups @@ -302,22 +302,22 @@Examp #> Yes 50 100 139 80 #> No 56 13 17 22
# Compare the proportions of smokers between groups -prop_test(xtab, detailed = TRUE)#> # A tibble: 1 x 15 +prop_test(xtab, detailed = TRUE)#> # A tibble: 1 x 15 #> n n1 n2 n3 n4 estimate1 estimate2 estimate3 estimate4 -#> * <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> -#> 1 477 106 113 156 102 0.472 0.885 0.891 0.784 -#> # … with 6 more variables: statistic <dbl>, p <dbl>, df <dbl>, method <chr>, -#> # alternative <chr>, p.signif <chr>+#> * <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> +#> 1 477 106 113 156 102 0.472 0.885 0.891 0.784 +#> # … with 6 more variables: statistic <dbl>, p <dbl>, df <dbl>, method <chr>, +#> # alternative <chr>, p.signif <chr># Pairwise comparison between groups -pairwise_prop_test(xtab)#> # A tibble: 6 x 5 +pairwise_prop_test(xtab)#> # A tibble: 6 x 5 #> group1 group2 p p.adj p.adj.signif -#> * <chr> <chr> <dbl> <dbl> <chr> -#> 1 grp1 grp2 1.25e-10 6.23e-10 **** -#> 2 grp1 grp3 3.09e-13 1.86e-12 **** -#> 3 grp2 grp3 1.00e+ 0 1.00e+ 0 ns -#> 4 grp1 grp4 6.41e- 6 2.56e- 5 **** -#> 5 grp2 grp4 7.01e- 2 1.40e- 1 ns -#> 6 grp3 grp4 3.06e- 2 9.19e- 2 ns+#> * <chr> <chr> <dbl> <dbl> <chr> +#> 1 grp1 grp2 1.25e-10 6.23e-10 **** +#> 2 grp1 grp3 3.09e-13 1.86e-12 **** +#> 3 grp2 grp3 1 e+ 0 1 e+ 0 ns +#> 4 grp1 grp4 6.41e- 6 2.56e- 5 **** +#> 5 grp2 grp4 7.01e- 2 1.4 e- 1 ns +#> 6 grp3 grp4 3.06e- 2 9.19e- 2 ns# Pairwise proportion tests #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -334,15 +334,15 @@Examp #> Survived 1st 2nd 3rd Crew #> No 122 167 528 673 #> Yes 203 118 178 212
# Compare the proportion of survived between groups -pairwise_prop_test(xtab)#> # A tibble: 6 x 5 +pairwise_prop_test(xtab)#> # A tibble: 6 x 5 #> group1 group2 p p.adj p.adj.signif -#> * <chr> <chr> <dbl> <dbl> <chr> -#> 1 1st 2nd 3.13e- 7 9.38e- 7 **** -#> 2 1st 3rd 2.55e-30 1.27e-29 **** -#> 3 2nd 3rd 6.90e- 7 1.38e- 6 **** -#> 4 1st Crew 1.62e-35 9.73e-35 **** -#> 5 2nd Crew 1.94e- 8 7.75e- 8 **** -#> 6 3rd Crew 6.03e- 1 6.03e- 1 ns+#> * <chr> <chr> <dbl> <dbl> <chr> +#> 1 1st 2nd 3.13e- 7 9.38e- 7 **** +#> 2 1st 3rd 2.55e-30 1.27e-29 **** +#> 3 2nd 3rd 6.9 e- 7 1.38e- 6 **** +#> 4 1st Crew 1.62e-35 9.73e-35 **** +#> 5 2nd Crew 1.94e- 8 7.75e- 8 **** +#> 6 3rd Crew 6.03e- 1 6.03e- 1 ns# Row-wise proportion tests #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # Data: Titanic @@ -360,13 +360,13 @@Examp #> 2nd 179 106 #> 3rd 510 196 #> Crew 862 23
# Compare the proportion of males and females in each category -row_wise_prop_test(xtab)#> # A tibble: 4 x 7 +row_wise_prop_test(xtab)#> # A tibble: 4 x 7 #> group n statistic df p p.adj p.adj.signif -#> * <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> -#> 1 1st 2201 121. 1 3.40e-28 1.02e-27 **** -#> 2 2nd 2201 47.8 1 4.65e-12 9.30e-12 **** -#> 3 3rd 2201 24.9 1 6.18e- 7 6.18e- 7 **** -#> 4 Crew 2201 308. 1 5.51e-69 2.20e-68 ****
+#> <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr> +#> 1 weight trt1 trt2 10 10 16 0.009 0.027 * @@ -178,15 +178,15 @@# Statistical test stat.test <- PlantGrowth %>% wilcox_test(weight ~ group) # Remove ns: automatic detection of p-value columns -stat.test %>% remove_ns()#> # A tibble: 1 x 9 +stat.test %>% remove_ns()#> # A tibble: 1 x 9 #> .y. group1 group2 n1 n2 statistic p p.adj p.adj.signif -#> <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr> -#> 1 weight trt1 trt2 10 10 16 0.009 0.027 *# Remove ns by the column p -stat.test %>% remove_ns(col ="p")#> # A tibble: 1 x 9 +#> <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr> +#> 1 weight trt1 trt2 10 10 16 0.009 0.027 *# Remove ns by the column p +stat.test %>% remove_ns(col ="p")#> # A tibble: 1 x 9 #> .y. group1 group2 n1 n2 statistic p p.adj p.adj.signif -#> <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr> -#> 1 weight trt1 trt2 10 10 16 0.009 0.027 *
@@ -172,21 +172,21 @@ToothGrowth %>% sample_n_by(dose, supp, size = 2)#> # A tibble: 12 x 3 ++#> <dbl> <fct> <dbl> +#> 1 14.5 OJ 0.5 +#> 2 8.2 OJ 0.5 +#> 3 5.2 VC 0.5 +#> 4 7 VC 0.5 +#> 5 27.3 OJ 1 +#> 6 25.8 OJ 1 +#> 7 22.5 VC 1 +#> 8 13.6 VC 1 +#> 9 24.8 OJ 2 +#> 10 30.9 OJ 2 +#> 11 23.3 VC 2 +#> 12 18.5 VC 2ToothGrowth %>% sample_n_by(dose, supp, size = 2)#> # A tibble: 12 x 3 #> len supp dose -#> <dbl> <fct> <dbl> -#> 1 14.5 OJ 0.5 -#> 2 8.2 OJ 0.5 -#> 3 5.2 VC 0.5 -#> 4 7 VC 0.5 -#> 5 27.3 OJ 1 -#> 6 25.8 OJ 1 -#> 7 22.5 VC 1 -#> 8 13.6 VC 1 -#> 9 24.8 OJ 2 -#> 10 30.9 OJ 2 -#> 11 23.3 VC 2 -#> 12 18.5 VC 2
@@ -255,17 +255,17 @@# Shapiro Wilk normality test for one variable -iris %>% shapiro_test(Sepal.Length)#> # A tibble: 1 x 3 +iris %>% shapiro_test(Sepal.Length)#> # A tibble: 1 x 3 #> variable statistic p -#> <chr> <dbl> <dbl> -#> 1 Sepal.Length 0.976 0.0102+#> <chr> <dbl> <dbl> +#> 1 Sepal.Length 0.976 0.0102# Shapiro Wilk normality test for two variables -iris %>% shapiro_test(Sepal.Length, Petal.Width)#> # A tibble: 2 x 3 +iris %>% shapiro_test(Sepal.Length, Petal.Width)#> # A tibble: 2 x 3 #> variable statistic p -#> <chr> <dbl> <dbl> -#> 1 Petal.Width 0.902 0.0000000168 -#> 2 Sepal.Length 0.976 0.0102+#> <chr> <dbl> <dbl> +#> 1 Petal.Width 0.902 0.0000000168 +#> 2 Sepal.Length 0.976 0.0102# Multivariate normality test -mshapiro_test(iris[, 1:3])#> # A tibble: 1 x 2 +mshapiro_test(iris[, 1:3])#> # A tibble: 1 x 2 #> statistic p.value -#> <dbl> <dbl> -#> 1 0.991 0.443+#> <dbl> <dbl> +#> 1 0.991 0.443