Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- Difference in group means (PROC MEANS) vs means of...

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-29-2018 12:29 PM

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

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to liziwu

01-29-2018 12:45 PM

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.

All Replies

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to liziwu

01-29-2018 12:38 PM

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

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to liziwu

01-29-2018 12:45 PM

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

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to liziwu

01-29-2018 12:45 PM

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.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

01-29-2018 02:00 PM

@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

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to art297

01-29-2018 02:04 PM

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

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to art297

01-29-2018 02:18 PM

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.