Learn R Programming

TH (version 1.0.0)

tz1: One-Sample Z Test

Description

Performs a Z test for one population mean when the population variance is known.

Usage

tz1(
  dadosX = NULL,
  mp,
  vp,
  alfa = 0.05,
  Ha = 1,
  unidade = NULL,
  media = 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.

vp

Known population variance.

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.

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 accepts either raw observations or the sample mean and sample size. It produces a graphical representation of the main stages of the test.

Main assumptions:

  • random sampling and independent observations;

  • known population variance;

  • normal population or an adequately large sample;

Examples

Run this code
X <- c(52, 49, 51, 50, 53, 54, 48, 52, 51, 50)
tz1(X, mp = 50, vp = 4, alfa = 0.05, Ha = 1, unidade = " units", plot = FALSE)

Run the code above in your browser using DataLab