Test if one value comes from N(μ,σ²)
GoogleData Scientist · Technical ScreenLast updated
This question tests the ability to perform statistical hypothesis testing on a single observation, evaluate the limitations of small sample sizes, and explain the trade-offs between Type I and Type II errors.
The Problem
Suppose you have a production process that is monitored by a sensor. Based on historical data, the sensor readings follow a normal distribution $N(\mu, \sigma^2)$ where $\mu = 100$ and $\sigma = 10$ are known. A single new reading $x = 125$ is observed.
- Formulate a null hypothesis $H_0$ and an alternative hypothesis $H_a$ to test whether this specific observation is consistent with the known distribution.
- Calculate the test statistic (z-score) and the corresponding p-value for a two-sided test.
- Using a significance level of $\alpha = 0.05$, state your decision rule and conclude whether you reject $H_0$.
Constraints and Considerations
- Explain the assumptions required to perform this test on a sample size of $n=1$.
- Discuss why the power of this test is inherently limited given the sample size.
- How would the decision rule change if the business required a stricter control over false alarms (e.g., $\alpha = 0.01$)?
Example
If $\mu=50, \sigma=5$ and $x=62$, then:
- $z = (62 - 50) / 5 = 2.4$.
- The two-sided p-value is $2 * P(Z > |2.4|) \approx 0.0164$.
- At $\alpha = 0.05$, we reject $H_0$ because $0.0164 < 0.05$.
Hints
Hint 1
Recall that for a normal distribution, the test statistic is the Z-score calculated as (observed_value - mean) / standard_deviation.
Hint 2
The p-value in a two-sided test represents the probability of observing a value at least as extreme as |z| in either tail of the distribution.
Hint 3
Consider that with n=1, you are assuming the underlying population distribution is perfectly normal; if the process has heavy tails, the risk of a Type I error is higher than calculated.
Follow-up questions
- What if the standard deviation is unknown and you only have one observation? Is it possible to perform a t-test in this scenario?
- How does the power of this test change if the true mean shifts to 110 instead of 100?
- In a real-world monitoring system, what are the risks of using a single-point test compared to a moving window or a sequential probability ratio test (SPRT)?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.