1 22S 105 Statistical Methods and Computing 2 SAS for one sample t tests SAS automatically does a two sided test More on t tests H 0 0 Ha 6 0 Lecture 16 Mar 24 2008 Example Using the normtemp dat data on body temperatures measured on 130 healthy adults we will test the hypotheses Kate Cowles 374 SH 335 0727 kcowles stat uiowa edu H0 98 6 Ha 6 98 6 at the 05 significance level 3 4 Example 2 We will use the same dataset to test a hypothesis regarding heart rates namely data normtemp infile normtemp dat input temp gender heart run proc means n mean stddev clm alpha 05 var temp run H0 73 Ha 6 73 at the 05 significance level Analysis Variable HEART Variable N Mean Std Dev Lower 95 0 Upper 95 0 CLM CLM temp 130 98 249 0 733 98 122 98 376 Note that The 95 confidence interval for does not contain 98 6 The p value is less than 05 so we can reject the null hypothesis N Mean Std Dev Lower 95 0 CLM Upper 95 0 CLM 130 73 7615385 7 0620767 72 5360699 74 9870071 Note that The 95 confidence interval for does contain 73 The p value is greater than 05 so we cannot reject the null hypothesis 5 6 One sample t tests using proc univariate Two sample t tests So far we have talked about drawing inference about a single population mean based on data contained in one sample drawn from that population data normtemp infile group ftp pub kcowles datasets normtemp dat input temp gender heart format gender sexfmt run Now we will consider procedures for comparing two different population means proc univariate mu0 98 6 data normtemp var temp run There are different procedures depending on whether the samples are The UNIVARIATE Procedure Variable temp paired Tests for Location Mu0 98 6 Test Statistic p Value Student s t Sign Signed Rank t M S Pr t Pr M Pr S 5 45482 21 1963 independent 0001 0 0002 0001 7 Paired samples We are interested in the unknown population means 1 and 2 of two different populations In our sample each observation drawn from the first population is matched up with an observation drawn from the second population 8 self pairing two measurements are taken on each subject Example systolic blood pressure sbp upon entry into a clinical study sbp after 1 month on treatment The population means of interest are 1 mean sbp of untreated patients of this type 2 mean sbp of patients of this type after 1 month of treatment with the study regimen The question of interest is whether the treatment lowers blood pressure i e is 2 1 9 matched pairs investigator matches each subject in one treatment group with one subject in another treatment group so that members of a pair are as alike as possible The population means of interest are 1 mean response say sbp at 1 month of patients receiving treatment 1 2 mean response of patients receiving treatment 2 The question of interest is whether 1 2 10 Paired t test To carry out the hypothesis test of interest we apply one sample procedures to the differences between values measured on members of each pair Example We are interested in whether the use of oral contraceptive OC drugs affects the level of systolic blood pressure sbp in women We identify a group of nonpregnant premenopausal women aged 16 49 from a prepaid health plan who are not currently OC users and measure their sbp which we will refer to as baseline sbp We rescreen these women 1 year later to ascertain a subgroup who have remained nonpregnant throughout the year and have be 11 come OC users This subgroup will be the study sample Measure the sbp of the study sample at the follow up visit 12 We will do a two sided test because we do not know in advance whether to expect 1 mean sbp in OC users to be higher or lower than 2 mean sbp in non users We will compare the baseline and follow up sbps of the women in the study sample H 0 1 2 Ha 1 6 2 or equivalently H 0 1 2 0 Ha 1 2 6 0 or equivalently H0 0 Ha 6 0 where denotes 1 2 13 We will use the observed differences between the before and after values observed on each woman as our data to to carry out the hypothesis test regarding at the 05 significance level 14 data sbpoc infile group ftp pub kcowles datasets sbpoc dat input sbpnooc sbpoc diff sbpoc sbpnooc run proc print run OBS 1 2 3 4 5 6 7 8 9 10 15 We will compute the sample mean of the dis Pn d d i i n and the sample standard deviation of the dis sd v u uP u u u u u t n d d 2 i i n 1 proc means data sbpoc var diff run Analysis Variable DIFF N Mean Std Dev Minimum Maximum 10 4 800 4 5655716 2 0000 13 0000 SBPNOOC 115 112 107 119 115 138 126 105 104 115 SBPOC 128 115 106 128 122 145 132 109 102 117 DIFF 13 3 1 9 7 7 6 4 2 2 16 Then the t statistic is t d 0 sd n From our data d 4 80 sd 4 566 4 80 t 4 566 10 3 32 Using Table A we see that the value that cuts off the upper 025 area under a t distribution with 9 degrees of freedom is 2 262 Because 3 32 2 262 our result is more extreme than the required cutoff we can reject the null hypothesis at the 05 level 17 We could use SAS to find the exact p value which is 0 0089 Note that the one sample t test in proc univariate by default tests the null hypothesis that 0 proc univariate data sbpoc var diff run The UNIVARIATE Procedure Variable temp Tests for Location Mu0 0 Test Statistic p Value Student s t Sign Signed Rank t M S Pr t Pr M Pr S 3 324651 3 24 0 0089 0 1094 0 0117
View Full Document