Download presentation
1
Using Statistics To Make Inferences 4
Summary Two sample t test Paired comparisons Assignment 1 Mike Cox, Newcastle University, me fecit 16/02/2015 1 Sunday, 16 April :56 PM
2
To perform and interpret a two sample t test Practical
Summary To perform and interpret a two sample t test Practical Perform two sample t tests 2
3
Comparison Of Two Sample Means
The null hypothesis is that the two populations are identical. In that case they would have the same means. That is μ1 = μ2 Notation Standard deviation of two samples Size of two samples Mean of two samples Note, assess if s1 and s2 are numerically close. We will test this later in the course. But which is most appropriate, s1 or s2? 3
4
Key Equations Pooled standard deviation t test statistic
degrees of freedom Note the degrees of freedom match the divisor in the pooled standard deviation. This is consistent with the equivalent one sample test. 4
5
Confidence Interval with ν = (n1–1)+(n2-1) degrees of freedom
Sample mean of difference n1 n2 Sample sizes ν Degrees of freedom, (n1–1)+(n2-1) s Pooled standard deviation α Proportion of occasions that the true mean lies outside the range tν Critical value of t from tables Don’t forget to multiply or divide before you add or subtract 4.5
6
Confidence Interval with ν = (n1–1)+(n2-1) degrees of freedom
Sample mean of difference n1 n2 Sample sizes ν Degrees of freedom, (n1–1)+(n2-1) s Pooled standard deviation α Proportion of occasions that the true mean lies outside the range tν Critical value of t from tables 4.6
7
Example 1 In a clinical test the following scores were obtained for “normal” and “diseased” patients. Normal Diseased H0 is that μ1 = μ2 H1 is that μ1 ≠ μ2 under a two tail test 7
8
Calculations 1 8
9
Calculations 1 9
10
Conclusion 1 ν p=0.05 p=0.025 p=0.005 p=0.0025 14 1.761 2.145 2.977 3.326 3.787 t14(0.025) = and t14(0.005) = 2.977 In an attempt to “estimate” p. Since 0.01 < p < 0.05 (two tail test) the result is significant at the 5% level. The null hypothesis is rejected and the mean levels are apparently different. 10
11
SPSS 1 Analyze > Compare Means > Independent Samples t Test 11
12
SPSS 1 Analyze > Compare Means > Independent Samples t Test
Note the need to define the groups (normal/diseased) 12
13
SPSS 1 Basic descriptive statistics 13
14
SPSS 1 The method described here assumes equal variances. More of this later in the course. Note the p value is less than .05 Note the confidence interval excludes 0 14
15
Excel 1 The same p value as on the previous slide
Note the final parameters. 2 – two tailed 2 – type – assuming equal variances 4.15 15
16
Boxplot of Normal, Diseased
16
17
Example 2 A study of 22 patients suffering from Parkinsons disease was conducted. An operation was performed on 8 of them, while it improved their general condition it might adversely affect their speech. In the data a higher value indicates a greater difficulty in speaking. Operated Others 17
18
Calculation 2 18
19
Calculation 2 19
20
Conclusion 2 ν p=0.05 p=0.025 p=0.005 p=0.0025 20 1.725 2.086 2.845 3.153 3.552 t20(0.025) = and t20(0.005) = 2.845 In an attempt to “estimate” p. Since 0.01 < p < 0.05 (two tail test) the result is significant at the 5% level. The null hypothesis is rejected, the operation appears to affect speech. 20
21
SPSS 2 The method described here assumes equal variances. More of this later in the course. Note the p value is less than .05 Note the confidence interval excludes 0 21
22
Excel 2 The same p value as on the previous slide. 22 4.22
23
Boxplot of Operated, Others
23
24
Practical In most cases we identified a difference, as in the previous two examples. This need not always be the case. Note that in the practical we examine two case studies in one, on waiting times between eruptions of the Old Faithful geyser, the evidence (see the next three slides) suggests the two means are equal. 24
25
Practical Waiting times between eruptions of Old Faithful geyser for two different periods are given. Is there evidence that the waiting times tend to be longer for one of the periods than for the other? WT1 Minutes between eruptions 1/8 to 5/8/, 1985 WT2 Minutes between eruptions 6/8 to 10/8, 1985 25
26
SPSS 3 The method described here assumes equal variances. More of this later in the course. Note the p value is greater than .05 Note the confidence interval includes 0 26
27
Boxplot of WT1, WT2 27
28
Paired Comparisons - Example 3
Certain mental tasks are performed before and after exercise. The scores for each subject were recorded. Subject 1 2 3 4 5 6 7 8 9 10 Exercise 46 38 62 54 42 37 55 52 41 39 Relaxed 53 60 58 49 34 65 47 43 We want to test the difference, so subtract. Does exercise have an effect? 28
29
Paired Comparisons - Example 3
Certain mental tasks are performed before and after exercise. The scores for each subject were recorded. Subject 1 2 3 4 5 6 7 8 9 10 Exercise 46 38 62 54 42 37 55 52 41 39 Relaxed 53 60 58 49 34 65 47 43 Difference -2 -3 Perform a one sample t-test on the difference. No effect implies a zero value. 29
30
Calculation 3 Differences (d) 7 8 -2 4 7 -3 10 1 6 4 n = 10
n = 10 Σd = = 42 Σd2 = = 344 n = 10 Σd = 42 Σd2 = 344 30
31
Calculation 3 n = 10 Σd = 42 Σd2 = 344 31
32
Calculation 3 The population value being tested is zero.
Exercise claimed to have no effect. Note the degrees of freedom match the divisor in the standard deviation (see vard on the previous slide). 32
33
Conclusion 3 ν 9 t9(0.025) = 2.262 and t9(0.005) = 3.250
p=0.05 p=0.025 p=0.005 p=0.0025 9 1.833 2.262 3.250 3.690 4.297 t9(0.025) = and t9(0.005) = 3.250 In an attempt to “estimate” p. Since 0.01 < p < 0.05 (two tail test) the result is significant at the 5% level. The null hypothesis is rejected, the mean performance levels appear to differ. 33
34
SPSS 3 Transform > Compute Variable
34
35
SPSS 3 Transform > Compute Variable
35
36
SPSS 3 Analyze > Compare Means > One Sample t Test
Note the test value is 0, no difference. 36
37
SPSS 3 Note the p value is less than .05
Note the confidence interval excludes 0 37
38
SPSS 3 Or directly as a t test on paired samples
Analyze > Compare Means > Paired Samples t Test Some additional output are generated 38
39
SPSS 3 39
40
SPSS 3 Note the p value is less than .05
Note the confidence interval excludes 0 Of course the result is unchanged 40
41
Excel 3 The same p value as on the previous slide.
Note the final parameter. 1 – type – paired values 4.41 41
42
Normal Approximation For greater than 30 degrees of freedom the Students t distribution is well approximated by the standard normal distribution. You will notice that the final row in most Students t tables simply give the normal values. Skip review 4.42 42
43
SPSS t Tests The software offers three options which will now be reviewed One Sample t Test Independent Samples t Test Paired Samples t Test 43
44
One-Sample t Test The One-Sample t Test procedure tests whether the mean of a single variable differs from a specified constant. 44
45
One-Sample t Test Examples
A researcher might want to test whether the average IQ score for a group of students differs from 100. A cereal manufacturer can take a sample of boxes from the production line and check whether the mean weight of the samples differs from 1.3 pounds at the 95% confidence level. 45
46
One-Sample t Test Statistics
For each test variable: mean, standard deviation, and standard error of the mean. The average difference between each data value and the hypothesized test value, a t test that tests that this difference is 0, and generates a confidence interval for this difference (you can specify the confidence level). 46
47
One-Sample t Test Data To test the values of a quantitative variable against a hypothesized test value, choose a quantitative variable and enter a hypothesized test value. 47
48
One-Sample t Test Assumptions
This test assumes that the data are normally distributed; however, this test is fairly robust to departures from normality. 48
49
One-Sample t Test To Obtain a One-Sample t Test From the menus choose:
Analyse Compare Means One-Sample t Test Select one or more variables to be tested against the same hypothesized value. Enter a numeric test value against which each sample mean is compared. Optionally, click Options to control the treatment of missing data and the level of the confidence interval. 49
50
Independent-Samples t Test
The Independent-Samples t Test procedure compares means for two groups of cases. Ideally, for this test, the subjects should be randomly assigned to two groups, so that any difference in response is due to the treatment (or lack of treatment) and not to other factors. 50
51
Independent-Samples t Test
This is not the case if you compare average income for males and females. A person is not randomly assigned to be a male or female. In such situations, you should ensure that differences in other factors are not masking or enhancing a significant difference in means. Differences in average income may be influenced by factors such as education (and not by sex alone). 51
52
Independent-Samples t Test
Example Patients with high blood pressure are randomly assigned to a placebo group and a treatment group. The placebo subjects receive an inactive pill, and the treatment subjects receive a new drug that is expected to lower blood pressure. After the subjects are treated for two months, the two-sample t test is used to compare the average blood pressures for the placebo group and the treatment group. Each patient is measured once and belongs to one group. 52
53
Independent-Samples t Test
Statistics For each variable: sample size, mean, standard deviation, and standard error of the mean. For the difference in means: mean, standard error, and confidence interval (you can specify the confidence level). Tests: Levene's test for equality of variances and both pooled-variances and separate-variances t tests for equality of means. 53
54
Independent-Samples t Test
Data The values of the quantitative variable of interest are in a single column in the data file. The procedure uses a grouping variable with two values to separate the cases into two groups. The grouping variable can be numeric (values such as 1 and 2 or 6.25 and 12.5) or short string (such as yes and no). As an alternative, you can use a quantitative variable, such as age, to split the cases into two groups by specifying a cut point (cut point 21 splits age into an under-21 group and a 21-and-over group). 54
55
Independent-Samples t Test
Assumptions For the equal-variance t test, the observations should be independent, random samples from normal distributions with the same population variance. For the unequal-variance t test, the observations should be independent, random samples from normal distributions. The two-sample t test is fairly robust to departures from normality. When checking distributions graphically, look to see that they are symmetric and have no outliers. 55
56
Independent-Samples t Test
To Obtain an Independent-Samples t Test From the menus choose: Analyse Compare Means Independent-Samples t Test. Select one or more quantitative test variables. A separate t test is computed for each variable. Select single groupings variable, and then click Define Groups to specify two codes for the groups that you want to compare. Optionally, click Options to control the treatment of missing data and the level of the confidence interval. 56
57
Paired-Samples t Test The Paired-Samples t test procedure compares the means of two variables for a single group. The procedure computes the differences between values of the two variables for each case and tests whether the average differs from 0. 57
58
Paired-Samples t Test Example
In a study on high blood pressure, all patients are measured at the beginning of the study, given a treatment, and measured again. Thus, each subject has two measures, often called before and after measures. 58
59
Paired-Samples t Test Example
An alternative design for which this test is used is a matched-pairs or case-control study, in which each record in the data file contains the response for the patient and also for his or her matched control subject. In a blood pressure study, patients and controls might be matched by age (a 75-year-old patient with a 75-year-old control group member). 59
60
Paired-Samples t Test Statistics
For each variable: mean, sample size, standard deviation, and standard error of the mean. For each pair of variables: correlation, average difference in means, t tests, and confidence interval for mean difference (you can specify the confidence level). Standard deviation and standard error of the mean difference. 60
61
Paired-Samples t Test Data
For each paired test, specify two quantitative variables (interval level of measurement or ratio level of measurement). For a matched-pairs or case-control study, the response for each test subject and its matched control subject must be in the same case in the data file. 61
62
Paired-Samples t Test Assumptions
Observations for each pair should be made under the same conditions. The mean differences should be normally distributed. Variances of each variable can be equal or unequal. 62
63
Paired-Samples t Test To Obtain a Paired-Samples t Test
From the menus choose: Analyse Compare Means Paired-Samples t Test. Select one or more pairs of variables Optionally, click Options to control the treatment of missing data and the level of the confidence interval. 63
64
Read Read Howitt and Cramer pages 109-133
Read Howitt and Cramer (e-text) pages Read Russo (e-text) pages Read Davis and Smith pages 64
65
Practical 4 This material is available from the module web page.
Module Web Page 65
66
Instructions for the practical
This material for the practical is available. Instructions for the practical Practical 4 Material for the practical Practical 4 66
67
Assignment See Stage I Handbook
Assignments submitted in hard copy only Some modules may involve assignments that are completed on paper only and do not require electronic submission. If the submission is only in paper format you will hand it in at the School Office with a cover sheet attached. 67
68
Whoops! The Conservatives have been accused of being “totally out of touch” after claiming more than half of girls in the most deprived areas of Britain fell pregnant before their 18th birthday. However, official figures for those areas suggested that the number of under-18 girls who got pregnant was more like 54 per 1,000. 5.4% not 54%!! Telegraph 15 Feb 2010 68
69
Whoops! Explain yourself! 69
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.