LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2011, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 20 Oct 2011 14:11:34 -0500
Reply-To:   "jonaitis@wisc.edu" <jonaitis@wisc.edu>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Erin McMullen Jonaitis <jonaitis@WISC.EDU>
Organization:   WAI
Subject:   Re: proc mixed contrast statement
Comments:   To: "Swank, Paul R" <Paul.R.Swank@uth.tmc.edu>
In-Reply-To:   <017FB41275AE7A46988755E60E32F40105C4D0CF46@UTHCMS3.uthouston.edu>
Content-type:   text/plain; CHARSET=US-ASCII

Brilliant! That is exactly it. I had my contrasts set up wrong. If I want to duplicate my binary codes with a contrast statement, the correct contrast matrix is:

Contrast "AA" ed -1 1 0 0 Contrast "BA" ed 0 -1 1 0 Contrast "MA" ed 0 0 -1 1

Thank you for solving my conundrum (and making me more confident in the betas obtained with my binary codes)!

Erin

-----Original Message----- From: Swank, Paul R [mailto:Paul.R.Swank@uth.tmc.edu] Sent: Thursday, October 20, 2011 2:02 PM To: jonaitis@wisc.edu; SAS-L@LISTSERV.UGA.EDU Subject: RE: proc mixed contrast statement

Sorry. Didn't think that through. When you code the variables as 0 1 1 1, 0 0 1 1, 0 0 0 1 (call them x1 x2 x3) then the model is

Y = b0 + b1X1 + b2X2 + b3X3

For group 1, Y = b0 which is the mean for group 1; For group 2, x1 = 1 but x2 & x3 are 0 so Y = b0 + b1 so b1 = mean(group 2) - Mean (group 1) For group 3, x1 = 1, x2 = 1, & x3 = 0 so y = b0 + b1 + b2 so than mean(group 3) = mean(group 1) + {mean (group 2) - mean (group 1)} + b2 which makes b2 = mean (group 3) - mean (group 2).

And as follows, b3 = mean (group 4) - mean (group 3)

So the contrasts are really different. Binary coding gets you differences between means.

Paul

Dr. Paul R. Swank, Children's Learning Institute Professor, Department of Pediatrics, Medical School Adjunct Professor, School of Public Health University of Texas Health Science Center-Houston

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Erin McMullen Jonaitis Sent: Thursday, October 20, 2011 12:58 PM To: SAS-L@LISTSERV.UGA.EDU Subject: proc mixed contrast statement

Thanks for your fast reply, Paul. I'm not totally sure I follow -- I know that the indicator codes aren't orthogonal, but neither are the contrasts I set up, so I don't understand why the results aren't the same. It was my impression that orthogonality was desirable, but not mathematically necessary.

I should also note, all the other results (in my larger model with more variables) are the same in either parametrization -- model R^2 and the value of all other coefficients. Steve posited unequal residual variance; as that depends only on my outcome (identical across models) and R^2 (identical across models), I don't think that's the crux of it.

The linearity suggestion is one I could follow, but it seems to me a slight disservice to the data -- I'm not sure we have reason to assume anything beyond ordinality here. My favorite solution would be one that allows me to get beta estimates for each of the levels of education; second best, I think, would be to stick with the default dummy coding and not report betas (as I find them hard to interpret in the dummy context).

I appreciate the suggestions, but am still puzzled!

Erin

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Swank, Paul R Sent: Thursday, October 20, 2011 11:35 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: proc mixed contrast statement

Your indicator coded variables are not orthogonal and so do not account for all the variability in education so your error term is different between the models. Seems to me you might be interested in whether the change in education levels was relatively linear. You could test this with a linear, quadratic and cubic contrast of education.

Paul

Dr. Paul R. Swank, Children's Learning Institute Professor, Department of Pediatrics, Medical School Adjunct Professor, School of Public Health University of Texas Health Science Center-Houston

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Erin McMullen Jonaitis Sent: Thursday, October 20, 2011 10:06 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: proc mixed contrast statement

I'm sorry, I misspoke here -- the last line should be Contrast "MA" ed -1 -1 -1 3.

The other was a typo and is not the error!

Erin

-----Original Message----- From: Erin McMullen Jonaitis [mailto:jonaitis@wisc.edu] Sent: Thursday, October 20, 2011 10:03 AM To: 'SAS-L@listserv.uga.edu' Subject: proc mixed contrast statement

Hi all,

I'm having trouble with some contrasts and I suspect I'm making an elementary error -- advice would be appreciated. I am using Proc Mixed to run these models, but a stripped-down version in Proc GLM gave me the same problem, so it's not an artifact of model complexity.

I have a category variable with a natural ordering -- level of education. Normal dummy coding would class each person by terminal degree and compare each group against some reference group (say, those with no degree at all), but that seems not very useful to me, as a more natural question is "what is the value added by each degree, compared to the reference state of not having it?" So I have instead been parameterizing my model as follows:

Let ed = {1,2,3,4} (representing HS, associate's, bachelor's, and master's, respectively)

And ed_aa = 1 if ed >= 2, 0 otherwise ed_ba = 1 if ed >= 3, 0 otherwise ed_ma = 1 if ed = 4, 0 otherwise

Then I set up my model something like this: outcome = ed_aa ed_ba ed_ma.

As a sanity check, I compared this to a model that includes ed as a class variable (i.e., outcome = ed, preceded by a class statement), and then added contrast statements like so:

contrast "AA" ed -3 1 1 1 contrast "BA" ed -1 -1 1 1 contrast "MA" ed -3 1 1 1

And then checked the p-value, expecting them to be the same (since in my mind, both approaches are comparing groups across three successive thresholds). However, the p-values are not the same -- which suggests one or the other of my conceptualizations is wrong here. Can anyone spot my mistake?

Erin Jonaitis, Ph.D. Assistant Scientist, Wisconsin Alzheimer's Institute 7818 Big Sky Drive Madison, WI 53719


Back to: Top of message | Previous page | Main SAS-L page