Tests a sample from a normally distributed population with a known standard deviation to determine if the hypothesis that the population mean has a specified value should be accepted or rejected. |
||
Syntax |
reject, p_value, conf = ZTest(data, mu, sigma, alpha) |
|
Arguments |
Name |
Description |
data |
A vector containing sample data. |
|
mu |
The hypothesized population mean to be tested. |
|
sigma |
The known population standard deviation. |
|
alpha (optional) |
The level of significance for the test, also known as the probability of a Type I error. It must be in the interval (0, 0.5). The default value is 0.05. |
|
Outputs |
Name |
Description |
reject |
A Boolean value that is true if the hypothesis is to be rejected. |
|
p_value |
The largest value of alpha for which the hypothesis is to be accepted. |
|
conf |
A 100(1-alpha)% confidence interval for the population mean. A two-element vector containing the lower and upper bounds of the interval, respectively. |
|
Example |
Test the hypothesis that a population with a standard deviation of 1.5 and a mean (mu) of 4 based on a sample of [2, 3, 5, 7, 4]. |
|
Syntax |
||
reject, p_value, conf = ZTest([2, 3, 5, 7, 4], 4, 1.5) |
||
Result |
||
reject = false p_value = 0.76559 conf = [2.8852 5.5148] |