BookmarkSubscribeRSS Feed
naomi_lightman
Calcite | Level 5

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

9 REPLIES 9
PGStats
Opal | Level 21

Unless I am missing something, it should be enough to add option OUTP=myL1Resid 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
naomi_lightman
Calcite | Level 5

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

PGStats
Opal | Level 21

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
naomi_lightman
Calcite | Level 5

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!

PGStats
Opal | Level 21

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
naomi_lightman
Calcite | Level 5

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.

PGStats
Opal | Level 21

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
SteveDenham
Jade | Level 19

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

naomi_lightman
Calcite | Level 5

Great. Thanks for this Steve.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 9 replies
  • 2074 views
  • 0 likes
  • 3 in conversation