Contrast coding (estimate statement) in PROC SURVEYLOGISTIC

Reply
Occasional Contributor
Posts: 9

Contrast coding (estimate statement) in PROC SURVEYLOGISTIC

Hi folks,

I'm using SAS 9.4 on Windows 7. I have a question about the contrast coding in a logistic regression model below:

 

proc surveylogistic data=temp nomcar;
strata _year;
cluster _strata;
class year course (param=effect) ses inc ms /param=reference;
model accepted(event='1') = course age male race ses inc ms q11 q12 year /df=infinity;
weight _wt;

estimate 'course 1 vs. course 5' course 2 1 1 1;

estimate 'course 2 vs. course 3' course 0 1 -1;

run;

 

The response variable [accepted] is dichotomous and has values of 1 (accepted) and 0 (not accepted). I have about 10 predictor variables, including nominal, ordinal and continuous variables. One of them is a nominal variable [course], which has five values: 1, 2, 3, 4 and 5. In addition to the differences among individual courses, I'm interested to test the differences between the following pairs of courses:

 

course 1,3 vs. course 2,4

course 1,3 vs. course 2,5

course 1,3 vs. course 2,4,5

 

I wonder if I can test those group differences by adding the *estimate* statement with contrast codings, or if I have to create additional dummy variables and run the logistic regression models multiple times to get the odds ratios. If this can be done by the estimate statement, would you please let me know the codes?

 

Thank you very much.

Rakkoo

 

 

Frequent Contributor
Posts: 98

Re: Contrast coding (estimate statement) in PROC SURVEYLOGISTIC

It's not clear to me exactly what you mean by:

 

course 1,3 vs. course 2,4

course 1,3 vs. course 2,5

course 1,3 vs. course 2,4,5

 

Do you mean you want to combine courses 1 and 3 and compare them with the combined courses 2 and 4? Is this a differences of differences, where you want to find the difference between 1 and 3 and compare that with the difference between 2 and 4? If you are simply interested in pairwise comparisons of the levels of courses, look into using the LSMEANS statement. Otherwise, you'll have to be more specific about exactly what hypothesis you are trying to test.

Occasional Contributor
Posts: 9

Re: Contrast coding (estimate statement) in PROC SURVEYLOGISTIC

Yes, I'm interested to compare "combined courses 1 and 3" with "combined courses 2 and 4 (and/or 5)". Let me try LSMEANS. Thank you for the suggestion! Smiley Happy
Occasional Contributor
Posts: 9

Re: Contrast coding (estimate statement) in PROC SURVEYLOGISTIC

While I was reading on LSMEANS, I was directed to LSMESTIMATE... I gave it a try using the following code:

 

proc surveylogistic data=temp1 nomcar;
strata _year;
cluster _strata;
class year course ses inc ms /param=glm;
model accepted(event='1') = course age male race ses inc ms q11 q12 year /df=infinity;
weight _wt;
lsmestimate course 'H0: (1,3)=(2,4)' 1 -1 1 -1 /divisor=2;
lsmestimate course 'H0: (1,3)=(2,4,5)' 3 -2 3 -2 -2 /divisor=6;
lsmestimate course 'H0: (1,3)=0' 1 0 1 /divisor=2;
run;

 

My problem is that I don't know if these codes are correct... Can you please verify it?

Frequent Contributor
Posts: 98

Re: Contrast coding (estimate statement) in PROC SURVEYLOGISTIC

Try specifying the E and/or ELSM options with each LSMESTIMATE call. This will output tables that show how the coefficients in the LSMESTIMATE call are being assigned. This will tell you whether or not the estimate is the correct combination of the different fixed effect parameters.

Occasional Contributor
Posts: 9

Re: Contrast coding (estimate statement) in PROC SURVEYLOGISTIC

Coefficients for course Least Squares Means Estimate
Parameter                      course   Row1
Intercept: accepted=0  
course 110.5
course 22-0.5
course 330.5
course 44-0.5
course 55 

 

Least Squares Means Estimate
Effect      Label                  Estimate     Standard Error    z Value   Pr > |z|
courseH0: (1,3)=(2,4)-1.1426   0.2466              -4.63   <.0001

 

Coefficients for course Least Squares Means Estimate
Parameter                      course   Row1
Intercept: accepted=0  
course 110.5
course 22-0.333
course 330.5
course 44-0.333
course 55-0.333

 

Least Squares Means Estimate
Effect       Label                    Estimate  Standard Error   z Value    Pr > |z|
courseH0: (1,3)=(2,4,5)-1.30640.1994             -6.55    <.0001

 

Coefficients for course Least Squares Means Estimate
Parameter                      course   Row1
Intercept: accepted=0 1
course 110.5
course 22 
course 330.5
course 44 
course 55 

 

Least Squares Means Estimate
Effect      Label            Estimate Standard Error    z Value   Pr > |z|
courseH0: (1,3)=0-0.46220.2071             -2.23 0.0256

 

These are the results... Are they correct? I was particularly concerned about *divisor*... 

Ask a Question
Discussion stats
  • 5 replies
  • 282 views
  • 0 likes
  • 2 in conversation