Compute the one-sample t-statistic for observations x1,…,xn and hypothesized mean μ0. First compute the sample standard deviation:
s=n−11i=1∑n(xi−xˉ)2Then compute:
t=s/nxˉ−μ0Here, xˉ is the sample mean. If s=0, return zero when xˉ=μ0 and signed infinity otherwise. Return the statistic as a Python float.
Input: x = [2.1, 2.4, 1.9, 2.6, 2.0], mu0 = 2.0
Output: 1.53393
Explanation: The sample mean is above the hypothesized mean by about 1.53 standard errors.
Input: x = [3.0, 5.0], mu0 = 4.0
Output: 0.0
Input: x = [1.0, 1.5, 2.0], mu0 = 3.0
Output: -5.196152
Compute centered = x - np.mean(x) before the corrected variance.
The standard error is sample_std / np.sqrt(x.size).
Sign in to take notes on this problem
Accepts: array
Accepts: number
Compute the one-sample t-statistic for observations x1,…,xn and hypothesized mean μ0. First compute the sample standard deviation:
s=n−11i=1∑n(xi−xˉ)2Then compute:
t=s/nxˉ−μ0Here, xˉ is the sample mean. If s=0, return zero when xˉ=μ0 and signed infinity otherwise. Return the statistic as a Python float.
Input: x = [2.1, 2.4, 1.9, 2.6, 2.0], mu0 = 2.0
Output: 1.53393
Explanation: The sample mean is above the hypothesized mean by about 1.53 standard errors.
Input: x = [3.0, 5.0], mu0 = 4.0
Output: 0.0
Input: x = [1.0, 1.5, 2.0], mu0 = 3.0
Output: -5.196152
Compute centered = x - np.mean(x) before the corrected variance.
The standard error is sample_std / np.sqrt(x.size).
Sign in to take notes on this problem
Accepts: array
Accepts: number