| Title: | Publication-Ready Inferential Statistics and Visualization |
|---|---|
| Description: | Provides publication-ready tools for inferential statistical analyses, assumption checking, effect size estimation, statistical visualizations, and standardized reporting. Methods for assessing normality follow Shapiro and Wilk (1965) <doi:10.1093/biomet/52.3-4.591>, and guidance for standardized effect sizes is informed by Cohen (1988) <doi:10.4324/9780203771587>. |
| Authors: | Vinodh Kumar Obli Rajendran [aut, cre], Keerthi Aaradhana [aut] |
| Maintainer: | Vinodh Kumar Obli Rajendran <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.1 |
| Built: | 2026-10-04 09:48:36 UTC |
| Source: | https://github.com/cran/inferstat |
Performs a one-way Analysis of Variance (ANOVA) to compare the means of two or more independent groups.
anova( data, response, group, alpha = 0.05, conf.level = 0.95, effect_size = c("eta", "omega", "none"), posthoc = FALSE, plot = TRUE, theme = NULL, na_action = c("fail", "omit") )anova( data, response, group, alpha = 0.05, conf.level = 0.95, effect_size = c("eta", "omega", "none"), posthoc = FALSE, plot = TRUE, theme = NULL, na_action = c("fail", "omit") )
data |
A data frame. |
response |
Numeric response variable. |
group |
Grouping variable. |
alpha |
Significance level. Default is 0.05. |
conf.level |
Confidence level for Tukey HSD intervals. |
effect_size |
Effect size measure. One of
|
posthoc |
Logical indicating whether Tukey HSD should be performed. |
plot |
Logical indicating whether a boxplot should be produced. |
theme |
Optional ggplot theme. |
na_action |
One of |
The function returns an object of class "inferstat" containing the
ANOVA table, effect size, optional Tukey HSD post hoc comparisons,
interpretation, and publication-ready plot.
An object of class "inferstat".
fit <- anova( data = iris, response = Sepal.Length, group = Species ) summary(fit)fit <- anova( data = iris, response = Sepal.Length, group = Species ) summary(fit)
Check Statistical Assumptions Performs a comprehensive assessment of statistical assumptions.
check_assumptions( data, response, group = NULL, normality = TRUE, variance = TRUE, outliers = TRUE, alpha = 0.05, plot = TRUE, na_action = c("fail", "omit") )check_assumptions( data, response, group = NULL, normality = TRUE, variance = TRUE, outliers = TRUE, alpha = 0.05, plot = TRUE, na_action = c("fail", "omit") )
data |
A data frame. |
response |
Numeric response variable supplied using tidy evaluation. |
group |
Optional grouping variable. |
normality |
Logical indicating whether the normality test is performed. |
variance |
Logical indicating whether homogeneity of variance is tested. |
outliers |
Logical indicating whether outlier detection is performed. |
alpha |
Significance level. |
plot |
Logical indicating whether diagnostic plots are produced. |
na_action |
One of |
An object of class "inferstat" containing:
result — individual assumption test results.
table — combined summary table.
assumptions — overall assumption status.
figure — diagnostic plots.
interpretation — overall interpretation.
fit <- check_assumptions( data = iris, response = Sepal.Length, group = Species ) fit summary(fit)fit <- check_assumptions( data = iris, response = Sepal.Length, group = Species ) fit summary(fit)
Performs the Shapiro-Wilk normality test for a numeric variable.
check_normality( data, response, method = c("shapiro"), alpha = 0.05, plot = TRUE, plot_type = c("qq", "histogram"), type = NULL, na_action = c("fail", "omit") )check_normality( data, response, method = c("shapiro"), alpha = 0.05, plot = TRUE, plot_type = c("qq", "histogram"), type = NULL, na_action = c("fail", "omit") )
data |
A data frame. |
response |
Numeric response variable. |
method |
Currently only |
alpha |
Significance level. |
plot |
Logical. |
plot_type |
Character string specifying the diagnostic plot.
One of |
type |
Deprecated alias for |
na_action |
One of |
An object of class "inferstat" containing:
result — Shapiro-Wilk test results.
method — test name.
figure — optional diagnostic plot.
interpretation — interpretation of the test.
fit <- check_normality( data = iris, response = Sepal.Length ) fit summary(fit) plot(fit)fit <- check_normality( data = iris, response = Sepal.Length ) fit summary(fit) plot(fit)
Detects potential outliers in a numeric variable using one of several commonly used statistical methods.
check_outliers( data, response, method = c("iqr", "zscore", "modified_zscore", "mad"), threshold = NULL, plot = TRUE, na_action = c("fail", "omit") )check_outliers( data, response, method = c("iqr", "zscore", "modified_zscore", "mad"), threshold = NULL, plot = TRUE, na_action = c("fail", "omit") )
data |
A data frame. |
response |
Numeric response variable supplied using tidy evaluation. |
method |
One of |
threshold |
Numeric threshold. If |
plot |
Logical indicating whether a boxplot should be produced. |
na_action |
One of |
Supported methods include:
IQR Rule (default)
Z-score
Modified Z-score
MAD
An object of class "inferstat" containing:
result — summary table.
n_outliers — number of detected outliers.
outlier_index — indices of detected outliers.
outlier_values — detected outlier values.
figure — optional boxplot.
interpretation — interpretation of the results.
Performs a test for homogeneity of variance across groups.
check_variance( data, response, group, method = c("levene", "bartlett", "fligner"), alpha = 0.05, plot = TRUE, na_action = c("fail", "omit") )check_variance( data, response, group, method = c("levene", "bartlett", "fligner"), alpha = 0.05, plot = TRUE, na_action = c("fail", "omit") )
data |
A data frame. |
response |
Numeric response variable supplied using tidy evaluation. |
group |
Grouping variable supplied using tidy evaluation. |
method |
One of |
alpha |
Significance level. |
plot |
Logical indicating whether a diagnostic plot should be produced. |
na_action |
One of |
Supported methods:
Levene's Test (default)
Bartlett's Test
Fligner-Killeen Test
An object of class "inferstat" containing:
result — homogeneity of variance test results.
method — statistical method used.
figure — optional boxplot.
interpretation — interpretation of the test.
fit <- check_variance( data = iris, response = Sepal.Length, group = Species ) fit summary(fit) plot(fit)fit <- check_variance( data = iris, response = Sepal.Length, group = Species ) fit summary(fit) plot(fit)
Computes publication-ready descriptive statistics.
describe( data, response, group = NULL, conf.level = 0.95, plot = TRUE, plot_type = c("histogram", "density", "boxplot", "violin", "qqplot"), theme = NULL, na_action = c("fail", "omit") )describe( data, response, group = NULL, conf.level = 0.95, plot = TRUE, plot_type = c("histogram", "density", "boxplot", "violin", "qqplot"), theme = NULL, na_action = c("fail", "omit") )
data |
A data frame. |
response |
Numeric response variable supplied using tidy evaluation. |
group |
Optional grouping variable supplied using tidy evaluation. |
conf.level |
Confidence level. |
plot |
Logical indicating whether a figure should be produced. |
plot_type |
One of |
theme |
Optional ggplot2 theme. |
na_action |
One of |
An object of class "inferstat" containing:
result: a data frame containing the computed descriptive statistics.
method: a character string identifying the analysis method.
figure: a ggplot object when plotting is requested, otherwise NULL.
interpretation: a character string providing a summary interpretation
of the descriptive analysis.
The result component summarizes the distribution, central tendency,
variability, and confidence interval of the selected response variable,
either overall or by the specified grouping variable.
fit <- describe( data = iris, response = Sepal.Length ) fit summary(fit) plot(fit)fit <- describe( data = iris, response = Sepal.Length ) fit summary(fit) plot(fit)
Performs an independent, Welch's or paired Student's t-test.
t_test( data, response = NULL, group = NULL, x = NULL, y = NULL, paired = FALSE, var.equal = TRUE, alternative = c("two.sided", "less", "greater"), conf.level = 0.95, effect_size = c("cohen", "hedges", "glass", "none"), plot = TRUE, theme = NULL, na_action = c("fail", "omit") )t_test( data, response = NULL, group = NULL, x = NULL, y = NULL, paired = FALSE, var.equal = TRUE, alternative = c("two.sided", "less", "greater"), conf.level = 0.95, effect_size = c("cohen", "hedges", "glass", "none"), plot = TRUE, theme = NULL, na_action = c("fail", "omit") )
data |
A data frame. |
response |
Numeric response variable. |
group |
Grouping variable for independent samples. |
x |
First paired variable. |
y |
Second paired variable. |
paired |
Logical indicating whether a paired t-test should be performed. |
var.equal |
Logical indicating equal variances. |
alternative |
Alternative hypothesis. |
conf.level |
Confidence level. |
effect_size |
Effect-size measure. |
plot |
Logical. |
theme |
Optional ggplot theme. |
na_action |
Missing-value handling. |
The function automatically returns publication-ready tables, effect sizes, confidence intervals and optional graphics.
An object of class "inferstat".
iris2 <- subset( iris, Species != "virginica" ) fit <- t_test( data = iris2, response = Sepal.Length, group = Species ) print(fit) summary(fit) plot(fit)iris2 <- subset( iris, Species != "virginica" ) fit <- t_test( data = iris2, response = Sepal.Length, group = Species ) print(fit) summary(fit) plot(fit)
A clean, publication-quality ggplot2 theme designed for scientific manuscripts, journal articles, theses, and technical reports.
theme_publication( base_size = 14, base_family = "sans", base_line_size = 0.6, base_rect_size = 0.6 )theme_publication( base_size = 14, base_family = "sans", base_line_size = 0.6, base_rect_size = 0.6 )
base_size |
Base font size. |
base_family |
Base font family. |
base_line_size |
Base line width. |
base_rect_size |
Base rectangle line width. |
The theme is based on ggplot2::theme_bw() with modifications to
improve readability and produce publication-ready graphics.
Features include:
White background
No panel grid
Bold axis titles
Black axis text
Centered bold plot title
Centered subtitle
Bold legend title
Right-positioned legend
Styled facet strips
This is the default plotting theme used throughout the inferstat package.
A ggplot2 theme.
library(ggplot2) ggplot(mtcars, aes(wt, mpg)) + geom_point() + theme_publication()library(ggplot2) ggplot(mtcars, aes(wt, mpg)) + geom_point() + theme_publication()