Learn R Programming

DescTools (version 0.99.6)

ZTest: Z Test for Known Population Standard Deviation

Description

Compute the test of hypothesis and compute confidence interval on the mean of a population when the standard deviation of the population is known.

Usage

ZTest(x, mu = 0, sd_pop, alternative = c("two.sided", "less", "greater"), 
      conf.level = 0.95)

Arguments

x
Vector of data values.
mu
Hypothesized mean of the population.
sd_pop
Known standard deviation of the population.
alternative
Direction of the alternative hypothesis.
conf.level
Confidence level for the interval computation.

Value

  • An object of class htest containing the results

Details

Most introductory statistical texts introduce inference by using the z-test and z-based confidence intervals based on knowing the population standard deviation. Most statistical packages do not include functions to do z-tests since the t-test is usually more appropriate for real world situations. This function is meant to be used during that short period of learning when the student is learning about inference using z-procedures, but has not learned the t-based procedures yet. Once the student has learned about the t-distribution the t.test function should be used instead of this one (but the syntax is very similar, so this function should be an appropriate introductory step to learning t.test).

See Also

t.test, print.htest

Examples

Run this code
x <- rnorm(25, 100, 5)
ZTest(x, 99, 5)

Run the code above in your browser using DataLab