Learn R Programming

TH 1.0.0: Educational Hypothesis Tests in R

The TH package provides educational functions for teaching and performing hypothesis tests in R. Each function combines numerical inference with an optional graphical representation of the hypotheses, significance level, critical values, rejection and non-rejection regions, calculated statistic, and decision.

Version 1.0.0 introduces a self-contained interface, input validation, p-values, structured invisible results, executable examples, automated tests, corrected statistical logic, and restoration of graphical parameters.

Installation

After publication on CRAN:

install.packages("TH")

From a source archive built locally:

install.packages("TH_1.0.0.tar.gz", repos = NULL, type = "source")
library(TH)

Available functions

FunctionProcedure
tz1()One-sample Z test
tz2()Two-sample Z test
tt1()One-sample t test
tt2i()Two-sample t test with equal variances
tt2d()Welch two-sample t test
tt2p()Paired t test
tf2()F test for two variances
tq2a()Chi-square goodness-of-fit test
tq2i()Chi-square test of independence
tq2h()Chi-square test of homogeneity

Basic example

X <- c(11, 12, 13, 12, 14, 13, 12, 15)
result <- tt1(X, mp = 10, alfa = 0.05, Ha = "greater", unidade = " units", plot = FALSE)
result

Numeric alternatives remain available for backward compatibility:

  • Ha = 1: "two.sided"
  • Ha = 2: "greater"
  • Ha = 3: "less"

The F test supports "two.sided" and "greater". The three chi-square procedures use the standard upper-tail omnibus test and therefore accept only Ha = 2 or Ha = "greater".

Documentation

help(package = "TH")
?tz1
browseVignettes("TH")
citation("TH")

Development checks

From the project root:

source("development/build_and_check.R")

The final CRAN archive must be generated by R CMD build and checked with R CMD check --as-cran on the resulting TH_1.0.0.tar.gz file.

Author

Willian Silva Barros
Federal University of Pelotas
Email: willian.barros@ufpel.edu.br

Copy Link

Version

Install

install.packages('TH')

Version

1.0.0

License

GPL (>= 3)

Maintainer

Willian Silva Barros

Last Published

August 6th, 2026

Functions in TH (1.0.0)

TH-package

TH: Hypothesis Tests in R
tf2

F Test for Two Variances
tt2d

Two-Sample t Test with Unequal Variances
tt1

One-Sample t Test
tq2a

Chi-Square Goodness-of-Fit Test
tz1

One-Sample Z Test
tq2i

Chi-Square Test of Independence
tt2p

Paired t Test
tq2h

Chi-Square Test of Homogeneity
tt2i

Two-Sample t Test with Equal Variances
tz2

Two-Sample Z Test