Z test for known population standard deviation
z.test.RdCompute the test of hypothesis and compute confidence interval on the mean of a population when the standard deviation of the population is known.
Arguments
- x
Vector of data values or the mean of the data.
- mu
Hypothesized mean of the population.
- stdev
Known standard deviation of the population.
- alternative
Direction of the alternative hypothesis.
- sd
Alternative to
stdev- n
The sample size if
xis the sample mean.- conf.level
Confidence level for the interval computation.
- ...
Additional arguments are silently ignored.
Details
Many 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).
Author
Greg Snow 538280@gmail.com
Examples
x <- rnorm(25, 100, 5)
z.test(x, 99, 5)
#>
#> One Sample z-test
#>
#> data: x
#> z = -0.1251, n = 25, Std. Dev. = 5, Std. Dev. of the sample mean = 1,
#> p-value = 0.9004
#> alternative hypothesis: true mean is not equal to 99
#> 95 percent confidence interval:
#> 96.91493 100.83486
#> sample estimates:
#> mean of x
#> 98.8749
#>