Z-Test Statistic
MediumStatisticsMathArray
Description
Given a sample array, a hypothesized population mean, and the population standard deviation, return the one-sample z-statistic: (sample mean - population mean) / (population standard deviation / sqrt(n)). Round the result to 4 decimal places.
Examples
Input:
[8,10,12], 10, 3Output:
0Explanation:
The z-statistic measures how many standard errors separate the sample mean from the hypothesized population mean.
Input:
[85,90,95,100], 80, 10Output:
2.5Explanation:
The z-statistic measures how many standard errors separate the sample mean from the hypothesized population mean.
Input:
[48,52,50,49,51], 50, 5Output:
0Explanation:
The z-statistic measures how many standard errors separate the sample mean from the hypothesized population mean.
Constraints
- •
1 ≤ sample length ≤ 10⁴ - •
population standard deviation > 0