Two Sample Inference
Linear Combination of Random Variables
- Objective: Compare two proportions or two means by understanding how addition and multiplication affect the mean and variance.
- Set A Example: Given set A = {98, 99, 100, 101, 102}
- Sample mean ():
- Sample variance ($s^2$):
- Doubling Set A: 2A = {198, 199, 200, 201, 202}
- New sample mean:
- New sample variance:
- Doubling the values increases the sample variance by a factor of 4.
- Tripling Set A: 3A = {294, 297, 300, 303, 306}
- New sample mean:
- New sample variance:
- Multiplying by -1: -A = {-98, -99, -100, -101, -102}
- New sample mean:
- New sample variance:
- Multiplying by -3:
- New sample mean:
- New sample variance:
- Rule for Multiplication: Deriving a rule for calculating the sample mean and variance based on multiplication of the original set.
Effect of Addition on Sample Mean and Variance
- Adding 100 to all values in set A: Resulting set {198, 199, 200, 201, 202}
- New sample mean:
- New sample variance:
- Doubling and Subtracting: Doubling set A and subtracting 50 from each value.
- New sample mean:
- The sample variance would be four times the variance of your original set A.
- Rule for Addition: Establishing a rule for calculating the sample mean and variance based on the addition of values to the original set.
Expectation of a Linear Transformation (One Random Variable)
- Formula:
- Where:
- $a$ and $c$ are constants.
- $X$ is a random variable.
- denotes the expected value (mean).
- Where:
Examples of Linear Transformations (One Variable)
- Given:
- a. Calculate
- b. Calculate
- c. Calculate
- a. Calculate
Expectation of a Linear Combination (Two Random Variables)
- Formula:
- Where:
- $a$, $b$, and $c$ are constants.
- $X$ and $Y$ are random variables.
- denotes the expected value (mean).
- Where:
Examples of Linear Transformations (Two Variables)
- Given: and
- a. Calculate
- b. Calculate
- a. Calculate
Variance of a Linear Transformation (One Random Variable)
- Formula:
- Where:
- $a$ and $c$ are constants.
- $X$ is a random variable.
- denotes the variance.
- Where:
Examples of Variance Transformations (One Variable)
- Given:
- a. Calculate
- b. Calculate
- a. Calculate
Variance of a Linear Combination (Two Random Variables)
- Formula:
- Where:
- $a$, $b$, and $c$ are constants.
- $X$ and $Y$ are random variables.
- denotes the variance.
- $Cov(X, Y)$ is the covariance between $X$ and $Y$, measuring their joint variability.
- Where:
Practice with Variance Calculations
- Given: , , and
- a. Calculate
- b. Calculate
- c. Calculate
Applying Expectation Properties to Proportions
- Estimating using
- a.
- b.
- c. Expected value of the difference:
- d. If \hat{p}1 - \hat{p}2 > 0, then is larger.
- e. If , the proportions are the same.
Applying Variance Properties to Proportions
- Estimating using
- a. Variance of :
- b. Variance of :
- c. Variance of the difference (assuming zero covariance):
- d. Standard deviation of the difference (assuming zero covariance):
Confidence Interval for the Difference of Two Proportions
- Formula:
- Assumptions:
- and
- and
- and
- Assumptions:
Confidence Interval Example
- Scenario: Comparing the proportion of men () and women () taking vitamins.
- Men: , 72 take vitamins,
- Women: , 122 take vitamins,
- a. 95% confidence interval for :
- b. Interpretation: We are 95% confident that is between -0.0010 and 0.2210.
Practice: Confidence Interval for Energy Drink vs. Coffee
- Scenario: Comparing high blood pressure rates between energy drink and coffee consumers.
- Energy drinks: , 40 have high blood pressure.
- Coffee: , 17 have high blood pressure.
- Task:
- a. Calculate the 95% confidence interval for the difference .
- b. Interpret the confidence interval.
Applying Expectation Properties to Means
- Estimating using
- a.
- b.
- c. Expected value of the difference:
- d. If \bar{x}1 - \bar{x}2 < 0, then is larger.
- e. If , the sample means are the same.
Applying Variance Properties to Means
- Estimating using
- a. Variance of (approximated using ):
- b. Variance of (approximated using ):
- c. Variance of the difference:
- d. Standard deviation of the difference:
Confidence Interval for the Difference of Two Means
- Formula:
- Degrees of freedom:
Discussion on Degrees of Freedom Calculation
- Conservative estimate:
- Satterthwaite's degrees of freedom:
- Justification:
Example: Hypertension Drug Trial
- Scenario: Evaluating the effectiveness of a hypertension drug in lowering systolic blood pressure (SBP).
- Drug: , ,
- Placebo: , ,
- a. 95% confidence interval for :
- b. Interpretation: We are 95% confident that the difference in population means is between -25.75 and -0.25.
Practice: Corn Stalk Height Comparison
- Scenario: Examining the difference in corn stalk height between Iowa and Nebraska.
- Iowa: , cm,
- Nebraska: , cm,
- Task:
- a. Calculate the 95% confidence interval for .
- b. Interpret the confidence interval.
How to Write a Hypothesis for 2-Samples
- Null Hypothesis: or
- Possible Alternate Hypotheses:
- or
- or
- or
- Same approach applies to hypothesis testing about two proportions.
Hypothesis Testing Examples
- a. Claim: Mean workout time for men > women. P-value = 0.4358
- Ha: \muM > \mu_W
- Conclusion: Fail to reject . Not enough evidence to suggest men work out more.
- b. Claim: Mean time to finish statistics homework = math homework. P-value =
- Conclusion: Reject . There is enough evidence to suggest the mean times are different.
Hypothesis Testing Practice
- a. Claim: Mean points in professional football = college football. P-value = 0.1438
- b. Claim: Mean fast food spending now > 10 years ago. P-value = 1.43 ×
Test Statistic for 2-Sample Means
- Formula: t = \frac{\bar{x}1 - \bar{x}2 - (\mu1 - \mu2)0}{\sqrt{\frac{s1^2}{n1} + \frac{s2^2}{n_2}}}}
- = Sample mean for i = 1,2
- = Sample variance for i = 1,2
- = Sample size for i = 1,2
- = Hypothesized difference of the two means
Example: Corn Stalk Height Hypothesis Test
- Scenario: Testing the claim that Iowa corn grows taller than Nebraska corn.
- Iowa: , cm,
- Nebraska: , cm,
- a. Hypotheses: ,
- b. Test statistic:
- c. P-value:
- d. Conclusion: Reject . Enough evidence to suggest Iowa corn is taller.
Using Satterthwaite Degrees of Freedom
- Continuing the corn stalk height example.
- a. Calculate the p-value using Satterthwaite's degrees of freedom:
- a. Calculate the p-value using Satterthwaite's degrees of freedom:
Practice: Alex vs. Brian Game Scores
- Scenario: Testing if Alex's mean score equals Brian's mean score over 6 games each.
- Task:
- a. State the null and alternate hypotheses.
- b. Calculate the test statistic.
- c. Determine the p-value.
- d. Draw a conclusion.
- Task:
Installing Data Analysis ToolPak for Windows
- Step 1: Click on "File" followed by "Options"
- Step 2: Click "Add-ins"
- Step 3: Click "Go"
- Step 4: Check "Analysis ToolPak"
- Step 5: Click "OK." Double check it worked. Click "Data" followed by "Data Analysis"
- We can use this for "T-Test: Two Sample Assuming Unequal Variances"