State whether the CLT applies to the following cases. 2 points each
Report the given confidence interval for error in the mean using the data given for each problem what the confidence interval is for each example. 5 points each
95% Double.
data_21 = [65.58, -28.15, 21.17, -0.57, 6.04, -10.21, 36.46, 10.67, 77.98, 15.97]
80% Upper (lower bound, a value such that the mean lies above that value 80% of the time)
data_22 = [-8.78, -6.06, -6.03, -6.9, -13.57, -18.76, 1.5, -8.21, -3.21, -11.85, -2.72, -10.38, -11.03, -10.85, -7.6, -7.76, -5.99, -10.02, -6.32, -8.35, -19.28, -11.53, -6.04, -0.81, -12.01, -3.22, -9.25, -4.13, -7.22, -11.0, -14.42, 1.07]
80% Double
data_23 = [14.62, 10.34, 7.68, 15.81, 14.48]
Redo part 3 with a known standard deviation of 3.5
90% Lower (upper bound)
data_25 = [2.47, 2.03, 1.82, 6.98, 2.41, 2.32, 7.11, 5.89, 5.77, 3.34, 2.75, 6.51]
In [1]:
# 2.1
import scipy.stats as ss
import numpy as np
data_21 = [65.58, -28.15, 21.17, -0.57, 6.04, -10.21, 36.46, 10.67, 77.98, 15.97]
T = ss.t.ppf(0.975, len(data_21) - 1)
y = np.std(data_21, ddof=1) / np.sqrt(len(data_21))
print('{:.1f} +/- {:.1f}'.format(np.mean(data_21), y * T))
In [2]:
# 2.2
data_22 = [-8.78, -6.06, -6.03, -6.9, -13.57, -18.76, 1.5, -8.21, -3.21, -11.85, -2.72, -10.38, -11.03, -10.85, -7.6, -7.76, -5.99, -10.02, -6.32, -8.35, -19.28, -11.53, -6.04, -0.81, -12.01, -3.22, -9.25, -4.13, -7.22, -11.0, -14.42, 1.07]
T = ss.t.ppf(0.2, len(data_22) - 1)
y = np.std(data_22, ddof=1) / np.sqrt(len(data_22))
print('mu > {:.2f} with 80%'.format(np.mean(data_22) + y * T))
In [3]:
# 2.3
data_23 = [14.62, 10.34, 7.68, 15.81, 14.48]
T = ss.t.ppf(0.9, len(data_23) - 1)
y = np.std(data_23, ddof=1) / np.sqrt(len(data_23))
print('{:.1f} +/- {:.1f}'.format(np.mean(data_23), T * y))
In [4]:
# 2.4
data_23 = [14.62, 10.34, 7.68, 15.81, 14.48]
Z = ss.norm.ppf(0.9)
y = 3.5 / np.sqrt(len(data_23))
print('{:.1f} +/- {:.1f}'.format(np.mean(data_23), Z * y))
In [5]:
#2.5
data_25 = [2.47, 2.03, 1.82, 6.98, 2.41, 2.32, 7.11, 5.89, 5.77, 3.34, 2.75, 6.51]
T = ss.t.ppf(0.9, len(data_25) - 1)
y = np.std(data_25, ddof=1) / np.sqrt(len(data_25))
print('mu < {:.2f} with 90% confidence'.format(np.mean(data_25) + y * T))
For each problem state if it is a t or normal distribution and reports the distribution's parameters. Report your answer like: $T(0, 4.3, 4)$ to indicate a $t$-distribution with $\mu = 0$, $\sigma = 4.3$ and degrees of freedom of 4. Note that $\mu, \sigma$s listed below are the population sigmas, not the parameters of a $t$-distribution. 2 Points each