BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Quartz | Level 8

## 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

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## 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.

6 REPLIES 6
Opal | Level 21

## 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

## 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.

Super User

## 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.

Opal | Level 21

## 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 @lizzy28 asked about.

@lizzy28 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 @lizzy28 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

## 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
Quartz | Level 8

## 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.

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