BasicsInferenceCLTGoogleMetaJane Street
Problem
Implement standard_error_mean(x) returning the Standard Error of the Mean SEM=ns, where s is the sample standard deviation (ddof=1).
Why It Matters: SEM quantifies how uncertain our sample mean is as an estimate of the true population mean—shrinking as 1/n when you collect more data.
Function Signature
import numpy as np
def standard_error_mean(x) -> float:
Sample Input & Output
Example 1: 4-Element Sample
Input:
x = [2.0, 4.0, 4.0, 6.0]
Expected Output:
0.816497
Explanation: s = sqrt(8/3) ≈ 1.632993, sqrt(4) = 2.0, so SEM = 1.632993 / 2 ≈ 0.816497.
Example 2: Zero Variance Sample
Input:
x = [5.0, 5.0, 5.0, 5.0]
Expected Output:
0.0
Explanation: When every observation is identical, s = 0.0 so SEM = 0.0.
Constraints & Edge Cases
- Return SEM as a Python float (
len(x) >= 2). - Use
ddof=1for sample standard deviation. - Input length
n >= 2.
Constraints & Evaluation Criteria
- Return SEM as a Python float (`len(x) >= 2`).
Hints
Python 3⌘/Ctrl+Enter to Run · ⌘/Ctrl+Shift+Enter to Submit
Loading Code Editor...
+1 Hidden Submit Case
Input / Scenario
[2, 4, 6, 8]
Expected Output / Criteria
1.2910