turn on suggestions

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

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Help Calculating Skewness of Residuals in Proc Mix...

Topic Options

- Subscribe to 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
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-24-2013 08:30 PM

Hello everyone,

I am running a growth model with longitudinal person data and have been reading the following article:

http://www.statcan.gc.ca/pub/82-003-x/2011004/article/11598-eng.htm

I would like to calculate the skewness of both level 1 and level 2 for my model like they do in this article but currently using ods graphics and outp i only get one measure of skewness. I am working at the RDC so cannot input my exact syntax.

Can anyone help? It would be much appreciated.

Sincerely,

Naomi

PhD Candidate

University of Toronto

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

04-24-2013 09:32 PM

Unless I am missing something, it should be enough to add option **OUTP=myL1Res**id to your MODEL statement in PROC MIXED and then do:

**proc univariate data=myL1Resid normal ;**

**var Resid;**

**run;**

to get the skewness of residuals and a whole lot of other distribution measures.

Same thing for L2.

PG

PG

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

04-25-2013 09:34 AM

Hi PG,

Thanks for your response.

However, the article I am referencing provides different calculations of skewness at each level - which is what I would assume.

However, when I do as you say above I get identical output when I put L1 versus L2 - I assume I am just changing the name of the dataset, right? Am I supposed to put the OUTP statement somewhere different in the proc mixed statement to get the residual output for level2?

Thanks again,

Naomi

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

04-25-2013 11:16 AM

You're right, Level-2 will probably be a bit more complicated. It would help us a lot if you posted a (simplified or disguised if necessary) version of your SAS code.

PG

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

04-25-2013 11:30 AM

OK sure, it's something like this:

proc mixed noclprint poitprint data = work.slid;

class personid;

model index = vismin vismin*t cborn cborn*t (etc.) / residual solution ddfm = btw notest cl;

random intercept t/sub=personid;

run;

Thanks!

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

04-25-2013 12:13 PM

I would try something like this (also hoping to get 's opinion on this):

...

random intercept t/sub=personid** s**;

ods output SolutionR=Level_2R;

...

proc univariate data=Level_2R(where=(lowcase(Effect)="t")) normal;

var Estimate;

run;

Not sure about the part in blue. Check the Level_2R dataset to select the proper rows.

PG

PG

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

04-25-2013 05:17 PM

Thank you - this did work but I'm not exactly sure I understand what it's doing. what is "s"?

It is now calculating a new skewness measure which I can take to be the Level 2 measure?

I appreciate all your help.

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

04-25-2013 06:32 PM

Option s is for requesting the printing of random effect estimates (solutions). It is required to get the SolutionR output dataset.

What I understand in the referenced article is that Level-2 residuals are the estimated random effects associated with individuals, i.e. the variation between individuals. Level-1 residuals are the random variation of measurements within individuals.

I hope somebody better versed in MIXED modelling than I am will be able to help you further.

Good luck!

PG

PG

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

04-26-2013 08:41 AM

Hi everybody (for those of you who are Simpsons fans, that's Dr Nick's entering line),

Go with the answers that PG offered. The OUTP= dataset will have the level 1 residuals, the ODS output statement for the solution of the random effects will give the level 2 residuals. NOTE WELL: The level 2 residuals are meaningful only if you are working with a normal distribution in PROC MIXED. If you were fitting a generalized linear mixed model using PROC GLIMMIX, the values are not really residuals in the traditional sense. They are deviations, but unless an overdispersion effect is added, the model does not include residual error.

Steve Denham

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

05-01-2013 10:38 AM

Great. Thanks for this Steve.