Presentation is loading. Please wait.

Presentation is loading. Please wait.

Hypothesis Testing Start with a question:

Similar presentations


Presentation on theme: "Hypothesis Testing Start with a question:"— Presentation transcript:

1 Hypothesis Testing Start with a question:
Does the amount of credit card debt differ between households in rural areas compared to households in urban areas? Population 1 All Rural Households m1 Population 2 All Urban Households m2 Null Hypothesis: H0 : m1 = m2 Alternate Hypothesis: HA : m1 ≠ m2

2 Collect Data to Test Hypothesis
Population 1 All Rural Households m1 Population 2 All Urban Households m2 Take Random Sample (n1) Take Random Sample (n2) Are the sample means consistent with H0?

3 Summary Data Summary Rural Summary Urban Difference in means = $735
How likely is it to get a difference of $735 or greater if Ho is true? This probability is called the p-value. If small then reject Ho.

4 P-Value The probability of observing a difference between sample means as or more extreme as that observed if the null hypothesis is true. When this probability is small we declare that the two population means are significantly different. P< 0.05 is conventional cutoff Note: P-value and significance level are the same

5 Computing P-Value for Testing Differences Between 2 Means
Point estimator for m1-m2 test statistic: Variability in point estimate Under Ho t follows a t-distribution with n1+ n2 -2 degrees of freedom (DF) Sp is pooled standard deviation, a weighted average of SD for each group

6 Observations If Ho is true then t-values should center around 0 A large difference between sample means will lead to a large t-value A small standard error will lead to a large t-value results from large sample sizes (n1 and n2) results from small variation in the population

7 Assumptions for T-Test
Each of 2 populations follow a normal distribution Data sampled independently from each population Example of lack of independence Measure visual acuity in left and right eye The population variances are the same for each population. The t-test is “robust” to violation of assumptions 1 and 3. Robust – the assumptions do not need to hold exactly

8 * SAS CODE FOR CREDIT CARD EXAMPLE; DATA credit; INFILE DATALINES;
INPUT balance live DATALINES; ; Used when inputing more than one obs per line

9 PROC MEANS DATA=credit ; CLASS live; VAR balance;
The MEANS Procedure Analysis Variable : balance N live Obs N Mean Std Dev Minimum Maximum

10 PROC TTEST DATA=credit ; CLASS live; VAR balance; OUTPUT
The TTEST Procedure Statistics Lower CL Upper CL Lower CL Variable live N Mean Mean Mean Std Dev Std Dev balance balance balance Diff (1-2) Means for each group and the difference

11 PROC TTEST DATA=credit ; CLASS live; VAR balance; OUTPUT
T-Tests Variable Method Variances DF t Value Pr > |t| balance Pooled Equal balance Satterthwaite Unequal T-statistic and P-value DF = n1+n2 – 2 Conclusion: Means are not significantly different (p=.44)

12 PROC TTEST DATA=credit ; CLASS live; VAR balance; OUTPUT
Equality of Variances Variable Method Num DF Den DF F Value Pr > F balance Folded F Tests if variances are different between groups

13 Your Turn Page 256 of Le Compares cotinine levels from 8 infants from parents who smoke and 7 infants from parents who do not smoke. What are the 2 populations? Write down in words and symbols the null and alternate hypothesis Write and run the SAS code to perform the t-test Compare the SAS output with the calculations on page 256 What is the p-value for the test?

14 Matched Pair Data Each subject serves as own control
Half of patients start out on treatment 1, other half on treatment 2 Outcome is measured at end of first period Patients are switched to other treatment (usually after a “washout” period). Outcome is measured at end of second period Analyses is based on within subject differences

15 Matched Pair Data Examples
Data on twins Pre-post tests Data on pairs of eyes, left versus right foot, etc

16 Matched Pair Data Analyses reduced to a 1-sample problem
Differences are computed for each pair di = outcome when on treatment 1 minus outcome when on treatment 2 Large values indicate differences in treatments

17 Matched Pair Example Question: Does intake of oat bran lower your cholesterol? LDL cholesterol measured on 14 subjects After period on cornflake diet After period on oat bran diet Data on page 273 of Le

18 INPUT subject $ cornflakes oatbran ;
DATA oatbran; INFILE DATALINES; INPUT subject $ cornflakes oatbran ; oatcorndif = oatbran - cornflakes; DATALINES; ;

19 *Running Matched Pair T-test
using proc means: ; PROC MEANS DATA=oatbran N MEAN STDERR T PRT ; VAR oatcorndif OUTPUT The MEANS Procedure Variable N Mean Std Error t Value Pr > |t| ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ cornflakes <.0001 oatbran <.0001 oatcorndif Tvalue = mean/se Conclusion: Oat bran significantly reduces cholesterol (p<.01)

20 using PROC TTEST; PROC TTEST; VAR oatcorndif; RUN;
*Running Matched Pair T-test using PROC TTEST; PROC TTEST; VAR oatcorndif; RUN; No class variable so performing one sample t-test. Tests if mean is 0.

21 Match Pair Data- Your Turn
Female killdeer lay four eggs each spring. A scientist claims that the egg that hatches first yields a larger bird than the one that hatches last. To test his claim, he weighs the oldest and youngest of eight families with the following results: Family Oldest Youngest 1 2.92 2.90 2 3.58 3.68 3 3.39 3.33 4 3.29 3.06 5 3.44 3.30 6 3.13 2.99 7 3.22 3.26 8 3.80 3.51 Test the researcher’s hypothesis using the data above? What is the null and alternative hypothesis? What is the p-value for the test?

22 Issues with hypothesis testing
Significance does not imply causality Need a proper prospective experiment Significance does not imply practical importance Trivial but significant differences Run lots of tests, will find significant difference by chance With α = 0.05, expect 1 in 20 results to be sig. by chance

23 Issues with hypothesis testing
Large p-values because sample size is small Effect could exist but we may not have a large enough sample size Outliers may cause problems

24 Issues With Hypothesis Testing
What is the population of inference? Example: A statistics class of n=15 women and n=5 men yield the following exam scores: Women: mean = 90% SD = 10% Men: mean = 85% SD = 11% Test the hypothesis that women did better on the exam then men.

25


Download ppt "Hypothesis Testing Start with a question:"

Similar presentations


Ads by Google