Given a sample x and a hypothesized population mean μ₀, compute the one-sample t-statistic.
One-Sample t-Statistic:
t=s/nxˉ−μ0Where: x̄ = sample mean, s = sample standard deviation, n = sample size
Sample standard deviation (Bessel correction):
s=n−11i=1∑n(xi−xˉ)2x: list or array - Sample observationsmu0: float - Null hypothesis mean (μ₀)Input: x=[2.1, 2.4, 1.9, 2.6, 2.0], mu0=2.0
Output: t_stat≈1.53
mean=2.20, std≈0.274, t=(2.20-2.0)/(0.274/√5)
Input: x=[3.0, 5.0], mu0=4.0
Output: t_stat=0.0
mean=4.0 equals mu0
Input: x=[1.0, 1.5, 2.0], mu0=3.0
Output: t_stat≈-5.20
negative t-statistic (sample mean < mu0)
Compute sample mean with np.mean().
Use np.sqrt() for sample standard deviation.
Standard error is s / np.sqrt().
Sign in to take notes on this problem
Accepts: array
Accepts: number
Given a sample x and a hypothesized population mean μ₀, compute the one-sample t-statistic.
One-Sample t-Statistic:
t=s/nxˉ−μ0Where: x̄ = sample mean, s = sample standard deviation, n = sample size
Sample standard deviation (Bessel correction):
s=n−11i=1∑n(xi−xˉ)2x: list or array - Sample observationsmu0: float - Null hypothesis mean (μ₀)Input: x=[2.1, 2.4, 1.9, 2.6, 2.0], mu0=2.0
Output: t_stat≈1.53
mean=2.20, std≈0.274, t=(2.20-2.0)/(0.274/√5)
Input: x=[3.0, 5.0], mu0=4.0
Output: t_stat=0.0
mean=4.0 equals mu0
Input: x=[1.0, 1.5, 2.0], mu0=3.0
Output: t_stat≈-5.20
negative t-statistic (sample mean < mu0)
Compute sample mean with np.mean().
Use np.sqrt() for sample standard deviation.
Standard error is s / np.sqrt().
Sign in to take notes on this problem
Accepts: array
Accepts: number