In the [[AP_Statistics_Curriculum_2007_Hypothesis_S_Mean | previous chapter we saw how to do significance testing in the case of a single random sample]]. Now, we show how to do hypothesis testing comparing two samples and we begin with the simple case of paired samples.

In the [[AP_Statistics_Curriculum_2007_Hypothesis_S_Mean | previous chapter we saw how to do significance testing in the case of a single random sample]]. Now, we show how to do hypothesis testing comparing two samples and we begin with the simple case of paired samples.

-

=== Inferences about Two Means: Dependent Samples===

+

=== Inferences About Two Means: Dependent Samples===

-

In all study designs it is always critical to clearly identify whether samples we compare come from dependent or independent populations. There is a general formulation for the significance testing when the samples are independent. The fact that there may be uncountable many different types of dependencies prevents us from having a similar analysis protocol for ''all'' dependent sample cases. However, in one specific case - paired samples - we have the theory to generalize the significance testing analysis protocol. Two populations (or samples) are ''dependent because of pairing'' (or paired) if they are linked in some way, usually by a direct relationship. For example, measure the weight of subjects before and after a six month diet.

+

In all study designs, it is always critical to clearly identify whether samples we compare come from dependent or independent populations. There is a general formulation for the significance testing when the samples are independent. The fact that there may be uncountable many different types of dependencies that prevents us from having a similar analysis protocol for ''all'' dependent sample cases. However, in one specific case - paired samples - we have a theory to generalize the significance testing analysis protocol. Two populations (or samples) are ''dependent because of pairing'' (or paired) if they are linked in some way, usually by a direct relationship. For example, measure the weight of subjects before and after a six month diet.

===Paired Designs===

===Paired Designs===

-

These are the most common '''Paired Designs''' where the idea of pairing is that members of a pair are similar to each other with respect to extraneous variables.

+

These are the most common '''Paired Designs''', in which the idea of pairing is that members of a pair are similar to each other with respect to extraneous variables.

*Randomized block experiments with two units per block

*Randomized block experiments with two units per block

Line 20:

Line 20:

===Analysis Protocol for Paired Designs===

===Analysis Protocol for Paired Designs===

-

To study paired data we would like to examine the differences between each pair. Suppose {<math>X_1, X_2, X_3, \cdots , X_{n}</math>} and {<math>Y_1, Y_2, Y_3, \cdots , Y_{n}</math>} represent the 2 paired samples. Then we want to study the difference sample {<math>d_1=X_1-Y_1, d_2=X_2-Y_2, d_3=X_3-Y_3, \cdots , d_n=X_{n}-Y_{n}</math>}. Notice the effect of the pairings of each <math>X_i</math> and <math>Y_i</math>.

+

To study paired data, we would like to examine the differences between each pair. Suppose {<math>X_1, X_2, X_3, \cdots , X_n</math>} and {<math>Y_1, Y_2, Y_3, \cdots , Y_n</math>} represent the 2 paired samples. Then we want to study the difference sample {<math>d_1=X_1-Y_1, d_2=X_2-Y_2, d_3=X_3-Y_3, \cdots , d_n=X_n-Y_n</math>}. Notice the effect of the pairings of each <math>X_i</math> and <math>Y_i</math>.

-

