Intro - Confidenceintervals: 0.1 Statistical Inference With Confidence Intervals
Intro - Confidenceintervals: 0.1 Statistical Inference With Confidence Intervals
Intro - Confidenceintervals: 0.1 Statistical Inference With Confidence Intervals
√
Population Proportion ∗ (1 − Population Proportion)
Standard Error f or Population Proportion =
Number O f Observations
1
Standard Deviation
Standard Error f or Mean = √
Number O f Observations
Let’s replicate the car seat example from lecture:
se = np.sqrt((p * (1 - p))/n)
se
Out[2]: 0.01390952774409444
In [5]: sm.stats.proportion_confint(n * p, n)
Now, lets take our Cartwheel dataset introduced in lecture and calculate a confidence interval
for our mean cartwheel distance:
df = pd.read_csv("Cartwheeldata.csv")
In [7]: df.head()
2
In [8]: mean = df["CWDistance"].mean()
sd = df["CWDistance"].std()
n = len(df)
Out[8]: 25
se = sd/np.sqrt(n)
se
Out[9]: 3.0117104774529704
In [11]: sm.stats.DescrStatsW(df["CWDistance"]).zconfint_mean()