Help using Base SAS procedures

Difference in group means (PROC MEANS) vs means of difference (Paired ttest)

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 110
Accepted Solution

Difference in group means (PROC MEANS) vs means of difference (Paired ttest)

Hi All,

 

This came to my attention while checking my data. I tried to see if there is any significant difference from time 1 to time 2 for a group of individuals after an intervention occurred between time1 and time2. So I checked the means of the variables of interest and also did paired t-test.

 

I thought that the difference in groups means (PROC MEANS first per time period, and then take difference between the two means) would be the same as the means of difference given by the paired t-tests, but it was not the case for all the variables. My understanding is that the means of difference given by the paired t-tests were calculated as the means of difference between two time periods.

 

I tried to do manual calculation and got the same results (some with the same values in difference in group means and means of difference, and some with different values in them). I was wondering if it is related to some random missing data or other reasons.

 

Could anyone see why?

 

Thanks a lot!

Lizi

 

 


Accepted Solutions
Solution
‎01-29-2018 12:50 PM
Super User
Posts: 23,776

Re: Difference in group means (PROC MEANS) vs means of difference (Paired ttest)

Are you expecting the paired t-test to have the exact same results as the unpaired t-test?

That's incorrect, the paired t-test will be different than the unpaired t-test. 

 

https://www.quora.com/What-is-the-difference-between-a-paired-and-unpaired-t-test

 

The differences should be the same mathematically, but the standard deviation is different - different handling of the n's.

 

 

View solution in original post


All Replies
PROC Star
Posts: 8,169

Re: Difference in group means (PROC MEANS) vs means of difference (Paired ttest)

My guess would be that you have some missing values for time1 and time2. A paired t-test would only consider records that don't have missing values for time1 and time2.

 

Art, CEO, AnalystFinder.com

 

Super User
Posts: 23,776

Re: Difference in group means (PROC MEANS) vs means of difference (Paired ttest)

Are you expecting the paired t-test to have the exact same results as the unpaired t-test?

That's incorrect, the paired t-test will be different than the unpaired t-test. 

 

https://www.quora.com/What-is-the-difference-between-a-paired-and-unpaired-t-test

 

The differences should be the same mathematically, but the standard deviation is different - different handling of the n's.

 

 

Solution
‎01-29-2018 12:50 PM
Super User
Posts: 23,776

Re: Difference in group means (PROC MEANS) vs means of difference (Paired ttest)

Are you expecting the paired t-test to have the exact same results as the unpaired t-test?

That's incorrect, the paired t-test will be different than the unpaired t-test. 

 

https://www.quora.com/What-is-the-difference-between-a-paired-and-unpaired-t-test

 

The differences should be the same mathematically, but the standard deviation is different - different handling of the n's.

 

 

PROC Star
Posts: 8,169

Re: Difference in group means (PROC MEANS) vs means of difference (Paired ttest)

@Reeza: While your response was marked as "the solution," I thought we ought to expand this discussion in case someone is looking to explain the difference that @liziwu asked about.

 

@liziwu compared the means obtained running proc means with those obtained running a paired t-test.

 

While you said that the differences should be the same mathematically .. I disagree! Obviously, I don't disagree that the paired and non-paired t-tests will be different even without missing values, but missing values will definitely have an effect on those means. e.g., here is an example comparing proc means and a paired t-test (which is what @liziwu was comparing). I also included a non-paired t-test as well:

data have;
  input time1 time2;
  cards;
1 3
2 5
99 .
7 8
. 15
5 5
. 14
;

proc means data=have;
  var time1 time2;
run;

proc ttest data=have;
  paired time2*time1;
run;

Art, CEO, AnalystFinder.com

 

 

Super User
Posts: 23,776

Re: Difference in group means (PROC MEANS) vs means of difference (Paired ttest)

I would say if you have missing values, that's a slightly different issue than say the 'base case' with all data. I'm not sure a paired t-test makes sense with missing data, because you're losing the paired test so if there are missing values the tests are not equivalent. I agree with you on that point
Frequent Contributor
Posts: 110

Re: Difference in group means (PROC MEANS) vs means of difference (Paired ttest)

I see your point. I initially thought that simply taking difference of group means was more like unpaired t-test as the observations were not paired.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 177 views
  • 2 likes
  • 3 in conversation