{"id":499,"date":"2020-05-05T08:50:48","date_gmt":"2020-05-05T12:50:48","guid":{"rendered":"http:\/\/pressbooks.library.upei.ca\/montelpare\/?post_type=chapter&#038;p=499"},"modified":"2020-08-29T17:55:03","modified_gmt":"2020-08-29T21:55:03","slug":"using-the-t-test-statistic-to-compute-parametric-tests-of-significance","status":"publish","type":"chapter","link":"https:\/\/pressbooks.library.upei.ca\/montelpare\/chapter\/using-the-t-test-statistic-to-compute-parametric-tests-of-significance\/","title":{"raw":"Applying the Student's t-test for Single and Paired Samples","rendered":"Applying the Student&#8217;s t-test for Single and Paired Samples"},"content":{"raw":"<div class=\"textbox textbox--learning-objectives\"><header class=\"textbox__header\">\r\n<p class=\"textbox__title\">Learning Objectives<\/p>\r\n\r\n<\/header>\r\n<div class=\"textbox__content\">\r\n\r\nAfter reading this chapter you should be able to:\r\n<ul>\r\n \t<li>Calculate differences when using the student\u2019s t-test and when using a matched pairwise comparison t-test<\/li>\r\n \t<li>Apply and test the null hypothesis for t-test calculations<\/li>\r\n \t<li>Apply the decision rule to evaluate a null hypothesis<\/li>\r\n \t<li>Write a SAS program to evaluate the student\u2019s t-test and a matched pairwise comparison t-test<\/li>\r\n<\/ul>\r\n<\/div>\r\n<\/div>\r\n<h2>Introduction to the Tests of Significance for Mean Differences<\/h2>\r\nIn this next section, we will test the significance of differences between the mean for a set of data and the mean for a comparison set of data.\u00a0 In the first instance, we will compare the mean score from a single set of data to the expected mean for a population. Next, we will compare the mean score for a change from one day to another; and then, in the second section, we will compare the means from two different groups.\r\n\r\nAn important consideration in calculating any statistic is that the mathematics of the computation doesn\u2019t consider the subject of the scores.\u00a0 That is, the data can be extracted from any source and the mathematics will be the same.\u00a0 For example, consider the following two variables: annual income, and waiting time in the emergency department. The mathematics to calculate the means for each set of data are the same, despite that the two variables hold different information and different meaning.\r\n\r\nIn a situation, where you have data for a single group (as in a one-sample design), you can also compute a difference score between the mean for the set of observations and then compare your single group mean score against the population score.\u00a0 The population score is referred to as the parameter estimate since we never really know the true population score.\r\n<h2>Computing the Student\u2019s single sample t-test:<\/h2>\r\n<p style=\"text-align: left\">Let\u2019s consider first the Student\u2019s single-sample t-test.\u00a0 This means that we are going to compare the mean from a sample of data against the mean for the population (which we generally accept to be 0). The statistical test that we will use in this computation is the Student\u2019s t-test.<\/p>\r\n\r\n<div class=\"textbox shaded\"><strong>The purpose of the Student's t-test is to evaluate the null hypothesis of the sample mean against the population mean.<\/strong><\/div>\r\n&nbsp;\r\n\r\n[latex]H_{0}: \\overline{x} = \\mu[\/latex]\r\n\r\n&nbsp;\r\n<ul>\r\n \t<li>where:\u00a0 [latex]H_0[\/latex] refers to the null hypothesis<\/li>\r\n \t<li>[latex]\\overline{x}[\/latex] refers to the mean of the sample or the distribution<\/li>\r\n \t<li>[latex]\\mu[\/latex] refers to the mean of the population<\/li>\r\n<\/ul>\r\nTo evaluate the significance of the difference between <strong>a sample mean<\/strong> (the mean for the set of observed scores) and <strong>an expected mean<\/strong> (the mean for the population), use the Student\u2019s t-test. That is to ask, \u00a0\u201cIs the mean for a sample of scores the same as the mean expected to represent a population?\u201d\r\n\r\n<img src=\"http:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/normal1-300x223.png\" alt=\"\" class=\"aligncenter size-medium wp-image-960\" width=\"300\" height=\"223\" \/>\r\n\r\nAbove is an illustration of the population distribution. As shown in the illustration below, we draw (select, observe, record) the sample distribution from the population distribution.\r\n\r\n<img src=\"http:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/normal2-300x193.png\" alt=\"\" class=\"aligncenter size-medium wp-image-962\" width=\"300\" height=\"193\" \/>\r\n\r\nUnder the null hypothesis, we test if the mean of the sample is truly representative of the mean for a population. This test is based on the null hypothesis question expressed here: <img src=\"http:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/nullform.png\" alt=\"\" class=\"size-full wp-image-507 aligncenter\" width=\"170\" height=\"37\" \/>\r\n\r\n<hr \/>\r\n<p class=\"ABodyCopy\"><span lang=\"EN-US\">Considering an approach in which we use randomized representative sampling to collect our data, we should expect that the sample mean should be the same as the population mean. If this outcome were observed, then we would accept the null hypothesis.<\/span><span lang=\"EN-US\">\u00a0<\/span><\/p>\r\n<p class=\"ABodyCopy\"><span lang=\"EN-US\">To evaluate the null hypothesis, which is to say, to determine if, in fact, the null hypothesis is true: that the sample represents the population; we compare the sample mean to the population mean, whereby our sample mean is the mean for the set of observations and the population mean is the mean for the set of expected scores.<\/span><\/p>\r\n<p class=\"ABodyCopy\"><span lang=\"EN-US\">Therefore, to evaluate the difference between a sample mean and an expected mean we use the Student\u2019s t-test, as shown in the following formula.<\/span><\/p>\r\n[latex] \\textit{Student's t-test} = {\\overline{x}_{observed}-\\overline{x}_{expected}\\over{\\frac{S_{observed}}{\\sqrt{n_{observed}}}}}[\/latex]\r\n<div>\r\n\r\n<hr \/>\r\n\r\nSAMPLE CALCULATION 29.1\r\n\r\n<\/div>\r\nIn this first example, we will use the student's t-test to evaluate the mean score for a continuous random variable for a selection of individuals drawn from a population. In Table 29.1, data for the number of hours in a given month that individuals waited to see their healthcare provider are presented.\u00a0 You are asked to compute the average wait time for this sample and determine if the average for the sample is significantly different than that which is expected in the population.\r\n\r\nTable 29.1 Monthly wait time in hours for a random sample of individuals\r\n<table style=\"border-collapse: collapse;width: 100%\" border=\"0\">\r\n<thead>\r\n<tr class=\"shaded\">\r\n<td class=\"border\" style=\"width: 50%;vertical-align: middle;text-align: center\" scope=\"col\">Patient ID<\/td>\r\n<td class=\"border\" style=\"width: 50%;text-align: center\">Hours Waited<\/td>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">01<\/td>\r\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\"><strong>12<\/strong><\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">02<\/td>\r\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">13.5<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">03<\/td>\r\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">8.5<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">04<\/td>\r\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">4.5<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">05<\/td>\r\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">10.5<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">06<\/td>\r\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">15.5<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">07<\/td>\r\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">12.5<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">08<\/td>\r\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">9.5<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">09<\/td>\r\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">11<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">10<\/td>\r\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">7.5<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\nHere we use the Student\u2019s t-test to evaluate the null hypothesis that the observed mean is equal to the expected mean in this set of scores. In the application of the t-test, we assume that the mean score for the sample is representative of the mean score for population, and likewise, that the variance for this sample of scores is an estimate of the variance for the population. We also assume, unless we have some other information, that these data were drawn from a normal distribution.\r\n\r\nIn this example, we are assessing the null hypothesis: H0: [latex]\\overline{x} = \\mu[\/latex], also presented as H0: [latex]\\overline{x} = 0[\/latex]. In using the t-test we assume that the population mean [latex][\\mu][\/latex]has a value of 0 and a variance (standard deviation) of 1. When we are applying the t-test, we are comparing our observed sample mean against the expected population mean of 0 with a variance of 1. The SAS code below produces a test of the null hypothesis using the Student\u2019s t-test.\r\n<div class=\"textbox textbox--exercises\"><header class=\"textbox__header\">\r\n<p class=\"textbox__title\">SAS Code to Compute the Student\u2019s t-Test for a Single Sample<\/p>\r\n\r\n<\/header>\r\n<div class=\"textbox__content\">\r\n<div>DATA STUDENT;\r\nINPUT ID SCORE @@;\r\nDATALINES;\r\n001 12.0 002 13.5 003 08.5 004 04.5 005 10.5 006 15.5 007 12.5 008 09.5 009 11.0 010 07.5\r\n;\r\nPROC SORT DATA=STUDENT; BY ID;\r\nTITLE \u201cSTUDENT\u2019S t-TEST TO EVALUATE WAIT TIMES\u201d;\r\nPROC UNIVARIATE; VAR SCORE;\r\nPROC MEANS N MEAN MEDIAN T STDERR PRT;\r\nVAR SCORE; RUN;<\/div>\r\n<\/div>\r\n<\/div>\r\n<p style=\"text-align: left\">The SAS code above produces several important output tables to help us explore our dataset and to evaluate the null hypothesis: H0: [latex]\\overline{x} = 0[\/latex]. In the output shown below, we can review the descriptive statistics for the dependent variable which we labeled SCORE. In this output we see that the mean score for the sample was 10.5 with a standard deviation of \u00b1 3.17.<\/p>\r\n<p style=\"text-align: center\"><strong>Table 29.2 SAS Output for Dependent Variable: SCORE<\/strong><\/p>\r\n\r\n<div align=\"center\">\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td><strong>N<\/strong><\/td>\r\n<td>10<\/td>\r\n<td><strong>Sum Weights<\/strong><\/td>\r\n<td>10<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>Mean<\/strong><\/td>\r\n<td>10.5<\/td>\r\n<td><strong>Sum Observations<\/strong><\/td>\r\n<td>105<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>Std Deviation<\/strong><\/td>\r\n<td>3.1710496<\/td>\r\n<td><strong>Variance<\/strong><\/td>\r\n<td>10.0555556<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>Skewness<\/strong><\/td>\r\n<td>-0.3854798<\/td>\r\n<td><strong>Kurtosis<\/strong><\/td>\r\n<td>0.23914105<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>Uncorrected SS<\/strong><\/td>\r\n<td>1193<\/td>\r\n<td><strong>Corrected SS<\/strong><\/td>\r\n<td>90.5<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>Coeff Variation<\/strong><\/td>\r\n<td>30.2004724<\/td>\r\n<td><strong>Std Error Mean<\/strong><\/td>\r\n<td>1.00277393<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\nBasic Statistical Measures are given here as location -- mean, median and mode, and measures of variability -- standard deviation, variance, tang and interquartile range.\r\n<p style=\"text-align: center\"><strong>Table 29.3 Measures of Location and Variability<\/strong><\/p>\r\n\r\n<div align=\"center\">\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td><strong>Mean<\/strong><\/td>\r\n<td>10.50000<\/td>\r\n<td><strong>Std Deviation<\/strong><\/td>\r\n<td>3.17105<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>Median<\/strong><\/td>\r\n<td>10.75000<\/td>\r\n<td><strong>Variance<\/strong><\/td>\r\n<td>10.05556<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>Mode<\/strong><\/td>\r\n<td>.<\/td>\r\n<td><strong>Range<\/strong><\/td>\r\n<td>11.00000<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>\u00a0<\/strong><\/td>\r\n<td><\/td>\r\n<td><strong>Interquartile Range<\/strong><\/td>\r\n<td>4.00000<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\nThe SAS code also produced statistics that help us to determine a decision with regard to accepting or rejecting the null hypothesis. In Table 29.4 below, we see that the Student\u2019s t value is given as 10.47, and the corresponding p-value was Prt &gt; |t| &lt;0.0001. \u00a0Because the probability value (Prt) associated with the Student\u2019s t score is &lt;0.05 the outcome indicates that the mean value (10.5 \u00b1 3.17) was significantly different than 0, and therefore we would reject the null hypothesis that H0: [latex]\\overline{x} = 0[\/latex].\r\n<p style=\"text-align: center\"><strong>Table 29.4 SAS Output for Tests of [latex]\\overline{x} = 0[\/latex] Tests for Location: Mu=0<\/strong><\/p>\r\n\r\n<div align=\"center\">\r\n<table class=\" aligncenter\">\r\n<thead>\r\n<tr>\r\n<td style=\"width: 86.25px\"><strong>Test<\/strong><\/td>\r\n<td style=\"width: 58.25px\"><strong>Statistic<\/strong><\/td>\r\n<td style=\"width: 57.45px\"><strong>p Value<\/strong><\/td>\r\n<td style=\"width: 60.65px\"><\/td>\r\n<td style=\"width: 47.05px\"><\/td>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td style=\"width: 86.25px\"><strong>Student's t<\/strong><\/td>\r\n<td style=\"width: 58.25px\"><strong>t<\/strong><\/td>\r\n<td style=\"width: 57.45px\">10.47095<\/td>\r\n<td style=\"width: 60.65px\"><strong>Pr &gt; |t|<\/strong><\/td>\r\n<td style=\"width: 47.05px\">&lt;.0001<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 86.25px\"><strong>Sign<\/strong><\/td>\r\n<td style=\"width: 58.25px\"><strong>M<\/strong><\/td>\r\n<td style=\"width: 57.45px\">5<\/td>\r\n<td style=\"width: 60.65px\"><strong>Pr &gt;= |M|<\/strong><\/td>\r\n<td style=\"width: 47.05px\">0.0020<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 86.25px\"><strong>Signed Rank<\/strong><\/td>\r\n<td style=\"width: 58.25px\"><strong>S<\/strong><\/td>\r\n<td style=\"width: 57.45px\">27.5<\/td>\r\n<td style=\"width: 60.65px\"><strong>Pr &gt;= |S|<\/strong><\/td>\r\n<td style=\"width: 47.05px\">0.0020<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\n<div>\r\n\r\n<hr \/>\r\n\r\n<strong>SAMPLE COMPUTATION 29.2<\/strong>\r\n\r\n<\/div>\r\nSo, what if in this specific example we knew that the real population mean wasn\u2019t <strong>0<\/strong> but that the mean value was actually a specific number that we determined from the literature.\u00a0 Let\u2019s say that the expected mean should be a value of <strong><em>10<\/em><\/strong> for this sample.\u00a0 In the following example, we can redo the computations of the Student\u2019s t-test and set the population mean to the specific value of 10. <span style=\"color: #0000ff\"><strong><em>In practice, the value against which the mean is compared should be based on theoretical considerations and\/or previous research so that for many experiments the outcome range of the dependent variable can be known.<\/em><\/strong><\/span>\r\n\r\nTo test the null hypothesis for the one sample scenario that the expected mean = 10, we compare the <em>t-score observed<\/em> against the <em>t-score critical.\u00a0 <\/em>The decision rule then becomes: if the <em>t-test score observed<\/em> is greater than the <em>t-test score critical <\/em>then we reject the null hypothesis and state that the sample mean is significantly different than the population mean.\r\n<div class=\"textbox textbox--exercises\"><header class=\"textbox__header\">\r\n<p class=\"textbox__title\">Code to Compute Student\u2019s or Single Sample t-test Using Proc t-test and Setting <em>\u03bc =10<\/em><\/p>\r\n\r\n<\/header>\r\n<div class=\"textbox__content\">\r\n<div>OPTIONS PAGESIZE=65 LINESIZE=80;\r\nDATA STUDENT;\r\nINPUT ID SCORE @@;\r\nDATALINES;\r\n001 12.0 002 13.5 003 08.5 004 04.5 005 10.5 006 15.5 007 12.5 008 09.5 009 11.0 010 07.5\r\n;\r\nPROC SORT DATA=STUDENT; BY ID;\r\nPROC TTEST H0=10;\r\nVAR SCORE;\r\nTITLE1 \u201ct-TEST WHEN EXPECTED MEAN NOT 0\u201d;\r\nTITLE2 \u201cEXPECTED MEAN = 10\u201d;\r\nRUN;<\/div>\r\n<\/div>\r\n<\/div>\r\nTable 29.5 \u201ct-TEST WHEN EXPECTED MEAN NOT 0\u201d --\u00a0\u201cEXPECTED MEAN = 10\u201d\r\n<div align=\"center\">\r\n<table>\r\n<thead>\r\n<tr>\r\n<td><strong>N<\/strong><\/td>\r\n<td><strong>Mean<\/strong><\/td>\r\n<td><strong>Std\u00a0Dev<\/strong><\/td>\r\n<td><strong>Std\u00a0Err<\/strong><\/td>\r\n<td><strong>Minimum<\/strong><\/td>\r\n<td><strong>Maximum<\/strong><\/td>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td>10<\/td>\r\n<td>10.5<\/td>\r\n<td>3.17<\/td>\r\n<td>1.00<\/td>\r\n<td>4.50<\/td>\r\n<td>15.50<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\n<div align=\"center\">\r\n<table style=\"width: 354px\">\r\n<thead>\r\n<tr>\r\n<td style=\"width: 56.65px\"><strong>Mean<\/strong><\/td>\r\n<td style=\"width: 269.45px\"><strong>95% CL Mean<\/strong><\/td>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td style=\"width: 56.65px\">10.5\u00b13.17<\/td>\r\n<td style=\"width: 269.45px\">8.23[latex]\\rightarrow[\/latex]12.77<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\n<div align=\"center\">\r\n<table>\r\n<thead>\r\n<tr>\r\n<td><strong>DF<\/strong><\/td>\r\n<td><strong>t\u00a0Value<\/strong><\/td>\r\n<td><strong>Pr\u00a0&gt;\u00a0|t|<\/strong><\/td>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td>9<\/td>\r\n<td>0.50<\/td>\r\n<td>0.6300<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\nIn the data presented above, the computed mean was 10.5 with a standard deviation of 3.17. This was compared against an expected mean of 10 and thus produced a t-test score, labeled here as t Value, equal to 0.50. The probability associated with this t-test score is given in the table as Pr &gt;|t|, and is equal to 0.6300. Because the p-value is greater than 0.05 we accept the null hypothesis that the observed mean for the sample is not different than the apriori mean we had set at\u00a0 [latex]\\overline{x} = 10[\/latex].\r\n\r\nThis SAS output for the t-test procedure also produces a Q-Q plot. The Q-Q plot is a visual representation that the data used in this example were drawn from a normal population.\u00a0 If the Q-Q plot presents a relatively straight line then we can assume that the data were drawn from a population that was normally distributed. However, if the data are not representative of a somewhat straight line then we can suggest that the data were not drawn from a population that we would consider to be normally distributed. Notice in Figure 29.1, below, the Q-Q plot shows a straight line and thereby indicates that the data were drawn from a population that was normally distributed.\r\n\r\nFigure 29.1 Q-Q plot of data to demonstrate normality in the sample distribution\r\n\r\n<\/div>\r\n<img src=\"http:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/qqplot.png\" alt=\"\" width=\"729\" height=\"545\" class=\"aligncenter size-full wp-image-1850\" \/>\r\n<h1><strong>The Pairwise t-test<\/strong><\/h1>\r\n<span style=\"color: #0000ff\"><strong>To evaluate the significance of the difference in a pre to post design t-test, use<\/strong> <strong>the pairwise t-test formula.<\/strong><\/span>\r\n<p style=\"text-align: center\">Figure 29.2 Evaluating the shift from pretest to posttest<\/p>\r\n<img src=\"http:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/SHIFT.png\" alt=\"\" width=\"478\" height=\"306\" class=\"aligncenter size-full wp-image-1855\" \/>\r\n\r\nThe pre to post (pairwise) t-test measures the amount of shift in the data over the time interval. The formula to compute the pairwise t-test uses the average difference in the measure of interest, from the pre-test score to the post-test score, and then divided by the standard error of the average difference.\u00a0 The standard error of the average difference is computed by dividing the standard deviation of the average difference by the square root of the number of cases in the pairwise comparison.\r\n<p style=\"text-align: center\">Figure 29.3 Formula to evaluate the Pre to Post-test design<\/p>\r\n<img src=\"http:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/pairwise.png\" alt=\"\" width=\"762\" height=\"150\" class=\"aligncenter size-full wp-image-1856\" \/>\r\n\r\n<hr \/>\r\n\r\n<strong>Computing a Pairwise Comparison T-Test to Evaluate Change <\/strong>\r\n\r\nWe can use the formula for the pairwise t-test shown above, to compute the significance of the change in the mean score from the pre-test data to the post-test data for the following two sets of 10 numbers.\r\n\r\n<strong>Pre test data<\/strong>\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td>Participant Code<\/td>\r\n<td>001<\/td>\r\n<td>002<\/td>\r\n<td>003<\/td>\r\n<td>004<\/td>\r\n<td>005<\/td>\r\n<td>006<\/td>\r\n<td>007<\/td>\r\n<td>008<\/td>\r\n<td>009<\/td>\r\n<td>010<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Score<\/td>\r\n<td>\u00a034<\/td>\r\n<td>\u00a054<\/td>\r\n<td>\u00a060<\/td>\r\n<td>68<\/td>\r\n<td>53<\/td>\r\n<td>70<\/td>\r\n<td>81<\/td>\r\n<td>87<\/td>\r\n<td>65<\/td>\r\n<td>55<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<strong>Post test data<\/strong>\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td>Participant Code<\/td>\r\n<td>001<\/td>\r\n<td>002<\/td>\r\n<td>003<\/td>\r\n<td>004<\/td>\r\n<td>005<\/td>\r\n<td>006<\/td>\r\n<td>007<\/td>\r\n<td>008<\/td>\r\n<td>009<\/td>\r\n<td>010<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Score<\/td>\r\n<td>44<\/td>\r\n<td>75<\/td>\r\n<td>72<\/td>\r\n<td>98<\/td>\r\n<td>73<\/td>\r\n<td>80<\/td>\r\n<td>91<\/td>\r\n<td>99<\/td>\r\n<td>69<\/td>\r\n<td>76<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<strong>Analyzing these data as a paired t-test. <\/strong>\r\n\r\nIn this analysis, we will treat the difference scores produced by subtracting the pre-test scores from the post-test scores.\u00a0 In order to do this, we will need to create a new variable. We can create a variable DIFFSCR by subtracting the post-test score from the pre-test scores. As a rule, it is always best to keep our variable names simple and to restrict the label to 8 characters or less. The SAS code to set up this analysis is shown below. However, it is important to note that the degrees of freedom for the paired t-test uses a single sample mean and therefore is df = n \u2013 1, and in this case, df = 10 \u2013 1 = 9 so that the t critical value for \u03b1 = 0.05 is 2.262 for a two-tailed test and 1.833 for a one-tailed test.\r\n<div class=\"textbox textbox--exercises\"><header class=\"textbox__header\">\r\n<p class=\"textbox__title\">SAS Code to Compute pairwise difference with a t-test<\/p>\r\n\r\n<\/header>\r\n<div class=\"textbox__content\">OPTIONS PAGESIZE=65 LINESIZE=80;\r\nDATA PAIRWISE;\r\nINPUT @1 ID PRETEST POSTTEST;\r\nDIFFSCR=(POSTTEST - PRETEST);\r\nDATALINES;\r\n001 34 44\r\n002 54 75\r\n003 60 72\r\n004 68 98\r\n005 53 73\r\n006 70 80\r\n007 81 91\r\n008 87 99\r\n009 65 69\r\n010 55 76\r\n;<\/div>\r\n<\/div>\r\nIn this analysis, we will evaluate the set of difference scores as a single group (as in a one-sample design) just as we did for the student\u2019s t-test.\u00a0 Under this design, we can use the <strong><em>single-sample t-test <\/em><\/strong><em>or<strong> Student\u2019s t-test<\/strong><\/em> procedure to compute the significance of the difference scores. Therefore, under this design, we are testing the null hypothesis that the difference between the pre and post scores = 0 (i.e. no difference).\r\n\r\nStep 1 in computing the difference scores between the results in the pre test and the results in the post test was to create the variable: DIFFSCR. In this example uses POSTTEST \u2013 PRETEST to show a positive change (an increase in score values). The production of the difference score was accomplished with the SAS. command: DIFFSCR=(POSTTEST - PRETEST);\r\n\r\nUsing the dependent variable DIFFSCR, and the following SAS Code we produced three different SAS outputs: \u00a0i) <strong><em>PROC UNIVARIATE<\/em><\/strong><em>, ii) <strong>PROC MEANS<\/strong><\/em>, iii) <strong><em>PROC TTEST. \u00a0<\/em><\/strong>\r\n<div class=\"textbox shaded\">PROC SORT DATA=PAIRWISE; BY ID;\r\nPROC UNIVARIATE;\u00a0 VAR DIFFSCR;\r\nPROC MEANS N MEAN MEDIAN T STDERR PRT;\u00a0 VAR DIFFSCR;\r\nPROC TTEST; VAR DIFFSCR;\r\nRUN;<\/div>\r\nThe results for each of these procedures are shown below the descriptive statistics produced by the Proc Univariate procedure.\r\n<div align=\"center\">\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td><strong>N<\/strong><\/td>\r\n<td>10<\/td>\r\n<td><strong>Sum Weights<\/strong><\/td>\r\n<td>10<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>Mean<\/strong><\/td>\r\n<td>15<\/td>\r\n<td><strong>Sum Observations<\/strong><\/td>\r\n<td>150<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>Std Deviation<\/strong><\/td>\r\n<td>7.7172246<\/td>\r\n<td><strong>Variance<\/strong><\/td>\r\n<td>59.5555556<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>Skewness<\/strong><\/td>\r\n<td>0.65636272<\/td>\r\n<td><strong>Kurtosis<\/strong><\/td>\r\n<td>0.00011636<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\n<h4>Evaluation of the Null Hypothesis based on output\u00a0for the UNIVARIATE Procedure<\/h4>\r\n<div align=\"center\">\r\n<table>\r\n<thead>\r\n<tr>\r\n<td style=\"width: 86.25px\"><strong>Test<\/strong><\/td>\r\n<td style=\"width: 58.25px\"><strong>Statistic<\/strong><\/td>\r\n<td style=\"width: 57.45px\"><strong>p Value<\/strong><\/td>\r\n<td style=\"width: 60.65px\"><\/td>\r\n<td style=\"width: 47.05px\"><\/td>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td style=\"width: 86.25px\"><strong>Student's t<\/strong><\/td>\r\n<td style=\"width: 58.25px\"><strong>t<\/strong><\/td>\r\n<td style=\"width: 57.45px\">6.146532<\/td>\r\n<td style=\"width: 60.65px\"><strong>Pr &gt; |t|<\/strong><\/td>\r\n<td style=\"width: 47.05px\">0.0002<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 86.25px\"><strong>Sign<\/strong><\/td>\r\n<td style=\"width: 58.25px\"><strong>M<\/strong><\/td>\r\n<td style=\"width: 57.45px\">5<\/td>\r\n<td style=\"width: 60.65px\"><strong>Pr &gt;= |M|<\/strong><\/td>\r\n<td style=\"width: 47.05px\">0.0020<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 86.25px\"><strong>Signed Rank<\/strong><\/td>\r\n<td style=\"width: 58.25px\"><strong>S<\/strong><\/td>\r\n<td style=\"width: 57.45px\">27.5<\/td>\r\n<td style=\"width: 60.65px\"><strong>Pr &gt;= |S|<\/strong><\/td>\r\n<td style=\"width: 47.05px\">0.0020<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\n<h4>Evaluation of the Null Hypothesis based on output for the MEANS Procedure<\/h4>\r\n<div align=\"center\">\r\n<table>\r\n<thead>\r\n<tr>\r\n<td><strong>Analysis Variable: DIFFSCR<\/strong><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>N<\/strong><\/td>\r\n<td><strong>Mean<\/strong><\/td>\r\n<td><strong>Median<\/strong><\/td>\r\n<td><strong>t\u00a0Value<\/strong><\/td>\r\n<td><strong>Std Error<\/strong><\/td>\r\n<td><strong>Pr\u00a0&gt;\u00a0|t|<\/strong><\/td>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td>10<\/td>\r\n<td>15.0000000<\/td>\r\n<td>12.0000000<\/td>\r\n<td>6.15<\/td>\r\n<td>2.4404007<\/td>\r\n<td>0.0002<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\n<h4>Evaluation of the Null Hypothesis based on output for the t-Test Procedure<\/h4>\r\n<div align=\"center\">\r\n<table>\r\n<thead>\r\n<tr>\r\n<td><strong>DF<\/strong><\/td>\r\n<td><strong>t\u00a0Value<\/strong><\/td>\r\n<td><strong>Pr\u00a0&gt;\u00a0|t|<\/strong><\/td>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td>9<\/td>\r\n<td>6.15<\/td>\r\n<td>0.0002<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\nThe important estimates from this output are the mean and variances, which are listed within each of the three SAS procedures. However, each procedure presents the outcome values in different ways.\u00a0 In the PROC UNIVARIATE procedure, all moments of variance are given \u2013 standard deviation, variance, skewness, kurtosis, and standard error.\r\n\r\nHowever, in the PROC MEANS procedure only the mean, median, and standard error are reported when the coding above is used.\u00a0 Finally, the PROC TTEST procedure provides the mean score along with the standard deviation and the computation of the confidence limits. In each basic SAS procedure used above, the Student\u2019s t-test computes the comparison between the sample (based on the difference scores) against the population.\r\n<h2><strong>Application of the General Decision Rule for the Evaluation of the t-Test<\/strong><\/h2>\r\n<strong>\u00a0<\/strong><strong>Student\u2019s t-test:\u00a0 <\/strong>H0: sample mean = population mean.\r\n\r\nTo test this null hypothesis, we compare the <em>t-score observed<\/em> against the <em>t-score critical.\u00a0 <\/em>The decision rule is as follows: <em>If the <\/em><em>t-score observed is greater than the t-score critical then we reject the null hypothesis and state that the sample mean is significantly different than the population mean. <\/em>\r\n\r\n<strong>Pairwise comparisons t-test:\u00a0<\/strong>H0: mean difference for the sample = mean difference for the population\r\n\r\nTo test this null hypothesis, we compare the <em>t-score observed<\/em> against the <em>t-score critical<\/em>.\u00a0 In this case, the t-score is based on an evaluation of the average difference from pre-test to post-test scores against the expected average difference, in a population of scores, should be 0. The decision rule then becomes: <em>If the <\/em><em>t-score observed is greater than the t-score critical then we reject the null hypothesis and state that the change from pre-test scores to post-test scores is significantly different than that which is expected.<\/em>\r\n\r\n<strong>t-tests for two independent samples: <\/strong>H0: mean for group1 = mean for group2\r\n\r\nAgain, to test this null hypothesis we compare the <em>t-score observed<\/em> against the <em>t-score critical<\/em>.\u00a0 In this case the t-score is based on a comparison of the difference of the mean for <strong><em>group1<\/em><\/strong> against the mean for <strong><em>group2<\/em><\/strong>.<em>\u00a0 <\/em>The decision rule is as follows:\u00a0 if the <em>t-score observed<\/em> is greater than the <em>t-score critical <\/em>then we reject the null hypothesis and state that the two means are significantly different from each other.\r\n\r\n<hr \/>\r\n\r\n<strong>Computing a Pairwise Comparison t-Test to Evaluate Change in Resting Blood Pressure<\/strong>\r\n\r\nThe null hypothesis for the paired or pairwise t-test is given below:\r\n<p style=\"text-align: center\">H0: \u00b51 = \u00b52 \u00a0\u00a0\u00a0\u00a0or \u00a0\u00a0\u00a0\u00a0H0: \u00b51-\u00b52=0<\/p>\r\nIn this experiment, a group of 10 individuals agreed to participate in a study of blood pressure changes following exposure to halogen lighting. Resting systolic blood pressure was recorded for each individual. The participants were then exposed to 20 minutes of halogen lighting by playing a video game in a room, which was lit only by halogen lamps. A post-exposure systolic blood pressure reading was recorded for each individual. The results are presented in the following data set.\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td>ID<\/td>\r\n<td>01<\/td>\r\n<td>02<\/td>\r\n<td>03<\/td>\r\n<td>04<\/td>\r\n<td>05<\/td>\r\n<td>06<\/td>\r\n<td>07<\/td>\r\n<td>08<\/td>\r\n<td>09<\/td>\r\n<td>10<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>SEX<\/td>\r\n<td>M<\/td>\r\n<td>F<\/td>\r\n<td>M<\/td>\r\n<td>F<\/td>\r\n<td>M<\/td>\r\n<td>F<\/td>\r\n<td>M<\/td>\r\n<td>F<\/td>\r\n<td>M<\/td>\r\n<td>F<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Pre exposure Systolic BP<\/td>\r\n<td>120<\/td>\r\n<td>132<\/td>\r\n<td>120<\/td>\r\n<td>110<\/td>\r\n<td>115<\/td>\r\n<td>128<\/td>\r\n<td>120<\/td>\r\n<td>112<\/td>\r\n<td>110<\/td>\r\n<td>100<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Post exposure Systolic BP<\/td>\r\n<td>140<\/td>\r\n<td>156<\/td>\r\n<td>145<\/td>\r\n<td>130<\/td>\r\n<td>117<\/td>\r\n<td>148<\/td>\r\n<td>137<\/td>\r\n<td>119<\/td>\r\n<td>127<\/td>\r\n<td>135<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\nIn the following worksheet we compute the significance of the difference between the pre test blood pressures and the post-test blood pressures..\r\n\r\nThe null hypothesis is: Ho: \u00b51\u00a0= \u00b52 \u00a0and the computation of the variance is shown with the raw data in the table below.\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td>ID<\/td>\r\n<td>01<\/td>\r\n<td>02<\/td>\r\n<td>03<\/td>\r\n<td>04<\/td>\r\n<td>05<\/td>\r\n<td>06<\/td>\r\n<td>07<\/td>\r\n<td>08<\/td>\r\n<td>09<\/td>\r\n<td>10<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>SEX<\/td>\r\n<td>M<\/td>\r\n<td>F<\/td>\r\n<td>M<\/td>\r\n<td>F<\/td>\r\n<td>M<\/td>\r\n<td>F<\/td>\r\n<td>M<\/td>\r\n<td>F<\/td>\r\n<td>M<\/td>\r\n<td>F<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Pre exposure Systolic BP<\/td>\r\n<td>120<\/td>\r\n<td>132<\/td>\r\n<td>120<\/td>\r\n<td>110<\/td>\r\n<td>115<\/td>\r\n<td>128<\/td>\r\n<td>120<\/td>\r\n<td>112<\/td>\r\n<td>110<\/td>\r\n<td>100<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Post exposure Systolic BP<\/td>\r\n<td>140<\/td>\r\n<td>156<\/td>\r\n<td>145<\/td>\r\n<td>130<\/td>\r\n<td>117<\/td>\r\n<td>148<\/td>\r\n<td>137<\/td>\r\n<td>119<\/td>\r\n<td>127<\/td>\r\n<td>135<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\nIn the following worksheet, we compute the significance of the difference between the pre-test blood pressures and the post-test blood pressures.\r\n\r\nThe null hypothesis is: Ho: \u00b51\u00a0= \u00b52 \u00a0and the computation of the variance is shown with the raw data in the table below.\r\n<table style=\"border-collapse: collapse;width: 100%\" border=\"0\">\r\n<thead>\r\n<tr class=\"shaded\">\r\n<td style=\"width: 12.5%;text-align: center\">ID<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">sex<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">pretest BP<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">post-test bp<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">pre-post difference [latex]\\Delta(x_{i}) [\/latex]<\/td>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td style=\"width: 12.5%;text-align: center\">01<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">m<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">120<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">140<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">20<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 12.5%;text-align: center\">02<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">f<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">132<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">156<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">24<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 12.5%;text-align: center\">03<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">m<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">120<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">145<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">25<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 12.5%;text-align: center\">04<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">f<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">110<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">130<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">20<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 12.5%;text-align: center\">05<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">m<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">115<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">117<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">2<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 12.5%;text-align: center\">06<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">m<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">128<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">148<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">20<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 12.5%;text-align: center\">07<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">f<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">120<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">137<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">17<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 12.5%;text-align: center\">08<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">m<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">112<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">119<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">7<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 12.5%;text-align: center\">09<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">f<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">110<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">127<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">17<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 12.5%;text-align: center\">10<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">m<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">100<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">135<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">35<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 12.5%;text-align: center\"><\/td>\r\n<td style=\"width: 12.5%;text-align: center\"><\/td>\r\n<td style=\"width: 12.5%;text-align: center\"><\/td>\r\n<td style=\"width: 12.5%;text-align: center\"><\/td>\r\n<td style=\"width: 12.5%;text-align: center\">[latex]\\overline{\\Delta}=\\sum{\\Delta(x_{i})} [\/latex]<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<table style=\"border-collapse: collapse;width: 99.0944%\" border=\"0\">\r\n<tfoot>\r\n<tr class=\"shaded\">\r\n<td style=\"width: 12.5%;text-align: center\">Sum of differences = [latex]\\sum \\left(\\Delta(x_{i}) - \\overline{\\Delta}\\right)[\/latex] = 0<\/td>\r\n<td style=\"width: 12.5%;text-align: center\" colspan=\"2\">Sum of squared difference scores = [latex]\\sum \\left(\\Delta(x_{i}) - {(\\overline{\\Delta})}\\right)^2[\/latex] = 760.1<\/td>\r\n<\/tr>\r\n<\/tfoot>\r\n<thead>\r\n<tr class=\"shaded\">\r\n<td style=\"width: 12.5%;text-align: center\">[latex]\\Delta(x_{i}) - \\overline{\\Delta}[\/latex]<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">[latex]\\left(\\Delta(x_{i}) - {(\\overline{\\Delta})}\\right)^2[\/latex]<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">Squared difference scores<\/td>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td style=\"width: 12.5%;text-align: center\">20-18.7=1.3<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">[latex](1.3)^2[\/latex]<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">1.69<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 12.5%;text-align: center\">24-18.7=5.3<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">[latex](5.3)^2[\/latex]<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">28.09<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 12.5%;text-align: center\">25-18.7=6.3<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">[latex](6.3)^2[\/latex]<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">39.69<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 12.5%;text-align: center\">20-18.7=1.3<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">[latex](1.3)^2[\/latex]<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">1.69<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 12.5%;text-align: center\">2-18.7=-16.7<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">[latex](-16.7)^2[\/latex]<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">278.89<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 12.5%;text-align: center\">20-18.7=1.3<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">[latex](1.3)^2[\/latex]<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">1.69<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 12.5%;text-align: center\">17-18.7=-1.7<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">[latex](-1.7)^2[\/latex]<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">2.89<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 12.5%;text-align: center\">7-18.7=-11.7<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">[latex](-11.7)^2[\/latex]<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">136.89<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 12.5%;text-align: center\">20-18.7=-1.7<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">[latex](-1.7)^2[\/latex]<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">2.89<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 12.5%;text-align: center\">35-18.7=16.3<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">[latex](16.3)^2[\/latex]<\/td>\r\n<td style=\"width: 12.5%;text-align: center\">265.69<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\nTo compute the variance for the set of difference scores we divide the sum of squares by n-1. In this analysis the variance is computed as follows.\r\n\r\nSum of squares = [latex]\\sum \\left(\\Delta(x_{i}) - {(\\overline{\\Delta})}\\right)^2 = {760.1 \\over{n - 1}} = {760.1 \\over{10-1}} = {760.1 \\over{9}} = 84.46[\/latex]\r\n\r\nThe standard deviation is then calculated by estimating the square root of the variance. Here the calculation is the square root of 84.46, which produces a standard deviation of 9.19. Once we have the standard deviation we can calculate the standard error by dividing the standard deviation by the square root of n. Here we have a standard deviation of 9.19 and n=10 (our total sample). The calculation of the standard error is then 9.19 divided by the square root of 10 which equals 2.91, as shown below.\r\n\r\n[latex]s = \\sqrt{84.46} = 9.19\u00a0 [\/latex]\u00a0 [latex] \\textit{s.e.} = {s\\over\\sqrt{n}}[\/latex]\u00a0 [latex] \\rightarrow \\textit{s.e.} = {9.19\\over\\sqrt{10}} = 2.91[\/latex]\r\n\r\nOnce we have the standard error from these calculations then we can calculate the t-test value. Recall that the t-test score provides an evaluation of the null hypothesis which here is a test that the mean difference between the pre and post blood pressure scores is equal to 0. The calculation for the t score in this scenario is shown here:\r\n\r\n[latex] t = \\left( \\overline{\\Delta} - 0 \\over{s.e.}\\right)[\/latex] [latex] \\rightarrow t = \\left(18.7 - 0 \\over{2.91}\\right)[\/latex] [latex] \\rightarrow t = \\left(6.43\\right)[\/latex]\r\n\r\nNext use the t observed score to evaluate the null hypothesis by comparing the t observed scores against the t expected score for a research design in which we started with a sample of n=10.\u00a0 The t expected score is identified in a table of critical values -- easily retrieved from the internet. The information required to identify the t critical value is the number of cases in our sample and the probability level at which we want to be sure that we are making the right decision in regard to accepting or rejecting the null hypothesis.\u00a0 For most research studies we accept that we want to be 95% confident that we are making the correct decision in regard to accepting or rejecting the null hypothesis, so given that (100% - 95% = 5%) we establish a probability level of 0.05 or 5%; and we call this probability the alpha level. Once we have our alpha level and we know our sample size (n) then we can look up the appropriate t critical value (from a standard table of critical values) against which we will compare our t observed score.\r\n\r\nIn the evaluation of changes in blood pressure, our t observed score was 6.43, and the corresponding t critical (or t expected) score based on an alpha level of 0.05 and n=10 is given as t critical =\u00a0 2.228.\u00a0 Therefore, since our t observed score (t<sub>observed<\/sub> = 6.43) is greater than the t critical score (t<sub>critical<\/sub> = 2.228) we reject the null hypothesis [latex] H_{0}: \\left( \\overline{\\Delta} = 0 \\right)[\/latex] and determine that the change in blood pressures within our sample was statistically significant.\r\n\r\n<hr \/>\r\n\r\nIn this analysis, we can write a SAS program to evaluate the <strong><em>pairwise t-test<\/em><\/strong> using the\u00a0<strong><em>PROC MEANS<\/em><\/strong> procedure and evaluate the null hypothesis using both Proc MEANS, as well as the student's single sample t-test.\u00a0The SAS program is as follows:\r\n\r\n<span style=\"color: #0000ff\">DATA PAIRWISE;<\/span>\r\n<span style=\"color: #0000ff\">INPUT @1 ID SEX $ PREBP POSTBP;<\/span>\r\n\r\nFollowing the input paragraph above, we create a new variable to represent the difference in pre to post systolic blood pressure scores. Here we will call this variable DELTABP. Considering that post bp is expected to rise following exposure to halogen, we include POSTBP as the first term in the equation to compute the difference scores.\r\n\r\n<span style=\"color: #0000ff\">DELTABP = (POSTBP \u2013 PREBP);<\/span>\r\n\r\n<span style=\"color: #0000ff\">DATALINES;<\/span>\r\n<span style=\"color: #0000ff\">01 m 120 140<\/span>\r\n<span style=\"color: #0000ff\">02 f 132 156<\/span>\r\n<span style=\"color: #0000ff\">03 m 120 145<\/span>\r\n<span style=\"color: #0000ff\">04 f 110 130<\/span>\r\n<span style=\"color: #0000ff\">05 m 115 117<\/span>\r\n<span style=\"color: #0000ff\">06 m 128 148<\/span>\r\n<span style=\"color: #0000ff\">07 f 120 137<\/span>\r\n<span style=\"color: #0000ff\">08 m 112 119<\/span>\r\n<span style=\"color: #0000ff\">09 f 110 127<\/span>\r\n<span style=\"color: #0000ff\">10 m 100 135<\/span>\r\n<span style=\"color: #0000ff\">;<\/span>\r\n\r\nComputing the pairwise t-test is similar to computing the student\u2019s or single sample t-test. Here we use the measure of difference scores as the variable of interest. The SAS procedural commands are presented here:\r\n\r\n<span style=\"color: #0000ff\">PROC SORT DATA=PAIRWISE; BY ID;<\/span>\r\n<span style=\"color: #0000ff\">PROC UNIVARIATE; VAR DELTABP; RUN;<\/span>\r\n\r\nIn the statement below, we use PROC MEANS to compute the t-test scores. Notice that the options to produce the statistical output are included within the PROC MEANS statement prior to the semi-colon.\r\n\r\n<span style=\"color: #0000ff\">PROC MEANS N MEAN MEDIAN T STDERR PRT; VAR DELTABP; RUN;<\/span>\r\n\r\nIn the statement below, we use PROC TTEST to compute the t-test scores.\r\n\r\n<span style=\"color: #0000ff\">PROC TTEST; VAR DELTABP; RUN;<\/span>\r\n\r\nAs in all analyses we begin with the descriptive statistics.\u00a0 These are reported through the output for the PROC UNIVARIATE procedures. However, since we are comparing a mean for a sample against the population mean of 0, we really don\u2019t need to do much more as SAS provides this outcome in the reporting of the student\u2019s t-test as part of the PROC UNIVARIATE procedure, shown below.\r\n<p style=\"text-align: center\"><strong>Table 29.6. Output from PROC UNIVARIATE\u00a0 for dependent variable: DELTABP<\/strong><\/p>\r\n\r\n<table class=\" aligncenter\">\r\n<tbody>\r\n<tr>\r\n<td><strong>N<\/strong><\/td>\r\n<td>10<\/td>\r\n<td><strong>Sum Weights<\/strong><\/td>\r\n<td>10<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>Mean<\/strong><\/td>\r\n<td>18.7<\/td>\r\n<td><strong>Sum Observations<\/strong><\/td>\r\n<td>187<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>Std Deviation<\/strong><\/td>\r\n<td>9.18997038<\/td>\r\n<td><strong>Variance<\/strong><\/td>\r\n<td>84.4555556<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>Skewness<\/strong><\/td>\r\n<td>-0.2742618<\/td>\r\n<td><strong>Kurtosis<\/strong><\/td>\r\n<td>0.84720499<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>Coeff Variation<\/strong><\/td>\r\n<td>49.1442266<\/td>\r\n<td><strong>Std Error Mean<\/strong><\/td>\r\n<td>2.9061238<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<div align=\"center\">\r\n<table class=\" aligncenter\">\r\n<thead>\r\n<tr>\r\n<td style=\"width: 86.25px\"><strong>Test<\/strong><\/td>\r\n<td style=\"width: 58.25px\"><strong>Statistic<\/strong><\/td>\r\n<td style=\"width: 60.65px\"><strong>p Value<\/strong><\/td>\r\n<td style=\"width: 60.65px\"><\/td>\r\n<td style=\"width: 47.05px\"><\/td>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td style=\"width: 86.25px\"><strong>Student's t<\/strong><\/td>\r\n<td style=\"width: 58.25px\"><strong>t<\/strong><\/td>\r\n<td style=\"width: 60.65px\">6.43<\/td>\r\n<td style=\"width: 60.65px\"><strong>Pr &gt; |t|<\/strong><\/td>\r\n<td style=\"width: 47.05px\">0.0001<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 86.25px\"><strong>Sign<\/strong><\/td>\r\n<td style=\"width: 58.25px\"><strong>M<\/strong><\/td>\r\n<td style=\"width: 60.65px\">5<\/td>\r\n<td style=\"width: 60.65px\"><strong>Pr &gt;= |M|<\/strong><\/td>\r\n<td style=\"width: 47.05px\">0.0020<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 86.25px\"><strong>Signed Rank<\/strong><\/td>\r\n<td style=\"width: 58.25px\"><strong>S<\/strong><\/td>\r\n<td style=\"width: 60.65px\">27.5<\/td>\r\n<td style=\"width: 60.65px\"><strong>Pr &gt;= |S|<\/strong><\/td>\r\n<td style=\"width: 47.05px\">0.0020<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\nNext, the PROC MEANS procedure was used to compute the mean and test the comparison of the mean from 0 using the single sample t-test.\u00a0 The output is shown below. Notice this procedure lists the t-value and the probability of the computed t-value.\r\n\r\n<strong>Table 29.7. Output from PROC MEANS\u00a0 for dependent variable: DELTABP<\/strong>\r\n<div align=\"center\">\r\n<table>\r\n<thead>\r\n<tr>\r\n<td style=\"width: 14.25px\"><strong>N<\/strong><\/td>\r\n<td style=\"width: 77.45px\"><strong>Mean<\/strong><\/td>\r\n<td style=\"width: 83.05px\"><strong>Median<\/strong><\/td>\r\n<td style=\"width: 47.85px\"><strong>t\u00a0Value<\/strong><\/td>\r\n<td style=\"width: 66.25px\"><strong>Std Error<\/strong><\/td>\r\n<td style=\"width: 45.45px\"><strong>Pr\u00a0&gt;\u00a0|t|<\/strong><\/td>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td style=\"width: 14.25px\">10<\/td>\r\n<td style=\"width: 77.45px\">18.7000000<\/td>\r\n<td style=\"width: 83.05px\">20.0000000<\/td>\r\n<td style=\"width: 47.85px\">6.43<\/td>\r\n<td style=\"width: 66.25px\">2.9061238<\/td>\r\n<td style=\"width: 45.45px\">0.0001<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\nThe values computed with the PROC MEANS procedure can be compared to the procedures of the PROC TTEST and are shown below for the pairwise t-test comparison.\r\n<p style=\"text-align: center\"><strong>Table 29.8. Output from PROC TTEST\u00a0 for dependent variable: DELTABP<\/strong><\/p>\r\n\r\n<div align=\"center\">\r\n<table>\r\n<thead>\r\n<tr>\r\n<td><strong>N<\/strong><\/td>\r\n<td><strong>Mean<\/strong><\/td>\r\n<td><strong>Std\u00a0Dev<\/strong><\/td>\r\n<td><strong>Std\u00a0Err<\/strong><\/td>\r\n<td><strong>Minimum<\/strong><\/td>\r\n<td><strong>Maximum<\/strong><\/td>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td>10<\/td>\r\n<td>18.7000<\/td>\r\n<td>9.1900<\/td>\r\n<td>2.9061<\/td>\r\n<td>2.0000<\/td>\r\n<td>35.0000<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\n<div align=\"center\">\r\n<table style=\"width: 305px\">\r\n<thead>\r\n<tr>\r\n<td style=\"width: 73.45px\"><strong>Mean<\/strong><\/td>\r\n<td style=\"width: 114.25px\"><strong>95% CL Mean<\/strong><\/td>\r\n<td style=\"width: 78.25px\"><\/td>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td style=\"width: 73.45px\">18.7000<\/td>\r\n<td style=\"width: 114.25px\">12.1259<\/td>\r\n<td style=\"width: 78.25px\">25.2741<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 73.45px\"><\/td>\r\n<td style=\"width: 114.25px\"><\/td>\r\n<td style=\"width: 78.25px\"><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\nAgain, the important bits of information are the t-value and the probability of the t-value.\u00a0 The evaluation of the t-value is to consider the likelihood of the computed value.\u00a0 Recall that there is no fixed demarcation point for this t-test outcome, but what is more important is whether the differences are as expected. Using a probability estimate of p&lt;0.05 as a guide we can decide about the difference in means relative to the t-test score. Here we see that the t-test score is 6.43 and the associated probability of observing this t-test value is less than 0.05.\r\n<div align=\"center\">\r\n<table style=\"width: 244px;height: 58px\">\r\n<thead>\r\n<tr class=\"shaded\" style=\"height: 29px\">\r\n<td style=\"text-align: center;width: 67.05px;height: 29px\"><strong>DF<\/strong><\/td>\r\n<td style=\"text-align: center;width: 126.25px;height: 29px\"><strong>t\u00a0Value<\/strong><\/td>\r\n<td style=\"text-align: center;width: 72.65px;height: 29px\"><strong>Pr\u00a0&gt;\u00a0|t|<\/strong><\/td>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr style=\"height: 29px\">\r\n<td style=\"text-align: center;width: 67.05px;height: 29px\">9<\/td>\r\n<td style=\"text-align: center;width: 126.25px;height: 29px\">6.43<\/td>\r\n<td style=\"text-align: center;width: 72.65px;height: 29px\">0.0001<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\nHowever, what we really want to talk about is what this difference means to your research question. In this instance, the results indicate that the mean systolic blood pressure, measured prior to exposure to the halogen lights was significantly lower than the mean systolic blood pressure, measured after exposure to the halogen lights.\r\n\r\nNotice, also that the values computed with the SAS program for each of the procedures verify the calculations that we worked through by hand, above. That is: the mean difference score was 18.7 with a variance estimate of 84.45, a standard deviation of 9.19, a standard error score of 2.906 (rounded to 2.91) and a t-test score of 6.43.\u00a0 Well done, SAS!","rendered":"<div class=\"textbox textbox--learning-objectives\">\n<header class=\"textbox__header\">\n<p class=\"textbox__title\">Learning Objectives<\/p>\n<\/header>\n<div class=\"textbox__content\">\n<p>After reading this chapter you should be able to:<\/p>\n<ul>\n<li>Calculate differences when using the student\u2019s t-test and when using a matched pairwise comparison t-test<\/li>\n<li>Apply and test the null hypothesis for t-test calculations<\/li>\n<li>Apply the decision rule to evaluate a null hypothesis<\/li>\n<li>Write a SAS program to evaluate the student\u2019s t-test and a matched pairwise comparison t-test<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<h2>Introduction to the Tests of Significance for Mean Differences<\/h2>\n<p>In this next section, we will test the significance of differences between the mean for a set of data and the mean for a comparison set of data.\u00a0 In the first instance, we will compare the mean score from a single set of data to the expected mean for a population. Next, we will compare the mean score for a change from one day to another; and then, in the second section, we will compare the means from two different groups.<\/p>\n<p>An important consideration in calculating any statistic is that the mathematics of the computation doesn\u2019t consider the subject of the scores.\u00a0 That is, the data can be extracted from any source and the mathematics will be the same.\u00a0 For example, consider the following two variables: annual income, and waiting time in the emergency department. The mathematics to calculate the means for each set of data are the same, despite that the two variables hold different information and different meaning.<\/p>\n<p>In a situation, where you have data for a single group (as in a one-sample design), you can also compute a difference score between the mean for the set of observations and then compare your single group mean score against the population score.\u00a0 The population score is referred to as the parameter estimate since we never really know the true population score.<\/p>\n<h2>Computing the Student\u2019s single sample t-test:<\/h2>\n<p style=\"text-align: left\">Let\u2019s consider first the Student\u2019s single-sample t-test.\u00a0 This means that we are going to compare the mean from a sample of data against the mean for the population (which we generally accept to be 0). The statistical test that we will use in this computation is the Student\u2019s t-test.<\/p>\n<div class=\"textbox shaded\"><strong>The purpose of the Student&#8217;s t-test is to evaluate the null hypothesis of the sample mean against the population mean.<\/strong><\/div>\n<p>&nbsp;<\/p>\n<p>[latex]H_{0}: \\overline{x} = \\mu[\/latex]<\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>where:\u00a0 [latex]H_0[\/latex] refers to the null hypothesis<\/li>\n<li>[latex]\\overline{x}[\/latex] refers to the mean of the sample or the distribution<\/li>\n<li>[latex]\\mu[\/latex] refers to the mean of the population<\/li>\n<\/ul>\n<p>To evaluate the significance of the difference between <strong>a sample mean<\/strong> (the mean for the set of observed scores) and <strong>an expected mean<\/strong> (the mean for the population), use the Student\u2019s t-test. That is to ask, \u00a0\u201cIs the mean for a sample of scores the same as the mean expected to represent a population?\u201d<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/normal1-300x223.png\" alt=\"\" class=\"aligncenter size-medium wp-image-960\" width=\"300\" height=\"223\" srcset=\"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/normal1-300x223.png 300w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/normal1-65x48.png 65w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/normal1-225x167.png 225w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/normal1-350x260.png 350w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/normal1.png 449w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Above is an illustration of the population distribution. As shown in the illustration below, we draw (select, observe, record) the sample distribution from the population distribution.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/normal2-300x193.png\" alt=\"\" class=\"aligncenter size-medium wp-image-962\" width=\"300\" height=\"193\" srcset=\"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/normal2-300x193.png 300w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/normal2-65x42.png 65w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/normal2-225x145.png 225w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/normal2-350x225.png 350w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/normal2.png 500w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Under the null hypothesis, we test if the mean of the sample is truly representative of the mean for a population. This test is based on the null hypothesis question expressed here: <img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/nullform.png\" alt=\"\" class=\"size-full wp-image-507 aligncenter\" width=\"170\" height=\"37\" srcset=\"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/nullform.png 170w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/nullform-65x14.png 65w\" sizes=\"auto, (max-width: 170px) 100vw, 170px\" \/><\/p>\n<hr \/>\n<p class=\"ABodyCopy\"><span lang=\"EN-US\">Considering an approach in which we use randomized representative sampling to collect our data, we should expect that the sample mean should be the same as the population mean. If this outcome were observed, then we would accept the null hypothesis.<\/span><span lang=\"EN-US\">\u00a0<\/span><\/p>\n<p class=\"ABodyCopy\"><span lang=\"EN-US\">To evaluate the null hypothesis, which is to say, to determine if, in fact, the null hypothesis is true: that the sample represents the population; we compare the sample mean to the population mean, whereby our sample mean is the mean for the set of observations and the population mean is the mean for the set of expected scores.<\/span><\/p>\n<p class=\"ABodyCopy\"><span lang=\"EN-US\">Therefore, to evaluate the difference between a sample mean and an expected mean we use the Student\u2019s t-test, as shown in the following formula.<\/span><\/p>\n<p>[latex]\\textit{Student's t-test} = {\\overline{x}_{observed}-\\overline{x}_{expected}\\over{\\frac{S_{observed}}{\\sqrt{n_{observed}}}}}[\/latex]<\/p>\n<div>\n<hr \/>\n<p>SAMPLE CALCULATION 29.1<\/p>\n<\/div>\n<p>In this first example, we will use the student&#8217;s t-test to evaluate the mean score for a continuous random variable for a selection of individuals drawn from a population. In Table 29.1, data for the number of hours in a given month that individuals waited to see their healthcare provider are presented.\u00a0 You are asked to compute the average wait time for this sample and determine if the average for the sample is significantly different than that which is expected in the population.<\/p>\n<p>Table 29.1 Monthly wait time in hours for a random sample of individuals<\/p>\n<table style=\"border-collapse: collapse;width: 100%\">\n<thead>\n<tr class=\"shaded\">\n<td class=\"border\" style=\"width: 50%;vertical-align: middle;text-align: center\" scope=\"col\">Patient ID<\/td>\n<td class=\"border\" style=\"width: 50%;text-align: center\">Hours Waited<\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">01<\/td>\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\"><strong>12<\/strong><\/td>\n<\/tr>\n<tr>\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">02<\/td>\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">13.5<\/td>\n<\/tr>\n<tr>\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">03<\/td>\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">8.5<\/td>\n<\/tr>\n<tr>\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">04<\/td>\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">4.5<\/td>\n<\/tr>\n<tr>\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">05<\/td>\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">10.5<\/td>\n<\/tr>\n<tr>\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">06<\/td>\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">15.5<\/td>\n<\/tr>\n<tr>\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">07<\/td>\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">12.5<\/td>\n<\/tr>\n<tr>\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">08<\/td>\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">9.5<\/td>\n<\/tr>\n<tr>\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">09<\/td>\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">11<\/td>\n<\/tr>\n<tr>\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">10<\/td>\n<td class=\"border\" style=\"width: 50%;text-align: center;vertical-align: middle\" scope=\"col\">7.5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Here we use the Student\u2019s t-test to evaluate the null hypothesis that the observed mean is equal to the expected mean in this set of scores. In the application of the t-test, we assume that the mean score for the sample is representative of the mean score for population, and likewise, that the variance for this sample of scores is an estimate of the variance for the population. We also assume, unless we have some other information, that these data were drawn from a normal distribution.<\/p>\n<p>In this example, we are assessing the null hypothesis: H0: [latex]\\overline{x} = \\mu[\/latex], also presented as H0: [latex]\\overline{x} = 0[\/latex]. In using the t-test we assume that the population mean [latex][\\mu][\/latex]has a value of 0 and a variance (standard deviation) of 1. When we are applying the t-test, we are comparing our observed sample mean against the expected population mean of 0 with a variance of 1. The SAS code below produces a test of the null hypothesis using the Student\u2019s t-test.<\/p>\n<div class=\"textbox textbox--exercises\">\n<header class=\"textbox__header\">\n<p class=\"textbox__title\">SAS Code to Compute the Student\u2019s t-Test for a Single Sample<\/p>\n<\/header>\n<div class=\"textbox__content\">\n<div>DATA STUDENT;<br \/>\nINPUT ID SCORE @@;<br \/>\nDATALINES;<br \/>\n001 12.0 002 13.5 003 08.5 004 04.5 005 10.5 006 15.5 007 12.5 008 09.5 009 11.0 010 07.5<br \/>\n;<br \/>\nPROC SORT DATA=STUDENT; BY ID;<br \/>\nTITLE \u201cSTUDENT\u2019S t-TEST TO EVALUATE WAIT TIMES\u201d;<br \/>\nPROC UNIVARIATE; VAR SCORE;<br \/>\nPROC MEANS N MEAN MEDIAN T STDERR PRT;<br \/>\nVAR SCORE; RUN;<\/div>\n<\/div>\n<\/div>\n<p style=\"text-align: left\">The SAS code above produces several important output tables to help us explore our dataset and to evaluate the null hypothesis: H0: [latex]\\overline{x} = 0[\/latex]. In the output shown below, we can review the descriptive statistics for the dependent variable which we labeled SCORE. In this output we see that the mean score for the sample was 10.5 with a standard deviation of \u00b1 3.17.<\/p>\n<p style=\"text-align: center\"><strong>Table 29.2 SAS Output for Dependent Variable: SCORE<\/strong><\/p>\n<div style=\"margin: auto;\">\n<table>\n<tbody>\n<tr>\n<td><strong>N<\/strong><\/td>\n<td>10<\/td>\n<td><strong>Sum Weights<\/strong><\/td>\n<td>10<\/td>\n<\/tr>\n<tr>\n<td><strong>Mean<\/strong><\/td>\n<td>10.5<\/td>\n<td><strong>Sum Observations<\/strong><\/td>\n<td>105<\/td>\n<\/tr>\n<tr>\n<td><strong>Std Deviation<\/strong><\/td>\n<td>3.1710496<\/td>\n<td><strong>Variance<\/strong><\/td>\n<td>10.0555556<\/td>\n<\/tr>\n<tr>\n<td><strong>Skewness<\/strong><\/td>\n<td>-0.3854798<\/td>\n<td><strong>Kurtosis<\/strong><\/td>\n<td>0.23914105<\/td>\n<\/tr>\n<tr>\n<td><strong>Uncorrected SS<\/strong><\/td>\n<td>1193<\/td>\n<td><strong>Corrected SS<\/strong><\/td>\n<td>90.5<\/td>\n<\/tr>\n<tr>\n<td><strong>Coeff Variation<\/strong><\/td>\n<td>30.2004724<\/td>\n<td><strong>Std Error Mean<\/strong><\/td>\n<td>1.00277393<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>Basic Statistical Measures are given here as location &#8212; mean, median and mode, and measures of variability &#8212; standard deviation, variance, tang and interquartile range.<\/p>\n<p style=\"text-align: center\"><strong>Table 29.3 Measures of Location and Variability<\/strong><\/p>\n<div style=\"margin: auto;\">\n<table>\n<tbody>\n<tr>\n<td><strong>Mean<\/strong><\/td>\n<td>10.50000<\/td>\n<td><strong>Std Deviation<\/strong><\/td>\n<td>3.17105<\/td>\n<\/tr>\n<tr>\n<td><strong>Median<\/strong><\/td>\n<td>10.75000<\/td>\n<td><strong>Variance<\/strong><\/td>\n<td>10.05556<\/td>\n<\/tr>\n<tr>\n<td><strong>Mode<\/strong><\/td>\n<td>.<\/td>\n<td><strong>Range<\/strong><\/td>\n<td>11.00000<\/td>\n<\/tr>\n<tr>\n<td><strong>\u00a0<\/strong><\/td>\n<td><\/td>\n<td><strong>Interquartile Range<\/strong><\/td>\n<td>4.00000<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>The SAS code also produced statistics that help us to determine a decision with regard to accepting or rejecting the null hypothesis. In Table 29.4 below, we see that the Student\u2019s t value is given as 10.47, and the corresponding p-value was Prt &gt; |t| &lt;0.0001. \u00a0Because the probability value (Prt) associated with the Student\u2019s t score is &lt;0.05 the outcome indicates that the mean value (10.5 \u00b1 3.17) was significantly different than 0, and therefore we would reject the null hypothesis that H0: [latex]\\overline{x} = 0[\/latex].<\/p>\n<p style=\"text-align: center\"><strong>Table 29.4 SAS Output for Tests of [latex]\\overline{x} = 0[\/latex] Tests for Location: Mu=0<\/strong><\/p>\n<div style=\"margin: auto;\">\n<table class=\"aligncenter\">\n<thead>\n<tr>\n<td style=\"width: 86.25px\"><strong>Test<\/strong><\/td>\n<td style=\"width: 58.25px\"><strong>Statistic<\/strong><\/td>\n<td style=\"width: 57.45px\"><strong>p Value<\/strong><\/td>\n<td style=\"width: 60.65px\"><\/td>\n<td style=\"width: 47.05px\"><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"width: 86.25px\"><strong>Student&#8217;s t<\/strong><\/td>\n<td style=\"width: 58.25px\"><strong>t<\/strong><\/td>\n<td style=\"width: 57.45px\">10.47095<\/td>\n<td style=\"width: 60.65px\"><strong>Pr &gt; |t|<\/strong><\/td>\n<td style=\"width: 47.05px\">&lt;.0001<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 86.25px\"><strong>Sign<\/strong><\/td>\n<td style=\"width: 58.25px\"><strong>M<\/strong><\/td>\n<td style=\"width: 57.45px\">5<\/td>\n<td style=\"width: 60.65px\"><strong>Pr &gt;= |M|<\/strong><\/td>\n<td style=\"width: 47.05px\">0.0020<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 86.25px\"><strong>Signed Rank<\/strong><\/td>\n<td style=\"width: 58.25px\"><strong>S<\/strong><\/td>\n<td style=\"width: 57.45px\">27.5<\/td>\n<td style=\"width: 60.65px\"><strong>Pr &gt;= |S|<\/strong><\/td>\n<td style=\"width: 47.05px\">0.0020<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<hr \/>\n<p><strong>SAMPLE COMPUTATION 29.2<\/strong><\/p>\n<\/div>\n<p>So, what if in this specific example we knew that the real population mean wasn\u2019t <strong>0<\/strong> but that the mean value was actually a specific number that we determined from the literature.\u00a0 Let\u2019s say that the expected mean should be a value of <strong><em>10<\/em><\/strong> for this sample.\u00a0 In the following example, we can redo the computations of the Student\u2019s t-test and set the population mean to the specific value of 10. <span style=\"color: #0000ff\"><strong><em>In practice, the value against which the mean is compared should be based on theoretical considerations and\/or previous research so that for many experiments the outcome range of the dependent variable can be known.<\/em><\/strong><\/span><\/p>\n<p>To test the null hypothesis for the one sample scenario that the expected mean = 10, we compare the <em>t-score observed<\/em> against the <em>t-score critical.\u00a0 <\/em>The decision rule then becomes: if the <em>t-test score observed<\/em> is greater than the <em>t-test score critical <\/em>then we reject the null hypothesis and state that the sample mean is significantly different than the population mean.<\/p>\n<div class=\"textbox textbox--exercises\">\n<header class=\"textbox__header\">\n<p class=\"textbox__title\">Code to Compute Student\u2019s or Single Sample t-test Using Proc t-test and Setting <em>\u03bc =10<\/em><\/p>\n<\/header>\n<div class=\"textbox__content\">\n<div>OPTIONS PAGESIZE=65 LINESIZE=80;<br \/>\nDATA STUDENT;<br \/>\nINPUT ID SCORE @@;<br \/>\nDATALINES;<br \/>\n001 12.0 002 13.5 003 08.5 004 04.5 005 10.5 006 15.5 007 12.5 008 09.5 009 11.0 010 07.5<br \/>\n;<br \/>\nPROC SORT DATA=STUDENT; BY ID;<br \/>\nPROC TTEST H0=10;<br \/>\nVAR SCORE;<br \/>\nTITLE1 \u201ct-TEST WHEN EXPECTED MEAN NOT 0\u201d;<br \/>\nTITLE2 \u201cEXPECTED MEAN = 10\u201d;<br \/>\nRUN;<\/div>\n<\/div>\n<\/div>\n<p>Table 29.5 \u201ct-TEST WHEN EXPECTED MEAN NOT 0\u201d &#8212;\u00a0\u201cEXPECTED MEAN = 10\u201d<\/p>\n<div style=\"margin: auto;\">\n<table>\n<thead>\n<tr>\n<td><strong>N<\/strong><\/td>\n<td><strong>Mean<\/strong><\/td>\n<td><strong>Std\u00a0Dev<\/strong><\/td>\n<td><strong>Std\u00a0Err<\/strong><\/td>\n<td><strong>Minimum<\/strong><\/td>\n<td><strong>Maximum<\/strong><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>10<\/td>\n<td>10.5<\/td>\n<td>3.17<\/td>\n<td>1.00<\/td>\n<td>4.50<\/td>\n<td>15.50<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div style=\"margin: auto;\">\n<table style=\"width: 354px\">\n<thead>\n<tr>\n<td style=\"width: 56.65px\"><strong>Mean<\/strong><\/td>\n<td style=\"width: 269.45px\"><strong>95% CL Mean<\/strong><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"width: 56.65px\">10.5\u00b13.17<\/td>\n<td style=\"width: 269.45px\">8.23[latex]\\rightarrow[\/latex]12.77<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div style=\"margin: auto;\">\n<table>\n<thead>\n<tr>\n<td><strong>DF<\/strong><\/td>\n<td><strong>t\u00a0Value<\/strong><\/td>\n<td><strong>Pr\u00a0&gt;\u00a0|t|<\/strong><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>9<\/td>\n<td>0.50<\/td>\n<td>0.6300<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>In the data presented above, the computed mean was 10.5 with a standard deviation of 3.17. This was compared against an expected mean of 10 and thus produced a t-test score, labeled here as t Value, equal to 0.50. The probability associated with this t-test score is given in the table as Pr &gt;|t|, and is equal to 0.6300. Because the p-value is greater than 0.05 we accept the null hypothesis that the observed mean for the sample is not different than the apriori mean we had set at\u00a0 [latex]\\overline{x} = 10[\/latex].<\/p>\n<p>This SAS output for the t-test procedure also produces a Q-Q plot. The Q-Q plot is a visual representation that the data used in this example were drawn from a normal population.\u00a0 If the Q-Q plot presents a relatively straight line then we can assume that the data were drawn from a population that was normally distributed. However, if the data are not representative of a somewhat straight line then we can suggest that the data were not drawn from a population that we would consider to be normally distributed. Notice in Figure 29.1, below, the Q-Q plot shows a straight line and thereby indicates that the data were drawn from a population that was normally distributed.<\/p>\n<p>Figure 29.1 Q-Q plot of data to demonstrate normality in the sample distribution<\/p>\n<\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/qqplot.png\" alt=\"\" width=\"729\" height=\"545\" class=\"aligncenter size-full wp-image-1850\" srcset=\"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/qqplot.png 729w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/qqplot-300x224.png 300w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/qqplot-65x49.png 65w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/qqplot-225x168.png 225w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/qqplot-350x262.png 350w\" sizes=\"auto, (max-width: 729px) 100vw, 729px\" \/><\/p>\n<h1><strong>The Pairwise t-test<\/strong><\/h1>\n<p><span style=\"color: #0000ff\"><strong>To evaluate the significance of the difference in a pre to post design t-test, use<\/strong> <strong>the pairwise t-test formula.<\/strong><\/span><\/p>\n<p style=\"text-align: center\">Figure 29.2 Evaluating the shift from pretest to posttest<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/SHIFT.png\" alt=\"\" width=\"478\" height=\"306\" class=\"aligncenter size-full wp-image-1855\" srcset=\"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/SHIFT.png 478w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/SHIFT-300x192.png 300w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/SHIFT-65x42.png 65w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/SHIFT-225x144.png 225w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/SHIFT-350x224.png 350w\" sizes=\"auto, (max-width: 478px) 100vw, 478px\" \/><\/p>\n<p>The pre to post (pairwise) t-test measures the amount of shift in the data over the time interval. The formula to compute the pairwise t-test uses the average difference in the measure of interest, from the pre-test score to the post-test score, and then divided by the standard error of the average difference.\u00a0 The standard error of the average difference is computed by dividing the standard deviation of the average difference by the square root of the number of cases in the pairwise comparison.<\/p>\n<p style=\"text-align: center\">Figure 29.3 Formula to evaluate the Pre to Post-test design<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/pairwise.png\" alt=\"\" width=\"762\" height=\"150\" class=\"aligncenter size-full wp-image-1856\" srcset=\"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/pairwise.png 762w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/pairwise-300x59.png 300w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/pairwise-65x13.png 65w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/pairwise-225x44.png 225w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/05\/pairwise-350x69.png 350w\" sizes=\"auto, (max-width: 762px) 100vw, 762px\" \/><\/p>\n<hr \/>\n<p><strong>Computing a Pairwise Comparison T-Test to Evaluate Change <\/strong><\/p>\n<p>We can use the formula for the pairwise t-test shown above, to compute the significance of the change in the mean score from the pre-test data to the post-test data for the following two sets of 10 numbers.<\/p>\n<p><strong>Pre test data<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td>Participant Code<\/td>\n<td>001<\/td>\n<td>002<\/td>\n<td>003<\/td>\n<td>004<\/td>\n<td>005<\/td>\n<td>006<\/td>\n<td>007<\/td>\n<td>008<\/td>\n<td>009<\/td>\n<td>010<\/td>\n<\/tr>\n<tr>\n<td>Score<\/td>\n<td>\u00a034<\/td>\n<td>\u00a054<\/td>\n<td>\u00a060<\/td>\n<td>68<\/td>\n<td>53<\/td>\n<td>70<\/td>\n<td>81<\/td>\n<td>87<\/td>\n<td>65<\/td>\n<td>55<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Post test data<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td>Participant Code<\/td>\n<td>001<\/td>\n<td>002<\/td>\n<td>003<\/td>\n<td>004<\/td>\n<td>005<\/td>\n<td>006<\/td>\n<td>007<\/td>\n<td>008<\/td>\n<td>009<\/td>\n<td>010<\/td>\n<\/tr>\n<tr>\n<td>Score<\/td>\n<td>44<\/td>\n<td>75<\/td>\n<td>72<\/td>\n<td>98<\/td>\n<td>73<\/td>\n<td>80<\/td>\n<td>91<\/td>\n<td>99<\/td>\n<td>69<\/td>\n<td>76<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Analyzing these data as a paired t-test. <\/strong><\/p>\n<p>In this analysis, we will treat the difference scores produced by subtracting the pre-test scores from the post-test scores.\u00a0 In order to do this, we will need to create a new variable. We can create a variable DIFFSCR by subtracting the post-test score from the pre-test scores. As a rule, it is always best to keep our variable names simple and to restrict the label to 8 characters or less. The SAS code to set up this analysis is shown below. However, it is important to note that the degrees of freedom for the paired t-test uses a single sample mean and therefore is df = n \u2013 1, and in this case, df = 10 \u2013 1 = 9 so that the t critical value for \u03b1 = 0.05 is 2.262 for a two-tailed test and 1.833 for a one-tailed test.<\/p>\n<div class=\"textbox textbox--exercises\">\n<header class=\"textbox__header\">\n<p class=\"textbox__title\">SAS Code to Compute pairwise difference with a t-test<\/p>\n<\/header>\n<div class=\"textbox__content\">OPTIONS PAGESIZE=65 LINESIZE=80;<br \/>\nDATA PAIRWISE;<br \/>\nINPUT @1 ID PRETEST POSTTEST;<br \/>\nDIFFSCR=(POSTTEST &#8211; PRETEST);<br \/>\nDATALINES;<br \/>\n001 34 44<br \/>\n002 54 75<br \/>\n003 60 72<br \/>\n004 68 98<br \/>\n005 53 73<br \/>\n006 70 80<br \/>\n007 81 91<br \/>\n008 87 99<br \/>\n009 65 69<br \/>\n010 55 76<br \/>\n;<\/div>\n<\/div>\n<p>In this analysis, we will evaluate the set of difference scores as a single group (as in a one-sample design) just as we did for the student\u2019s t-test.\u00a0 Under this design, we can use the <strong><em>single-sample t-test <\/em><\/strong><em>or<strong> Student\u2019s t-test<\/strong><\/em> procedure to compute the significance of the difference scores. Therefore, under this design, we are testing the null hypothesis that the difference between the pre and post scores = 0 (i.e. no difference).<\/p>\n<p>Step 1 in computing the difference scores between the results in the pre test and the results in the post test was to create the variable: DIFFSCR. In this example uses POSTTEST \u2013 PRETEST to show a positive change (an increase in score values). The production of the difference score was accomplished with the SAS. command: DIFFSCR=(POSTTEST &#8211; PRETEST);<\/p>\n<p>Using the dependent variable DIFFSCR, and the following SAS Code we produced three different SAS outputs: \u00a0i) <strong><em>PROC UNIVARIATE<\/em><\/strong><em>, ii) <strong>PROC MEANS<\/strong><\/em>, iii) <strong><em>PROC TTEST. \u00a0<\/em><\/strong><\/p>\n<div class=\"textbox shaded\">PROC SORT DATA=PAIRWISE; BY ID;<br \/>\nPROC UNIVARIATE;\u00a0 VAR DIFFSCR;<br \/>\nPROC MEANS N MEAN MEDIAN T STDERR PRT;\u00a0 VAR DIFFSCR;<br \/>\nPROC TTEST; VAR DIFFSCR;<br \/>\nRUN;<\/div>\n<p>The results for each of these procedures are shown below the descriptive statistics produced by the Proc Univariate procedure.<\/p>\n<div style=\"margin: auto;\">\n<table>\n<tbody>\n<tr>\n<td><strong>N<\/strong><\/td>\n<td>10<\/td>\n<td><strong>Sum Weights<\/strong><\/td>\n<td>10<\/td>\n<\/tr>\n<tr>\n<td><strong>Mean<\/strong><\/td>\n<td>15<\/td>\n<td><strong>Sum Observations<\/strong><\/td>\n<td>150<\/td>\n<\/tr>\n<tr>\n<td><strong>Std Deviation<\/strong><\/td>\n<td>7.7172246<\/td>\n<td><strong>Variance<\/strong><\/td>\n<td>59.5555556<\/td>\n<\/tr>\n<tr>\n<td><strong>Skewness<\/strong><\/td>\n<td>0.65636272<\/td>\n<td><strong>Kurtosis<\/strong><\/td>\n<td>0.00011636<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h4>Evaluation of the Null Hypothesis based on output\u00a0for the UNIVARIATE Procedure<\/h4>\n<div style=\"margin: auto;\">\n<table>\n<thead>\n<tr>\n<td style=\"width: 86.25px\"><strong>Test<\/strong><\/td>\n<td style=\"width: 58.25px\"><strong>Statistic<\/strong><\/td>\n<td style=\"width: 57.45px\"><strong>p Value<\/strong><\/td>\n<td style=\"width: 60.65px\"><\/td>\n<td style=\"width: 47.05px\"><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"width: 86.25px\"><strong>Student&#8217;s t<\/strong><\/td>\n<td style=\"width: 58.25px\"><strong>t<\/strong><\/td>\n<td style=\"width: 57.45px\">6.146532<\/td>\n<td style=\"width: 60.65px\"><strong>Pr &gt; |t|<\/strong><\/td>\n<td style=\"width: 47.05px\">0.0002<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 86.25px\"><strong>Sign<\/strong><\/td>\n<td style=\"width: 58.25px\"><strong>M<\/strong><\/td>\n<td style=\"width: 57.45px\">5<\/td>\n<td style=\"width: 60.65px\"><strong>Pr &gt;= |M|<\/strong><\/td>\n<td style=\"width: 47.05px\">0.0020<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 86.25px\"><strong>Signed Rank<\/strong><\/td>\n<td style=\"width: 58.25px\"><strong>S<\/strong><\/td>\n<td style=\"width: 57.45px\">27.5<\/td>\n<td style=\"width: 60.65px\"><strong>Pr &gt;= |S|<\/strong><\/td>\n<td style=\"width: 47.05px\">0.0020<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h4>Evaluation of the Null Hypothesis based on output for the MEANS Procedure<\/h4>\n<div style=\"margin: auto;\">\n<table>\n<thead>\n<tr>\n<td><strong>Analysis Variable: DIFFSCR<\/strong><\/td>\n<\/tr>\n<tr>\n<td><strong>N<\/strong><\/td>\n<td><strong>Mean<\/strong><\/td>\n<td><strong>Median<\/strong><\/td>\n<td><strong>t\u00a0Value<\/strong><\/td>\n<td><strong>Std Error<\/strong><\/td>\n<td><strong>Pr\u00a0&gt;\u00a0|t|<\/strong><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>10<\/td>\n<td>15.0000000<\/td>\n<td>12.0000000<\/td>\n<td>6.15<\/td>\n<td>2.4404007<\/td>\n<td>0.0002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h4>Evaluation of the Null Hypothesis based on output for the t-Test Procedure<\/h4>\n<div style=\"margin: auto;\">\n<table>\n<thead>\n<tr>\n<td><strong>DF<\/strong><\/td>\n<td><strong>t\u00a0Value<\/strong><\/td>\n<td><strong>Pr\u00a0&gt;\u00a0|t|<\/strong><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>9<\/td>\n<td>6.15<\/td>\n<td>0.0002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>The important estimates from this output are the mean and variances, which are listed within each of the three SAS procedures. However, each procedure presents the outcome values in different ways.\u00a0 In the PROC UNIVARIATE procedure, all moments of variance are given \u2013 standard deviation, variance, skewness, kurtosis, and standard error.<\/p>\n<p>However, in the PROC MEANS procedure only the mean, median, and standard error are reported when the coding above is used.\u00a0 Finally, the PROC TTEST procedure provides the mean score along with the standard deviation and the computation of the confidence limits. In each basic SAS procedure used above, the Student\u2019s t-test computes the comparison between the sample (based on the difference scores) against the population.<\/p>\n<h2><strong>Application of the General Decision Rule for the Evaluation of the t-Test<\/strong><\/h2>\n<p><strong>\u00a0<\/strong><strong>Student\u2019s t-test:\u00a0 <\/strong>H0: sample mean = population mean.<\/p>\n<p>To test this null hypothesis, we compare the <em>t-score observed<\/em> against the <em>t-score critical.\u00a0 <\/em>The decision rule is as follows: <em>If the <\/em><em>t-score observed is greater than the t-score critical then we reject the null hypothesis and state that the sample mean is significantly different than the population mean. <\/em><\/p>\n<p><strong>Pairwise comparisons t-test:\u00a0<\/strong>H0: mean difference for the sample = mean difference for the population<\/p>\n<p>To test this null hypothesis, we compare the <em>t-score observed<\/em> against the <em>t-score critical<\/em>.\u00a0 In this case, the t-score is based on an evaluation of the average difference from pre-test to post-test scores against the expected average difference, in a population of scores, should be 0. The decision rule then becomes: <em>If the <\/em><em>t-score observed is greater than the t-score critical then we reject the null hypothesis and state that the change from pre-test scores to post-test scores is significantly different than that which is expected.<\/em><\/p>\n<p><strong>t-tests for two independent samples: <\/strong>H0: mean for group1 = mean for group2<\/p>\n<p>Again, to test this null hypothesis we compare the <em>t-score observed<\/em> against the <em>t-score critical<\/em>.\u00a0 In this case the t-score is based on a comparison of the difference of the mean for <strong><em>group1<\/em><\/strong> against the mean for <strong><em>group2<\/em><\/strong>.<em>\u00a0 <\/em>The decision rule is as follows:\u00a0 if the <em>t-score observed<\/em> is greater than the <em>t-score critical <\/em>then we reject the null hypothesis and state that the two means are significantly different from each other.<\/p>\n<hr \/>\n<p><strong>Computing a Pairwise Comparison t-Test to Evaluate Change in Resting Blood Pressure<\/strong><\/p>\n<p>The null hypothesis for the paired or pairwise t-test is given below:<\/p>\n<p style=\"text-align: center\">H0: \u00b51 = \u00b52 \u00a0\u00a0\u00a0\u00a0or \u00a0\u00a0\u00a0\u00a0H0: \u00b51-\u00b52=0<\/p>\n<p>In this experiment, a group of 10 individuals agreed to participate in a study of blood pressure changes following exposure to halogen lighting. Resting systolic blood pressure was recorded for each individual. The participants were then exposed to 20 minutes of halogen lighting by playing a video game in a room, which was lit only by halogen lamps. A post-exposure systolic blood pressure reading was recorded for each individual. The results are presented in the following data set.<\/p>\n<table>\n<tbody>\n<tr>\n<td>ID<\/td>\n<td>01<\/td>\n<td>02<\/td>\n<td>03<\/td>\n<td>04<\/td>\n<td>05<\/td>\n<td>06<\/td>\n<td>07<\/td>\n<td>08<\/td>\n<td>09<\/td>\n<td>10<\/td>\n<\/tr>\n<tr>\n<td>SEX<\/td>\n<td>M<\/td>\n<td>F<\/td>\n<td>M<\/td>\n<td>F<\/td>\n<td>M<\/td>\n<td>F<\/td>\n<td>M<\/td>\n<td>F<\/td>\n<td>M<\/td>\n<td>F<\/td>\n<\/tr>\n<tr>\n<td>Pre exposure Systolic BP<\/td>\n<td>120<\/td>\n<td>132<\/td>\n<td>120<\/td>\n<td>110<\/td>\n<td>115<\/td>\n<td>128<\/td>\n<td>120<\/td>\n<td>112<\/td>\n<td>110<\/td>\n<td>100<\/td>\n<\/tr>\n<tr>\n<td>Post exposure Systolic BP<\/td>\n<td>140<\/td>\n<td>156<\/td>\n<td>145<\/td>\n<td>130<\/td>\n<td>117<\/td>\n<td>148<\/td>\n<td>137<\/td>\n<td>119<\/td>\n<td>127<\/td>\n<td>135<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>In the following worksheet we compute the significance of the difference between the pre test blood pressures and the post-test blood pressures..<\/p>\n<p>The null hypothesis is: Ho: \u00b51\u00a0= \u00b52 \u00a0and the computation of the variance is shown with the raw data in the table below.<\/p>\n<table>\n<tbody>\n<tr>\n<td>ID<\/td>\n<td>01<\/td>\n<td>02<\/td>\n<td>03<\/td>\n<td>04<\/td>\n<td>05<\/td>\n<td>06<\/td>\n<td>07<\/td>\n<td>08<\/td>\n<td>09<\/td>\n<td>10<\/td>\n<\/tr>\n<tr>\n<td>SEX<\/td>\n<td>M<\/td>\n<td>F<\/td>\n<td>M<\/td>\n<td>F<\/td>\n<td>M<\/td>\n<td>F<\/td>\n<td>M<\/td>\n<td>F<\/td>\n<td>M<\/td>\n<td>F<\/td>\n<\/tr>\n<tr>\n<td>Pre exposure Systolic BP<\/td>\n<td>120<\/td>\n<td>132<\/td>\n<td>120<\/td>\n<td>110<\/td>\n<td>115<\/td>\n<td>128<\/td>\n<td>120<\/td>\n<td>112<\/td>\n<td>110<\/td>\n<td>100<\/td>\n<\/tr>\n<tr>\n<td>Post exposure Systolic BP<\/td>\n<td>140<\/td>\n<td>156<\/td>\n<td>145<\/td>\n<td>130<\/td>\n<td>117<\/td>\n<td>148<\/td>\n<td>137<\/td>\n<td>119<\/td>\n<td>127<\/td>\n<td>135<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>In the following worksheet, we compute the significance of the difference between the pre-test blood pressures and the post-test blood pressures.<\/p>\n<p>The null hypothesis is: Ho: \u00b51\u00a0= \u00b52 \u00a0and the computation of the variance is shown with the raw data in the table below.<\/p>\n<table style=\"border-collapse: collapse;width: 100%\">\n<thead>\n<tr class=\"shaded\">\n<td style=\"width: 12.5%;text-align: center\">ID<\/td>\n<td style=\"width: 12.5%;text-align: center\">sex<\/td>\n<td style=\"width: 12.5%;text-align: center\">pretest BP<\/td>\n<td style=\"width: 12.5%;text-align: center\">post-test bp<\/td>\n<td style=\"width: 12.5%;text-align: center\">pre-post difference [latex]\\Delta(x_{i})[\/latex]<\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"width: 12.5%;text-align: center\">01<\/td>\n<td style=\"width: 12.5%;text-align: center\">m<\/td>\n<td style=\"width: 12.5%;text-align: center\">120<\/td>\n<td style=\"width: 12.5%;text-align: center\">140<\/td>\n<td style=\"width: 12.5%;text-align: center\">20<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 12.5%;text-align: center\">02<\/td>\n<td style=\"width: 12.5%;text-align: center\">f<\/td>\n<td style=\"width: 12.5%;text-align: center\">132<\/td>\n<td style=\"width: 12.5%;text-align: center\">156<\/td>\n<td style=\"width: 12.5%;text-align: center\">24<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 12.5%;text-align: center\">03<\/td>\n<td style=\"width: 12.5%;text-align: center\">m<\/td>\n<td style=\"width: 12.5%;text-align: center\">120<\/td>\n<td style=\"width: 12.5%;text-align: center\">145<\/td>\n<td style=\"width: 12.5%;text-align: center\">25<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 12.5%;text-align: center\">04<\/td>\n<td style=\"width: 12.5%;text-align: center\">f<\/td>\n<td style=\"width: 12.5%;text-align: center\">110<\/td>\n<td style=\"width: 12.5%;text-align: center\">130<\/td>\n<td style=\"width: 12.5%;text-align: center\">20<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 12.5%;text-align: center\">05<\/td>\n<td style=\"width: 12.5%;text-align: center\">m<\/td>\n<td style=\"width: 12.5%;text-align: center\">115<\/td>\n<td style=\"width: 12.5%;text-align: center\">117<\/td>\n<td style=\"width: 12.5%;text-align: center\">2<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 12.5%;text-align: center\">06<\/td>\n<td style=\"width: 12.5%;text-align: center\">m<\/td>\n<td style=\"width: 12.5%;text-align: center\">128<\/td>\n<td style=\"width: 12.5%;text-align: center\">148<\/td>\n<td style=\"width: 12.5%;text-align: center\">20<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 12.5%;text-align: center\">07<\/td>\n<td style=\"width: 12.5%;text-align: center\">f<\/td>\n<td style=\"width: 12.5%;text-align: center\">120<\/td>\n<td style=\"width: 12.5%;text-align: center\">137<\/td>\n<td style=\"width: 12.5%;text-align: center\">17<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 12.5%;text-align: center\">08<\/td>\n<td style=\"width: 12.5%;text-align: center\">m<\/td>\n<td style=\"width: 12.5%;text-align: center\">112<\/td>\n<td style=\"width: 12.5%;text-align: center\">119<\/td>\n<td style=\"width: 12.5%;text-align: center\">7<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 12.5%;text-align: center\">09<\/td>\n<td style=\"width: 12.5%;text-align: center\">f<\/td>\n<td style=\"width: 12.5%;text-align: center\">110<\/td>\n<td style=\"width: 12.5%;text-align: center\">127<\/td>\n<td style=\"width: 12.5%;text-align: center\">17<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 12.5%;text-align: center\">10<\/td>\n<td style=\"width: 12.5%;text-align: center\">m<\/td>\n<td style=\"width: 12.5%;text-align: center\">100<\/td>\n<td style=\"width: 12.5%;text-align: center\">135<\/td>\n<td style=\"width: 12.5%;text-align: center\">35<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 12.5%;text-align: center\"><\/td>\n<td style=\"width: 12.5%;text-align: center\"><\/td>\n<td style=\"width: 12.5%;text-align: center\"><\/td>\n<td style=\"width: 12.5%;text-align: center\"><\/td>\n<td style=\"width: 12.5%;text-align: center\">[latex]\\overline{\\Delta}=\\sum{\\Delta(x_{i})}[\/latex]<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table style=\"border-collapse: collapse;width: 99.0944%\">\n<tfoot>\n<tr class=\"shaded\">\n<td style=\"width: 12.5%;text-align: center\">Sum of differences = [latex]\\sum \\left(\\Delta(x_{i}) - \\overline{\\Delta}\\right)[\/latex] = 0<\/td>\n<td style=\"width: 12.5%;text-align: center\" colspan=\"2\">Sum of squared difference scores = [latex]\\sum \\left(\\Delta(x_{i}) - {(\\overline{\\Delta})}\\right)^2[\/latex] = 760.1<\/td>\n<\/tr>\n<\/tfoot>\n<thead>\n<tr class=\"shaded\">\n<td style=\"width: 12.5%;text-align: center\">[latex]\\Delta(x_{i}) - \\overline{\\Delta}[\/latex]<\/td>\n<td style=\"width: 12.5%;text-align: center\">[latex]\\left(\\Delta(x_{i}) - {(\\overline{\\Delta})}\\right)^2[\/latex]<\/td>\n<td style=\"width: 12.5%;text-align: center\">Squared difference scores<\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"width: 12.5%;text-align: center\">20-18.7=1.3<\/td>\n<td style=\"width: 12.5%;text-align: center\">[latex](1.3)^2[\/latex]<\/td>\n<td style=\"width: 12.5%;text-align: center\">1.69<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 12.5%;text-align: center\">24-18.7=5.3<\/td>\n<td style=\"width: 12.5%;text-align: center\">[latex](5.3)^2[\/latex]<\/td>\n<td style=\"width: 12.5%;text-align: center\">28.09<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 12.5%;text-align: center\">25-18.7=6.3<\/td>\n<td style=\"width: 12.5%;text-align: center\">[latex](6.3)^2[\/latex]<\/td>\n<td style=\"width: 12.5%;text-align: center\">39.69<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 12.5%;text-align: center\">20-18.7=1.3<\/td>\n<td style=\"width: 12.5%;text-align: center\">[latex](1.3)^2[\/latex]<\/td>\n<td style=\"width: 12.5%;text-align: center\">1.69<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 12.5%;text-align: center\">2-18.7=-16.7<\/td>\n<td style=\"width: 12.5%;text-align: center\">[latex](-16.7)^2[\/latex]<\/td>\n<td style=\"width: 12.5%;text-align: center\">278.89<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 12.5%;text-align: center\">20-18.7=1.3<\/td>\n<td style=\"width: 12.5%;text-align: center\">[latex](1.3)^2[\/latex]<\/td>\n<td style=\"width: 12.5%;text-align: center\">1.69<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 12.5%;text-align: center\">17-18.7=-1.7<\/td>\n<td style=\"width: 12.5%;text-align: center\">[latex](-1.7)^2[\/latex]<\/td>\n<td style=\"width: 12.5%;text-align: center\">2.89<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 12.5%;text-align: center\">7-18.7=-11.7<\/td>\n<td style=\"width: 12.5%;text-align: center\">[latex](-11.7)^2[\/latex]<\/td>\n<td style=\"width: 12.5%;text-align: center\">136.89<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 12.5%;text-align: center\">20-18.7=-1.7<\/td>\n<td style=\"width: 12.5%;text-align: center\">[latex](-1.7)^2[\/latex]<\/td>\n<td style=\"width: 12.5%;text-align: center\">2.89<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 12.5%;text-align: center\">35-18.7=16.3<\/td>\n<td style=\"width: 12.5%;text-align: center\">[latex](16.3)^2[\/latex]<\/td>\n<td style=\"width: 12.5%;text-align: center\">265.69<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>To compute the variance for the set of difference scores we divide the sum of squares by n-1. In this analysis the variance is computed as follows.<\/p>\n<p>Sum of squares = [latex]\\sum \\left(\\Delta(x_{i}) - {(\\overline{\\Delta})}\\right)^2 = {760.1 \\over{n - 1}} = {760.1 \\over{10-1}} = {760.1 \\over{9}} = 84.46[\/latex]<\/p>\n<p>The standard deviation is then calculated by estimating the square root of the variance. Here the calculation is the square root of 84.46, which produces a standard deviation of 9.19. Once we have the standard deviation we can calculate the standard error by dividing the standard deviation by the square root of n. Here we have a standard deviation of 9.19 and n=10 (our total sample). The calculation of the standard error is then 9.19 divided by the square root of 10 which equals 2.91, as shown below.<\/p>\n<p>[latex]s = \\sqrt{84.46} = 9.19\u00a0[\/latex]\u00a0 [latex]\\textit{s.e.} = {s\\over\\sqrt{n}}[\/latex]\u00a0 [latex]\\rightarrow \\textit{s.e.} = {9.19\\over\\sqrt{10}} = 2.91[\/latex]<\/p>\n<p>Once we have the standard error from these calculations then we can calculate the t-test value. Recall that the t-test score provides an evaluation of the null hypothesis which here is a test that the mean difference between the pre and post blood pressure scores is equal to 0. The calculation for the t score in this scenario is shown here:<\/p>\n<p>[latex]t = \\left( \\overline{\\Delta} - 0 \\over{s.e.}\\right)[\/latex] [latex]\\rightarrow t = \\left(18.7 - 0 \\over{2.91}\\right)[\/latex] [latex]\\rightarrow t = \\left(6.43\\right)[\/latex]<\/p>\n<p>Next use the t observed score to evaluate the null hypothesis by comparing the t observed scores against the t expected score for a research design in which we started with a sample of n=10.\u00a0 The t expected score is identified in a table of critical values &#8212; easily retrieved from the internet. The information required to identify the t critical value is the number of cases in our sample and the probability level at which we want to be sure that we are making the right decision in regard to accepting or rejecting the null hypothesis.\u00a0 For most research studies we accept that we want to be 95% confident that we are making the correct decision in regard to accepting or rejecting the null hypothesis, so given that (100% &#8211; 95% = 5%) we establish a probability level of 0.05 or 5%; and we call this probability the alpha level. Once we have our alpha level and we know our sample size (n) then we can look up the appropriate t critical value (from a standard table of critical values) against which we will compare our t observed score.<\/p>\n<p>In the evaluation of changes in blood pressure, our t observed score was 6.43, and the corresponding t critical (or t expected) score based on an alpha level of 0.05 and n=10 is given as t critical =\u00a0 2.228.\u00a0 Therefore, since our t observed score (t<sub>observed<\/sub> = 6.43) is greater than the t critical score (t<sub>critical<\/sub> = 2.228) we reject the null hypothesis [latex]H_{0}: \\left( \\overline{\\Delta} = 0 \\right)[\/latex] and determine that the change in blood pressures within our sample was statistically significant.<\/p>\n<hr \/>\n<p>In this analysis, we can write a SAS program to evaluate the <strong><em>pairwise t-test<\/em><\/strong> using the\u00a0<strong><em>PROC MEANS<\/em><\/strong> procedure and evaluate the null hypothesis using both Proc MEANS, as well as the student&#8217;s single sample t-test.\u00a0The SAS program is as follows:<\/p>\n<p><span style=\"color: #0000ff\">DATA PAIRWISE;<\/span><br \/>\n<span style=\"color: #0000ff\">INPUT @1 ID SEX $ PREBP POSTBP;<\/span><\/p>\n<p>Following the input paragraph above, we create a new variable to represent the difference in pre to post systolic blood pressure scores. Here we will call this variable DELTABP. Considering that post bp is expected to rise following exposure to halogen, we include POSTBP as the first term in the equation to compute the difference scores.<\/p>\n<p><span style=\"color: #0000ff\">DELTABP = (POSTBP \u2013 PREBP);<\/span><\/p>\n<p><span style=\"color: #0000ff\">DATALINES;<\/span><br \/>\n<span style=\"color: #0000ff\">01 m 120 140<\/span><br \/>\n<span style=\"color: #0000ff\">02 f 132 156<\/span><br \/>\n<span style=\"color: #0000ff\">03 m 120 145<\/span><br \/>\n<span style=\"color: #0000ff\">04 f 110 130<\/span><br \/>\n<span style=\"color: #0000ff\">05 m 115 117<\/span><br \/>\n<span style=\"color: #0000ff\">06 m 128 148<\/span><br \/>\n<span style=\"color: #0000ff\">07 f 120 137<\/span><br \/>\n<span style=\"color: #0000ff\">08 m 112 119<\/span><br \/>\n<span style=\"color: #0000ff\">09 f 110 127<\/span><br \/>\n<span style=\"color: #0000ff\">10 m 100 135<\/span><br \/>\n<span style=\"color: #0000ff\">;<\/span><\/p>\n<p>Computing the pairwise t-test is similar to computing the student\u2019s or single sample t-test. Here we use the measure of difference scores as the variable of interest. The SAS procedural commands are presented here:<\/p>\n<p><span style=\"color: #0000ff\">PROC SORT DATA=PAIRWISE; BY ID;<\/span><br \/>\n<span style=\"color: #0000ff\">PROC UNIVARIATE; VAR DELTABP; RUN;<\/span><\/p>\n<p>In the statement below, we use PROC MEANS to compute the t-test scores. Notice that the options to produce the statistical output are included within the PROC MEANS statement prior to the semi-colon.<\/p>\n<p><span style=\"color: #0000ff\">PROC MEANS N MEAN MEDIAN T STDERR PRT; VAR DELTABP; RUN;<\/span><\/p>\n<p>In the statement below, we use PROC TTEST to compute the t-test scores.<\/p>\n<p><span style=\"color: #0000ff\">PROC TTEST; VAR DELTABP; RUN;<\/span><\/p>\n<p>As in all analyses we begin with the descriptive statistics.\u00a0 These are reported through the output for the PROC UNIVARIATE procedures. However, since we are comparing a mean for a sample against the population mean of 0, we really don\u2019t need to do much more as SAS provides this outcome in the reporting of the student\u2019s t-test as part of the PROC UNIVARIATE procedure, shown below.<\/p>\n<p style=\"text-align: center\"><strong>Table 29.6. Output from PROC UNIVARIATE\u00a0 for dependent variable: DELTABP<\/strong><\/p>\n<table class=\"aligncenter\">\n<tbody>\n<tr>\n<td><strong>N<\/strong><\/td>\n<td>10<\/td>\n<td><strong>Sum Weights<\/strong><\/td>\n<td>10<\/td>\n<\/tr>\n<tr>\n<td><strong>Mean<\/strong><\/td>\n<td>18.7<\/td>\n<td><strong>Sum Observations<\/strong><\/td>\n<td>187<\/td>\n<\/tr>\n<tr>\n<td><strong>Std Deviation<\/strong><\/td>\n<td>9.18997038<\/td>\n<td><strong>Variance<\/strong><\/td>\n<td>84.4555556<\/td>\n<\/tr>\n<tr>\n<td><strong>Skewness<\/strong><\/td>\n<td>-0.2742618<\/td>\n<td><strong>Kurtosis<\/strong><\/td>\n<td>0.84720499<\/td>\n<\/tr>\n<tr>\n<td><strong>Coeff Variation<\/strong><\/td>\n<td>49.1442266<\/td>\n<td><strong>Std Error Mean<\/strong><\/td>\n<td>2.9061238<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div style=\"margin: auto;\">\n<table class=\"aligncenter\">\n<thead>\n<tr>\n<td style=\"width: 86.25px\"><strong>Test<\/strong><\/td>\n<td style=\"width: 58.25px\"><strong>Statistic<\/strong><\/td>\n<td style=\"width: 60.65px\"><strong>p Value<\/strong><\/td>\n<td style=\"width: 60.65px\"><\/td>\n<td style=\"width: 47.05px\"><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"width: 86.25px\"><strong>Student&#8217;s t<\/strong><\/td>\n<td style=\"width: 58.25px\"><strong>t<\/strong><\/td>\n<td style=\"width: 60.65px\">6.43<\/td>\n<td style=\"width: 60.65px\"><strong>Pr &gt; |t|<\/strong><\/td>\n<td style=\"width: 47.05px\">0.0001<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 86.25px\"><strong>Sign<\/strong><\/td>\n<td style=\"width: 58.25px\"><strong>M<\/strong><\/td>\n<td style=\"width: 60.65px\">5<\/td>\n<td style=\"width: 60.65px\"><strong>Pr &gt;= |M|<\/strong><\/td>\n<td style=\"width: 47.05px\">0.0020<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 86.25px\"><strong>Signed Rank<\/strong><\/td>\n<td style=\"width: 58.25px\"><strong>S<\/strong><\/td>\n<td style=\"width: 60.65px\">27.5<\/td>\n<td style=\"width: 60.65px\"><strong>Pr &gt;= |S|<\/strong><\/td>\n<td style=\"width: 47.05px\">0.0020<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>Next, the PROC MEANS procedure was used to compute the mean and test the comparison of the mean from 0 using the single sample t-test.\u00a0 The output is shown below. Notice this procedure lists the t-value and the probability of the computed t-value.<\/p>\n<p><strong>Table 29.7. Output from PROC MEANS\u00a0 for dependent variable: DELTABP<\/strong><\/p>\n<div style=\"margin: auto;\">\n<table>\n<thead>\n<tr>\n<td style=\"width: 14.25px\"><strong>N<\/strong><\/td>\n<td style=\"width: 77.45px\"><strong>Mean<\/strong><\/td>\n<td style=\"width: 83.05px\"><strong>Median<\/strong><\/td>\n<td style=\"width: 47.85px\"><strong>t\u00a0Value<\/strong><\/td>\n<td style=\"width: 66.25px\"><strong>Std Error<\/strong><\/td>\n<td style=\"width: 45.45px\"><strong>Pr\u00a0&gt;\u00a0|t|<\/strong><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"width: 14.25px\">10<\/td>\n<td style=\"width: 77.45px\">18.7000000<\/td>\n<td style=\"width: 83.05px\">20.0000000<\/td>\n<td style=\"width: 47.85px\">6.43<\/td>\n<td style=\"width: 66.25px\">2.9061238<\/td>\n<td style=\"width: 45.45px\">0.0001<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>The values computed with the PROC MEANS procedure can be compared to the procedures of the PROC TTEST and are shown below for the pairwise t-test comparison.<\/p>\n<p style=\"text-align: center\"><strong>Table 29.8. Output from PROC TTEST\u00a0 for dependent variable: DELTABP<\/strong><\/p>\n<div style=\"margin: auto;\">\n<table>\n<thead>\n<tr>\n<td><strong>N<\/strong><\/td>\n<td><strong>Mean<\/strong><\/td>\n<td><strong>Std\u00a0Dev<\/strong><\/td>\n<td><strong>Std\u00a0Err<\/strong><\/td>\n<td><strong>Minimum<\/strong><\/td>\n<td><strong>Maximum<\/strong><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>10<\/td>\n<td>18.7000<\/td>\n<td>9.1900<\/td>\n<td>2.9061<\/td>\n<td>2.0000<\/td>\n<td>35.0000<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div style=\"margin: auto;\">\n<table style=\"width: 305px\">\n<thead>\n<tr>\n<td style=\"width: 73.45px\"><strong>Mean<\/strong><\/td>\n<td style=\"width: 114.25px\"><strong>95% CL Mean<\/strong><\/td>\n<td style=\"width: 78.25px\"><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"width: 73.45px\">18.7000<\/td>\n<td style=\"width: 114.25px\">12.1259<\/td>\n<td style=\"width: 78.25px\">25.2741<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 73.45px\"><\/td>\n<td style=\"width: 114.25px\"><\/td>\n<td style=\"width: 78.25px\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>Again, the important bits of information are the t-value and the probability of the t-value.\u00a0 The evaluation of the t-value is to consider the likelihood of the computed value.\u00a0 Recall that there is no fixed demarcation point for this t-test outcome, but what is more important is whether the differences are as expected. Using a probability estimate of p&lt;0.05 as a guide we can decide about the difference in means relative to the t-test score. Here we see that the t-test score is 6.43 and the associated probability of observing this t-test value is less than 0.05.<\/p>\n<div style=\"margin: auto;\">\n<table style=\"width: 244px;height: 58px\">\n<thead>\n<tr class=\"shaded\" style=\"height: 29px\">\n<td style=\"text-align: center;width: 67.05px;height: 29px\"><strong>DF<\/strong><\/td>\n<td style=\"text-align: center;width: 126.25px;height: 29px\"><strong>t\u00a0Value<\/strong><\/td>\n<td style=\"text-align: center;width: 72.65px;height: 29px\"><strong>Pr\u00a0&gt;\u00a0|t|<\/strong><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"height: 29px\">\n<td style=\"text-align: center;width: 67.05px;height: 29px\">9<\/td>\n<td style=\"text-align: center;width: 126.25px;height: 29px\">6.43<\/td>\n<td style=\"text-align: center;width: 72.65px;height: 29px\">0.0001<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>However, what we really want to talk about is what this difference means to your research question. In this instance, the results indicate that the mean systolic blood pressure, measured prior to exposure to the halogen lights was significantly lower than the mean systolic blood pressure, measured after exposure to the halogen lights.<\/p>\n<p>Notice, also that the values computed with the SAS program for each of the procedures verify the calculations that we worked through by hand, above. That is: the mean difference score was 18.7 with a variance estimate of 84.45, a standard deviation of 9.19, a standard error score of 2.906 (rounded to 2.91) and a t-test score of 6.43.\u00a0 Well done, SAS!<\/p>\n","protected":false},"author":56,"menu_order":3,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[],"contributor":[],"license":[],"class_list":["post-499","chapter","type-chapter","status-publish","hentry"],"part":401,"_links":{"self":[{"href":"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-json\/pressbooks\/v2\/chapters\/499","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-json\/wp\/v2\/users\/56"}],"version-history":[{"count":78,"href":"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-json\/pressbooks\/v2\/chapters\/499\/revisions"}],"predecessor-version":[{"id":2007,"href":"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-json\/pressbooks\/v2\/chapters\/499\/revisions\/2007"}],"part":[{"href":"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-json\/pressbooks\/v2\/parts\/401"}],"metadata":[{"href":"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-json\/pressbooks\/v2\/chapters\/499\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-json\/wp\/v2\/media?parent=499"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-json\/pressbooks\/v2\/chapter-type?post=499"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-json\/wp\/v2\/contributor?post=499"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-json\/wp\/v2\/license?post=499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}