Now we can clearly see that the group effect (group differences) are directly represented in the {<math>d_i</math>} sequence. The [[AP_Statistics_Curriculum_2007_Hypothesis_S_Mean#.28Approximately.29_Nornal_Process_with_Unknown_Variance | one-sample T test]] is the proper strategy to analyze the difference sample {<math>d_i</math>}, if the <math>X_i</math> and <math>Y_i<math> samples come from [[AP_Statistics_Curriculum_2007#Chapter_V:_Normal_Probability_Distribution |Normal distributions]].

+

Now we can clearly see that the group effect (group differences) is directly represented in the {<math>d_i</math>} sequence. The [[AP_Statistics_Curriculum_2007_Hypothesis_S_Mean#.28Approximately.29_Nornal_Process_with_Unknown_Variance | one-sample T test]] is the proper strategy to analyze the difference sample {<math>d_i</math>}, if the <math>X_i</math> and <math>Y_i</math> samples come from [[AP_Statistics_Curriculum_2007#Chapter_V:_Normal_Probability_Distribution |Normal distributions]].

-

Because we are focusing on the differences, we can use the same reasoning as we did in the [[AP_Statistics_Curriculum_2007_Hypothesis_S_Mean#.28Approximately.29_Nornal_Process_with_Unknown_Variance |single sample case]] to calculate the standard error (i.e., the standard deviation of the sampling distribution of <math>\overline{d}</math>) of <math>\overline{d}={1\over n}\sum_{i=1}^n{d_i}</math>.

+

Since we are focusing on the differences, we can use the same reasoning as we did in the [[AP_Statistics_Curriculum_2007_Hypothesis_S_Mean#.28Approximately.29_Nornal_Process_with_Unknown_Variance |single sample case]] to calculate the standard error (i.e., the standard deviation of the sampling distribution of <math>\overline{d}</math>) of <math>\overline{d}={1\over n}\sum_{i=1}^n{d_i}</math>.

Thus, the standard error of <math>\overline{d}</math> is given by <math>{{1\over \sqrt{n}} \sqrt{\sum_{i=1}^n{(d_i-\overline{d})^2\over n-1}}}</math>, where <math>d_i=X_i-Y_i, \forall 1\leq i\leq n</math>.

Thus, the standard error of <math>\overline{d}</math> is given by <math>{{1\over \sqrt{n}} \sqrt{\sum_{i=1}^n{(d_i-\overline{d})^2\over n-1}}}</math>, where <math>d_i=X_i-Y_i, \forall 1\leq i\leq n</math>.

-

===[[AP_Statistics_Curriculum_2007_Estim_S_Mean | Confidence Interval]] of the difference of Means===

+

===[[AP_Statistics_Curriculum_2007_Estim_S_Mean | Confidence Interval]] of the Difference of Means===

The interval estimation of the difference of two means (or '''Confidence intervals''') is constructed as follows. Choose a confidence level <math>(1-\alpha)100%</math>, where <math>\alpha</math> is small (e.g., 0.1, 0.05, 0.025, 0.01, 0.001, etc.). Then a <math>(1-\alpha)100%</math> confidence interval for <math>\mu_1 - \mu_2</math> is defined in terms of the T-distribution:

The interval estimation of the difference of two means (or '''Confidence intervals''') is constructed as follows. Choose a confidence level <math>(1-\alpha)100%</math>, where <math>\alpha</math> is small (e.g., 0.1, 0.05, 0.025, 0.01, 0.001, etc.). Then a <math>(1-\alpha)100%</math> confidence interval for <math>\mu_1 - \mu_2</math> is defined in terms of the T-distribution:

Both the confidence intervals and the hypothesis testing methods in the paired design require Normality of both samples. If these parametric assumptions are invalid we must use a [[AP_Statistics_Curriculum_2007_NonParam_2MedianPair | not-parametric (distribution free test)]], even if the latter is less powerful.

Both the confidence intervals and the hypothesis testing methods in the paired design require Normality of both samples. If these parametric assumptions are invalid we must use a [[AP_Statistics_Curriculum_2007_NonParam_2MedianPair | not-parametric (distribution free test)]], even if the latter is less powerful.

-

===[[EBook#Chapter_VIII:_Hypothesis_Testing | Hypothesis Testing]] about the difference of Means===

+

===[[EBook#Chapter_VIII:_Hypothesis_Testing | Hypothesis Testing]] about the Difference of Means===

* If the two populations that the {<math>X_i</math>} and {<math>Y_i</math>} samples were drawn from are approximately Normal, then the [http://en.wikipedia.org/wiki/Hypothesis_testing#Common_test_statistics Test statistics] is:

+

* If the two populations that the {<math>X_i</math>} and {<math>Y_i</math>} samples were drawn from are approximately Normal, then the [http://en.wikipedia.org/wiki/Hypothesis_testing#Common_test_statistics Test Statistics] is:

The SE estimate will be smaller for correctly paired data. If we look at the within each sample at the data we notice variation from one subject to the next. This information gets incorporated into the SE for the independent t-test via <math>s_1</math> and <math>s_2</math>. The original reason we paired was to try to control for some of this inter-subject variation, which is not of interest in the paired design. Notice that the inter-subject variation has no influence on the SE for the paired test, because only the differences were used in the calculation. The price of pairing is smaller degrees of freedom of the T-test. However, this can be compensated with a smaller SE if we had paired correctly.

+

The SE estimate will be '''smaller''' for correctly paired data. If we look within each sample at the data, we notice variation from one subject to the next. This information gets incorporated into the SE for the independent t-test via <math>s_1</math> and <math>s_2</math>. The original reason we paired was to try to control for some of this inter-subject variation, which is not of interest in the paired design. Notice that the inter-subject variation has no influence on the SE for the paired test, because only the differences were used in the calculation. The price of pairing is smaller degrees of freedom of the T-test. However, this can be compensated with a smaller SE if we had paired correctly.

-

Pairing is used to reduce bias and increase precision in our inference. By matching/blocking we can control variation due to extraneous variables. For example, if two groups are matched on age, then a comparison between the groups is free of any bias due to a difference in age distribution. Pairing is a strategy of design, not an analysis tool. Pairing needs to be carried out before the data are observed. It is not correct to use the observations to make pairs after the data has been collected.

+

'''Pairing''' is used to ''reduce'' bias and ''increase'' precision in our inference. By '''matching/blocking''' we can control variation due to extraneous variables.

+

+

For example, if two groups are matched on age, then a comparison between the groups is free of any bias due to a difference in age distribution.

+

+

Pairing is a strategy of design, not an analysis tool. Pairing needs to be carried out before the data are observed. It is not correct to use the observations to make pairs after the data has been collected.

: <math>p-value=P(T_{(df=9)}>T_o=5.4022)=0.000216</math> for this (one-sided) test. Therefore, we '''can reject''' the null hypothesis at <math>\alpha=0.05</math>! The left white area at the tails of the T(df=9) distribution depict graphically the probability of interest, which represents the strenght of the evidence (in the data) against the Null hypothesis. In this case, this area is 0.000216, which is much smaller than the initially set [[AP_Statistics_Curriculum_2007_Hypothesis_Basics | Type I]] error <math>\alpha = 0.05</math> and we reject the null hypothesis.

+

: <math>p-value=P(T_{(df=9)}>T_o=5.4022)=0.000216</math> for this (one-sided) test.

+

+

Therefore, we '''can reject''' the null hypothesis at <math>\alpha=0.05</math>! The left white area at the tails of the T(df=9) distribution depicts graphically the probability of interest, which represents the strength of the evidence (in the data) against the Null hypothesis. In this case, this area is 0.000216, which is much smaller than the initially set [[AP_Statistics_Curriculum_2007_Hypothesis_Basics | Type I]] error <math>\alpha = 0.05</math> and we reject the null hypothesis.

These data show that the true mean thickness of plaque after two years of treatment with Vitamin E is statistically significantly different than before the treatment (p =0.000216). In other words, vitamin E appears to be an effective in changing carotid artery plaque after treatment. The practical effect does appear to be < 60 microns; however, this may be clinically sufficient and justify patient treatment.

These data show that the true mean thickness of plaque after two years of treatment with Vitamin E is statistically significantly different than before the treatment (p =0.000216). In other words, vitamin E appears to be an effective in changing carotid artery plaque after treatment. The practical effect does appear to be < 60 microns; however, this may be clinically sufficient and justify patient treatment.

-

====Paired test Validity====

+

====Paired Test Validity====

-

Both the confidence intervals and the hypothesis testing methods in the paired design require Normality of both samples. If these parametric assumptions are invalid we must use a [[AP_Statistics_Curriculum_2007_NonParam_2MedianPair | not-parametric (distribution free test)]], even if the latter is less powerful.

+

Both the confidence intervals and the hypothesis testing methods in the paired design require Normality of both samples. If these parametric assumptions are invalid, we must use a [[AP_Statistics_Curriculum_2007_NonParam_2MedianPair | not-parametric (distribution free test)]], even if the latter is less powerful.

The plots below indicate that Normal assumptions are not unreasonable for these data, and hence we may be justified in using the one-sample T-test in this case.

The plots below indicate that Normal assumptions are not unreasonable for these data, and hence we may be justified in using the one-sample T-test in this case.

Line 146:

Line 152:

====Paired vs. Independent Testing====

====Paired vs. Independent Testing====

Suppose we accidentally analyzed the groups independently (using the [[AP_Statistics_Curriculum_2007_Infer_2Means_Indep |independent T-test]]) rather than using this paired test (this would be an incorrect way of analyzing this ''before-after'' data). How would this change our results and findings?

Suppose we accidentally analyzed the groups independently (using the [[AP_Statistics_Curriculum_2007_Infer_2Means_Indep |independent T-test]]) rather than using this paired test (this would be an incorrect way of analyzing this ''before-after'' data). How would this change our results and findings?

: <math>p-value=P(T>1.38)= 0.100449</math> and we would have failed to reject the null-hypothesis ('''incorrect!''').

+

: \(p-value=P(T>1.38)= 0.100449\) and we would have failed to reject the null-hypothesis ('''[[AP_Statistics_Curriculum_2007_Infer_2Means_Dep#Inference|incorrect!]]''')

Similarly, had we incorrectly used the [[AP_Statistics_Curriculum_2007_Infer_2Means_Indep |independent design]] and constructed a corresponding Confidence interval, we would obtain an incorrect inference:

Similarly, had we incorrectly used the [[AP_Statistics_Curriculum_2007_Infer_2Means_Indep |independent design]] and constructed a corresponding Confidence interval, we would obtain an incorrect inference:

Inferences About Two Means: Dependent Samples

In all study designs, it is always critical to clearly identify whether samples we compare come from dependent or independent populations. There is a general formulation for the significance testing when the samples are independent. The fact that there may be uncountable many different types of dependencies that prevents us from having a similar analysis protocol for all dependent sample cases. However, in one specific case - paired samples - we have a theory to generalize the significance testing analysis protocol. Two populations (or samples) are dependent because of pairing (or paired) if they are linked in some way, usually by a direct relationship. For example, measure the weight of subjects before and after a six month diet.

Paired Designs

These are the most common Paired Designs, in which the idea of pairing is that members of a pair are similar to each other with respect to extraneous variables.

Recall that for a random sample {} of the process, the population mean may be estimated by the sample average, .

The standard error of is given by .

Analysis Protocol for Paired Designs

To study paired data, we would like to examine the differences between each pair. Suppose {} and {} represent the 2 paired samples. Then we want to study the difference sample {}. Notice the effect of the pairings of each Xi and Yi.

Now we can clearly see that the group effect (group differences) is directly represented in the {di} sequence. The one-sample T test is the proper strategy to analyze the difference sample {di}, if the Xi and Yi samples come from Normal distributions.

Since we are focusing on the differences, we can use the same reasoning as we did in the single sample case to calculate the standard error (i.e., the standard deviation of the sampling distribution of ) of .

The interval estimation of the difference of two means (or Confidence intervals) is constructed as follows. Choose a confidence level (1 − α)100%, where α is small (e.g., 0.1, 0.05, 0.025, 0.01, 0.001, etc.). Then a (1 − α)100% confidence interval for μ1 − μ2 is defined in terms of the T-distribution:

Both the confidence intervals and the hypothesis testing methods in the paired design require Normality of both samples. If these parametric assumptions are invalid we must use a not-parametric (distribution free test), even if the latter is less powerful.

Test Statistics

If the two populations that the {Xi} and {Yi} samples were drawn from are approximately Normal, then the Test Statistics is:

.

Effects of Ignoring the Pairing

The SE estimate will be smaller for correctly paired data. If we look within each sample at the data, we notice variation from one subject to the next. This information gets incorporated into the SE for the independent t-test via s1 and s2. The original reason we paired was to try to control for some of this inter-subject variation, which is not of interest in the paired design. Notice that the inter-subject variation has no influence on the SE for the paired test, because only the differences were used in the calculation. The price of pairing is smaller degrees of freedom of the T-test. However, this can be compensated with a smaller SE if we had paired correctly.

Pairing is used to reduce bias and increase precision in our inference. By matching/blocking we can control variation due to extraneous variables.

For example, if two groups are matched on age, then a comparison between the groups is free of any bias due to a difference in age distribution.

Pairing is a strategy of design, not an analysis tool. Pairing needs to be carried out before the data are observed. It is not correct to use the observations to make pairs after the data has been collected.

Example

Suppose we measure the thickness of plaque (mm) in the carotid artery of 10 randomly selected patients with mild atherosclerotic disease. Two measurements are taken, thickness before treatment with Vitamin E (baseline) and after two years of taking Vitamin E daily. Formulate testable hypothesis and make inference about the effect of the treatment at α = 0.05.

Therefore, we can reject the null hypothesis at α = 0.05! The left white area at the tails of the T(df=9) distribution depicts graphically the probability of interest, which represents the strength of the evidence (in the data) against the Null hypothesis. In this case, this area is 0.000216, which is much smaller than the initially set Type I error α = 0.05 and we reject the null hypothesis.

Conclusion

These data show that the true mean thickness of plaque after two years of treatment with Vitamin E is statistically significantly different than before the treatment (p =0.000216). In other words, vitamin E appears to be an effective in changing carotid artery plaque after treatment. The practical effect does appear to be < 60 microns; however, this may be clinically sufficient and justify patient treatment.

Paired Test Validity

Both the confidence intervals and the hypothesis testing methods in the paired design require Normality of both samples. If these parametric assumptions are invalid, we must use a not-parametric (distribution free test), even if the latter is less powerful.

The plots below indicate that Normal assumptions are not unreasonable for these data, and hence we may be justified in using the one-sample T-test in this case.

Paired vs. Independent Testing

Suppose we accidentally analyzed the groups independently (using the independent T-test) rather than using this paired test (this would be an incorrect way of analyzing this before-after data). How would this change our results and findings?