C.I. for Two Means
Point Estimate \(\pm\) ME \[\bar y_2 - \bar y_1 \pm ME\]
Computing ME - By Simulation
Three ways to simulate a Distribution
- Shuffle \(Y\)
- Models no-association \(\text{Null Distribution}\)
- Resample dataset
- Resample within groups
- Key is finding ME for the same structure
ME and Sampling Distributions
Simulation
- Resample (Find Sampling Dist.)
- Compute \(b_1=\bar y_2-\bar y_1\)
- Repeate many times
- Find middle C%: \[(LL, UL)\]
- ME = \(\frac{UL-LL}{2}\)
Computing ME - Theoretical
- Equal Variance
- \(s_p^2 = \frac{(n_1)s_1^2+(n_2)s_2^2}{n_1+n_2-2}\)
- \(DF = n_1+n_2-2\)
- SE = \(s_p\sqrt{\frac{1}{n_1}+\frac{1}{n_2}}\)
- Unequal Variance
- \(DF \approx min(n_1-1, n_2-1)\)
- SE = \(\sqrt{\frac{s_1^2}{n_1}+\frac{s_2^2}{n_2}}\)
- \(t_{\alpha/2}\) from \(t\sim T(df=DF)\)
- ME = \(t_{\alpha/2} \cdot SE\)
Computing ME - Theoretical
‘confint()’ Computes confidence interval