BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
JME1
Obsidian | Level 7

Hi all,

 

I'm computing a modified poisson regression  (poisson regression using a robust variance) to get RRs. This is my first time doing it and it ran okay, but I have a combination of binary and categorical variables.  My output current gives me beta estimates for the binary variables accurately, however it gives me only one Beta estimate for the categorical variable and it seems as though it is treating them as binary variables.

 

This is my code:

 

proc genmod data = test;
class enrolid  sex (ref='2')  agecat(ref='1') race (ref='1') smoke (ref='0');
model diag= sex agecat race smoke / dist = poisson link = log;
repeated subject = enrolid/ type = unstr;
estimate 'Beta race' race 1 -1/exp;
estimate 'Beta smoke' smoke1 -1/exp;
estimate 'Beta sex' sex 1 -1/exp;
estimate 'Beta agecat' agecat 1 -1/exp;
run;

This is what my results look like :

Race has 4 levels and Agecat has 5 levels - how do I get the mean beta estimates for all the different levels? 

Sex and Smoke are binary and the results match my logistic regression so I know it's fine, but race and agecat is significantly different.

 

                                  Mean estimate | Confidence limits| L'beta est |SE| 
Beta Race | 0.44970.25030.65841.49280.02340.051.44701.53874073.4<.0001
Exp(Beta Race)  4.44970.10410.054.25034.6584  
Beta Sex | 1.9961.91292.08430.69150.02190.050.64860.7344998.08<.0001
Exp(Beta sex)  1.99670.04370.051.91292.0843  
Beta agecat 1.1011.04481.16190.09700.02710.050.04380.150112.800.0003
Exp(Beta agecat)  1.10180.02990.051.04481.1619  
Beta smoke 0.6260.58310.6732-0.46750.03660.05-0.5393-0.3958162.91<.0001
Exp(Beta smoke)  0.62650.02300.050.58310.6732 
1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

The results you show are from your ESTIMATE statements. If you look at the Parameter estimates table you will see that there are multiple parameter estimates for RACE and AGECAT. But each of your ESTIMATE statements only requests that one difference of two parameters be estimated. Hence only one estimate is provided by each statement. If you want pairwise comparisons among all of the levels in each predictor, then it is better to not use ESTIMATE (or CONTRAST) statements and instead use the LSMEANS statement as illustrated in the "Zou's modified Poisson approach" section of this note. You should always avoid the more difficult ESTIMATE or CONTRAST statements when other statements like LSMEANS, LSMESTIMATE, or SLICE can be used. 

View solution in original post

7 REPLIES 7
StatDave
SAS Super FREQ

The results you show are from your ESTIMATE statements. If you look at the Parameter estimates table you will see that there are multiple parameter estimates for RACE and AGECAT. But each of your ESTIMATE statements only requests that one difference of two parameters be estimated. Hence only one estimate is provided by each statement. If you want pairwise comparisons among all of the levels in each predictor, then it is better to not use ESTIMATE (or CONTRAST) statements and instead use the LSMEANS statement as illustrated in the "Zou's modified Poisson approach" section of this note. You should always avoid the more difficult ESTIMATE or CONTRAST statements when other statements like LSMEANS, LSMESTIMATE, or SLICE can be used. 

JME1
Obsidian | Level 7

Thank you @StatDave ! Using the LSmeans statement worked.

 

 

 

 

yubaraj
Fluorite | Level 6

Hi @JME1  would you please share the code how you used LSmeans for the categorical variables.

I was wondering if LSmeans statement can be used when I have individual level data, not the aggregate count data.

pspen
Fluorite | Level 6

@JME1 Could you please share your code after using the LSMEANS statement? I am new to SAS and am having to run this procedure so it would be very helpful. Thank you.

StatDave
SAS Super FREQ

See the link to "this note" in the accepted answer. The note it links to shows the code using including the LSMEANS statement.

Kunko
Obsidian | Level 7

Would please share your SAS code after including  LSMEANS statement? Your support is appreciated!

pspen
Fluorite | Level 6

Hi Tol, 

I used this note 23003 - Estimating a relative risk (also called risk ratio, prevalence ratio) (sas.com) as mentioned by StatDave, to guide me. In the note, I used the 'Nonmodeling estimate using a logistic model' that calls the NLMeans (62362 - Estimate and test differences, ratios, or contrasts of means in generalized linear models (s...) macro and NLEst (58775 - Estimating nonlinear combinations of model parameters (sas.com) ) macro. However, you have to ensure that the macros are the latest for it to work. Because I use SAS on a server, I had to copy and paste the code from the macros into the program editor of my SAS interface and submit from there before I could proceed further. Once I could do that, the code as provided in the note I mentioned above worked perfectly.

Thank you to @FreelanceReinh for helping me figure it out! Re: %LSMeans Warning: Apparent Invocation NLMeans not resolved - SAS Support Communities

 

Good luck!

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 7 replies
  • 5245 views
  • 4 likes
  • 5 in conversation