Learn R Programming

TH (version 1.0.0)

tt1: One-Sample t Test

Description

Performs Student's t test for one population mean when the population variance is unknown.

Usage

tt1(
  dadosX = NULL,
  mp,
  alfa = 0.05,
  Ha = 1,
  unidade = NULL,
  media = NULL,
  s2 = NULL,
  n = NULL,
  plot = TRUE
)

Value

Invisibly returns an object of classes th_test and htest containing the test statistic, degrees of freedom when applicable, p-value, estimates, critical values, significance level, and decision. When plot = TRUE, the educational graph is produced as a side effect.

Arguments

dadosX

Numeric vector containing the sample data. Use NULL when summary statistics are supplied.

mp

Population mean specified under the null hypothesis.

alfa

Significance level.

Ha

Alternative hypothesis. Use 1 or "two.sided", 2 or "greater", and 3 or "less".

unidade

Measurement unit displayed in the graph.

media

Sample mean used when dadosX = NULL.

s2

Sample variance used when dadosX = NULL.

n

Sample size used when dadosX = NULL.

plot

Logical. If TRUE (default), draw the educational graph; if FALSE, return the result without plotting.

Author

Willian Silva Barros

Details

Raw-data and summary-statistics modes are mutually exclusive. The function can be run using raw observations or the sample mean, sample variance, and sample size.

Main assumptions:

  • random sampling and independent observations;

  • approximately normal population, particularly for small samples;

Examples

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

Run the code above in your browser using DataLab