SOCR EduMaterials AnalysisActivities TwoPairedT
From Socr
(→Two Paired Sample T-Test Example) |
|||
(3 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
- | ==Two Paired Sample T-Test Example== | + | ==[[SOCR_EduMaterials_AnalysesActivities | SOCR Analysis]] - Two Paired Sample T-Test Example== |
- | + | ||
- | ==Two Paired Sample T-Test Example== | + | This is a test for the hypothesis that two groups are with the same mean, while the data are actually paired. That is, Each value of group 1 has a corresponding value in group 2. |
- | We will demonstrate Two Paired T-Test with a SOCR built-in example. This example is based on a dataset from the statistical program "R." For more information of the R program, please see [http://cran.r-project.org/ CRAN Home Page]. The dataset used here is "'''shoes'''" under R's "'''MASS"''' library. In the dataset, ten boys are given to the wear of shoes of materials A and B for one foot. We'd like to find if one material is better than the other. | + | |
+ | ===Two Paired Sample T-Test Example=== | ||
+ | |||
+ | Go to the [http://www.socr.ucla.edu/htmls/ana/TwoPairedSampleTTest_Analysis.html SOCR Two Paired Sample T-Test Applet]. We will demonstrate Two Paired T-Test with a SOCR built-in example. This example is based on a dataset from the statistical program "R." For more information of the R program, please see [http://cran.r-project.org/ CRAN Home Page]. The dataset used here is "'''shoes'''" under R's "'''MASS"''' library. In the dataset, ten boys are given to the wear of shoes of materials A and B for one foot. We'd like to find if one material is better than the other. | ||
Line 20: | Line 22: | ||
- | '''2.''' Click on the "'''Mapping'''" button to get to the "'''Mapping'''" panel. Click on '''"ADD"''' under '''VARIABLE 1''' to add '''A''' and click on '''ADD''' under '''VARIABLE 2''' to add '''B'''. We care about the difference, so which on goes to '''VARIABLE 1''' or '''VARIABLE 2''' is arbitrary. Here, the computer will set difference = Variable 2 - Variable 1. If you like the | + | '''2.''' Click on the "'''Mapping'''" button to get to the "'''Mapping'''" panel. Click on '''"ADD"''' under '''VARIABLE 1''' to add '''A''' and click on '''ADD''' under '''VARIABLE 2''' to add '''B'''. We care about the difference, so which on goes to '''VARIABLE 1''' or '''VARIABLE 2''' is arbitrary. Here, the computer will set difference = Variable 2 - Variable 1. If you like the subtraction to go the other way around, simple assign '''VARIABLE 1''' and '''VARIABLE 2''' in the opposite way. |
Line 34: | Line 36: | ||
'''Questions for students:''' By looking at the test results, what do you think about the data? What can you say about the two different shoe materials? | '''Questions for students:''' By looking at the test results, what do you think about the data? What can you say about the two different shoe materials? | ||
+ | ===Example 2=== | ||
+ | In many experiments the same variable is measured under two different conditions. For example, in clinical trials the participants may be evaluated at baseline and then evaluated again at the end of the treatment. For example, the blood pressure is measured for several patients before and after administration of certain drug. The difference between the value at baseline and the value at the end is computed for each participant as follows: | ||
+ | |||
+ | <center> | ||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! || Value at baseline || Value at the end || Difference | ||
+ | |- | ||
+ | | Subject 1 || <math>x_{1b}</math> ||<math>x_{1a}</math> || <math>d_1=x_{1b}-x_{1a}</math> | ||
+ | |- | ||
+ | | Subject 2 || <math>x_{2b}</math> ||<math>x_{2a}</math> ||<math>d_2=x_{2b}-x_{2a}</math> | ||
+ | |- | ||
+ | | Subject 3 || <math>x_{3b}</math> ||<math>x_{3a}</math> || <math>d_3=x_{3b}-x_{3a}</math> | ||
+ | |- | ||
+ | | ... || ...|| ... || ... | ||
+ | |- | ||
+ | | ... || ...|| ... || ... | ||
+ | |- | ||
+ | | Subject ''n'' || <math>x_{nb}</math> ||<math>x_{na}</math> || <math>d_n=x_{nb}-x_{na}</math> | ||
+ | |}</center> | ||
+ | |||
+ | We then compute the sample mean and sample standard deviation of the differences. | ||
+ | : <math>\bar d=\frac{\sum_{i=1}^n d_i}{n}, \ \ \ \ s_d^2=\frac{\sum_{i=n}^n(d_i-\bar d)^2}{n-1}</math> | ||
+ | |||
+ | The hypothesis we want to test is: <math>H_0: \mu_d=d_0</math> vs. <math>H_a: \mu_d<d_0</math> or <math>\mu_d>d_0</math> or <math>\mu_d \ne d_0</math>. | ||
+ | |||
+ | If we choose <math>d_0=0</math> we are testing whether the before and after treatment are the same. | ||
+ | |||
+ | * Test statistic: | ||
+ | : <math>t=\frac{\bar d - d_0}{\frac{s_d}{\sqrt{n}}}</math> | ||
+ | |||
+ | * Assumption: | ||
+ | : The differences are treated as a random sample from a normal distribution. | ||
+ | |||
+ | We reject <math>H_0</math> if the <math>t</math> value falls in the rejection region which is based on the significance level <math>\alpha</math> and <math>n-1</math> degrees of freedom. | ||
+ | |||
+ | To study the effect of cigarette smoking on platelet aggregation researchers drew blood samples from 11 individuals before and after they smoked a cigarette and measured the percentage of blood platelet aggregation (from ''Mathematical Statistics and Data Analysis'', John Rice, Third Edition, Duxbury, 2007). Platelets are involved in the formation of blood clots, and it is known that smokers suffer more from disorders involving blood clots than do nonsmokers. This study can be found in [http://circ.ahajournals.org/cgi/reprint/48/3/619.pdf Levine, P. H. (1973). An acute effect of cigarette smoking on platelet function, Circulation, 48, 619-623]. | ||
+ | |||
+ | <center> | ||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! Before || After || Difference | ||
+ | |- | ||
+ | | 25 || 27 || 2 | ||
+ | |- | ||
+ | | 25 || 29 || 4 | ||
+ | |- | ||
+ | | 27 || 37 || 10 | ||
+ | |- | ||
+ | | 44 || 56 || 12 | ||
+ | |- | ||
+ | | 30 || 46 || 16 | ||
+ | |- | ||
+ | | 67 || 82 || 15 | ||
+ | |- | ||
+ | | 53 || 57 || 4 | ||
+ | |- | ||
+ | | 53 || 80 || 27 | ||
+ | |- | ||
+ | | 52 || 61 || 9 | ||
+ | |- | ||
+ | | 60 || 59 || -1 | ||
+ | |- | ||
+ | | 28 || 43 || 15 | ||
+ | |}</center> | ||
+ | * Test the null hypothesis that the means before and after are the same. Use <math>\alpha=0.05</math>. | ||
+ | ===References=== | ||
+ | * [http://circ.ahajournals.org/cgi/reprint/48/3/619.pdf Levine, P. H. (1973). An acute effect of cigarette smoking on platelet function, Circulation, 48, 619-623]. | ||
<hr> | <hr> | ||
{{translate|pageName=http://wiki.stat.ucla.edu/socr/index.php?title=SOCR_EduMaterials_AnalysisActivities_TwoPairedT}} | {{translate|pageName=http://wiki.stat.ucla.edu/socr/index.php?title=SOCR_EduMaterials_AnalysisActivities_TwoPairedT}} |
Current revision as of 23:35, 9 August 2009
Contents |
SOCR Analysis - Two Paired Sample T-Test Example
This is a test for the hypothesis that two groups are with the same mean, while the data are actually paired. That is, Each value of group 1 has a corresponding value in group 2.
Two Paired Sample T-Test Example
Go to the SOCR Two Paired Sample T-Test Applet. We will demonstrate Two Paired T-Test with a SOCR built-in example. This example is based on a dataset from the statistical program "R." For more information of the R program, please see CRAN Home Page. The dataset used here is "shoes" under R's "MASS" library. In the dataset, ten boys are given to the wear of shoes of materials A and B for one foot. We'd like to find if one material is better than the other.
Here's the steps of the activity:
1. Click on Two Paired Sample T-Test at the left panel's combo box.
On the right panel, first click on EXAMPLE 3 and next click on "Data" to retreive the demonstrated example. This is the example we'll be looking at.Note that the data are difference of B - A.
2. Click on the "Mapping" button to get to the "Mapping" panel. Click on "ADD" under VARIABLE 1 to add A and click on ADD under VARIABLE 2 to add B. We care about the difference, so which on goes to VARIABLE 1 or VARIABLE 2 is arbitrary. Here, the computer will set difference = Variable 2 - Variable 1. If you like the subtraction to go the other way around, simple assign VARIABLE 1 and VARIABLE 2 in the opposite way.
3. Click on "Calculate" then "Result" to see the results.
Questions for students: By looking at the test results, what do you think about the data? What can you say about the two different shoe materials?
Example 2
In many experiments the same variable is measured under two different conditions. For example, in clinical trials the participants may be evaluated at baseline and then evaluated again at the end of the treatment. For example, the blood pressure is measured for several patients before and after administration of certain drug. The difference between the value at baseline and the value at the end is computed for each participant as follows:
Value at baseline | Value at the end | Difference | |
---|---|---|---|
Subject 1 | x_{1b} | x_{1a} | d_{1} = x_{1b} − x_{1a} |
Subject 2 | x_{2b} | x_{2a} | d_{2} = x_{2b} − x_{2a} |
Subject 3 | x_{3b} | x_{3a} | d_{3} = x_{3b} − x_{3a} |
... | ... | ... | ... |
... | ... | ... | ... |
Subject n | x_{nb} | x_{na} | d_{n} = x_{nb} − x_{na} |
We then compute the sample mean and sample standard deviation of the differences.
The hypothesis we want to test is: H_{0}:μ_{d} = d_{0} vs. H_{a}:μ_{d} < d_{0} or μ_{d} > d_{0} or .
If we choose d_{0} = 0 we are testing whether the before and after treatment are the same.
- Test statistic:
- Assumption:
- The differences are treated as a random sample from a normal distribution.
We reject H_{0} if the t value falls in the rejection region which is based on the significance level α and n − 1 degrees of freedom.
To study the effect of cigarette smoking on platelet aggregation researchers drew blood samples from 11 individuals before and after they smoked a cigarette and measured the percentage of blood platelet aggregation (from Mathematical Statistics and Data Analysis, John Rice, Third Edition, Duxbury, 2007). Platelets are involved in the formation of blood clots, and it is known that smokers suffer more from disorders involving blood clots than do nonsmokers. This study can be found in Levine, P. H. (1973). An acute effect of cigarette smoking on platelet function, Circulation, 48, 619-623.
Before | After | Difference |
---|---|---|
25 | 27 | 2 |
25 | 29 | 4 |
27 | 37 | 10 |
44 | 56 | 12 |
30 | 46 | 16 |
67 | 82 | 15 |
53 | 57 | 4 |
53 | 80 | 27 |
52 | 61 | 9 |
60 | 59 | -1 |
28 | 43 | 15 |
- Test the null hypothesis that the means before and after are the same. Use α = 0.05.
References
Translate this page: