Package {inferstat}


Type: Package
Title: Publication-Ready Inferential Statistics and Visualization
Version: 0.1.1
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>.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 8.0.0
Depends: R (≥ 4.2.0)
Imports: car, dplyr, ggplot2, rlang
Suggests: covr, testthat (≥ 3.0.0), knitr, rmarkdown
Config/testthat/edition: 3
URL: https://github.com/vinodhpmd/inferstat
BugReports: https://github.com/vinodhpmd/inferstat/issues
NeedsCompilation: no
Packaged: 2026-07-24 02:28:51 UTC; m
Author: Vinodh Kumar Obli Rajendran [aut, cre], Keerthi Aaradhana [aut]
Maintainer: Vinodh Kumar Obli Rajendran <vinodhkumar.rajendran@gmail.com>
Repository: CRAN
Date/Publication: 2026-08-04 09:40:14 UTC

One-way Analysis of Variance

Description

Performs a one-way Analysis of Variance (ANOVA) to compare the means of two or more independent groups.

Usage

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")
)

Arguments

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 "eta", "omega" or "none".

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 "fail" or "omit".

Details

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.

Value

An object of class "inferstat".

Examples

fit <- anova(
  data = iris,
  response = Sepal.Length,
  group = Species
)

summary(fit)


Check Statistical Assumptions Performs a comprehensive assessment of statistical assumptions.

Description

Check Statistical Assumptions Performs a comprehensive assessment of statistical assumptions.

Usage

check_assumptions(
  data,
  response,
  group = NULL,
  normality = TRUE,
  variance = TRUE,
  outliers = TRUE,
  alpha = 0.05,
  plot = TRUE,
  na_action = c("fail", "omit")
)

Arguments

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 "fail" or "omit".

Value

An object of class "inferstat" containing:

Examples

fit <- check_assumptions(
  data = iris,
  response = Sepal.Length,
  group = Species
)

fit
summary(fit)

Check Normality

Description

Performs the Shapiro-Wilk normality test for a numeric variable.

Usage

check_normality(
  data,
  response,
  method = c("shapiro"),
  alpha = 0.05,
  plot = TRUE,
  plot_type = c("qq", "histogram"),
  type = NULL,
  na_action = c("fail", "omit")
)

Arguments

data

A data frame.

response

Numeric response variable.

method

Currently only "shapiro".

alpha

Significance level.

plot

Logical.

plot_type

Character string specifying the diagnostic plot. One of "qq" or "histogram".

type

Deprecated alias for plot_type.

na_action

One of "fail" or "omit".

Value

An object of class "inferstat" containing:

Examples

fit <- check_normality(
  data = iris,
  response = Sepal.Length
)

fit
summary(fit)
plot(fit)

Check Outliers

Description

Detects potential outliers in a numeric variable using one of several commonly used statistical methods.

Usage

check_outliers(
  data,
  response,
  method = c("iqr", "zscore", "modified_zscore", "mad"),
  threshold = NULL,
  plot = TRUE,
  na_action = c("fail", "omit")
)

Arguments

data

A data frame.

response

Numeric response variable supplied using tidy evaluation.

method

One of "iqr", "zscore", "modified_zscore" or "mad".

threshold

Numeric threshold. If NULL, the default is used.

plot

Logical indicating whether a boxplot should be produced.

na_action

One of "fail" or "omit".

Details

Supported methods include:

Value

An object of class "inferstat" containing:


Check Homogeneity of Variance

Description

Performs a test for homogeneity of variance across groups.

Usage

check_variance(
  data,
  response,
  group,
  method = c("levene", "bartlett", "fligner"),
  alpha = 0.05,
  plot = TRUE,
  na_action = c("fail", "omit")
)

Arguments

data

A data frame.

response

Numeric response variable supplied using tidy evaluation.

group

Grouping variable supplied using tidy evaluation.

method

One of "levene", "bartlett" or "fligner".

alpha

Significance level.

plot

Logical indicating whether a diagnostic plot should be produced.

na_action

One of "fail" or "omit".

Details

Supported methods:

Value

An object of class "inferstat" containing:

Examples

fit <- check_variance(
  data = iris,
  response = Sepal.Length,
  group = Species
)

fit
summary(fit)
plot(fit)

Descriptive Statistics

Description

Computes publication-ready descriptive statistics.

Usage

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")
)

Arguments

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 "histogram", "density", "boxplot", "violin" or "qqplot".

theme

Optional ggplot2 theme.

na_action

One of "fail" or "omit".

Value

An object of class "inferstat" containing:

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.

Examples

fit <- describe(
  data = iris,
  response = Sepal.Length
)

fit
summary(fit)
plot(fit)


Student's t-test

Description

Performs an independent, Welch's or paired Student's t-test.

Usage

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")
)

Arguments

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.

Details

The function automatically returns publication-ready tables, effect sizes, confidence intervals and optional graphics.

Value

An object of class "inferstat".

Examples

iris2 <- subset(
  iris,
  Species != "virginica"
)

fit <- t_test(
  data = iris2,
  response = Sepal.Length,
  group = Species
)

print(fit)
summary(fit)
plot(fit)

Publication Theme for inferstat

Description

A clean, publication-quality ggplot2 theme designed for scientific manuscripts, journal articles, theses, and technical reports.

Usage

theme_publication(
  base_size = 14,
  base_family = "sans",
  base_line_size = 0.6,
  base_rect_size = 0.6
)

Arguments

base_size

Base font size.

base_family

Base font family.

base_line_size

Base line width.

base_rect_size

Base rectangle line width.

Details

The theme is based on ggplot2::theme_bw() with modifications to improve readability and produce publication-ready graphics.

Features include:

This is the default plotting theme used throughout the inferstat package.

Value

A ggplot2 theme.

See Also

ggplot2::theme_bw()

Examples

library(ggplot2)

ggplot(mtcars,
       aes(wt, mpg)) +
  geom_point() +
  theme_publication()