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.
Beta Race | 0.4497 | 0.2503 | 0.6584 | 1.4928 | 0.0234 | 0.05 | 1.4470 | 1.5387 | 4073.4 | <.0001 |
Exp(Beta Race) | 4.4497 | 0.1041 | 0.05 | 4.2503 | 4.6584 | ||||
Beta Sex | 1.996 | 1.9129 | 2.0843 | 0.6915 | 0.0219 | 0.05 | 0.6486 | 0.7344 | 998.08 | <.0001 |
Exp(Beta sex) | 1.9967 | 0.0437 | 0.05 | 1.9129 | 2.0843 | ||||
Beta agecat 1.101 | 1.0448 | 1.1619 | 0.0970 | 0.0271 | 0.05 | 0.0438 | 0.1501 | 12.80 | 0.0003 |
Exp(Beta agecat) | 1.1018 | 0.0299 | 0.05 | 1.0448 | 1.1619 | ||||
Beta smoke 0.626 | 0.5831 | 0.6732 | -0.4675 | 0.0366 | 0.05 | -0.5393 | -0.3958 | 162.91 | <.0001 |
Exp(Beta smoke) | 0.6265 | 0.0230 | 0.05 | 0.5831 | 0.6732 |
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.
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.
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.
@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.
See the link to "this note" in the accepted answer. The note it links to shows the code using including the LSMEANS statement.
Would please share your SAS code after including LSMEANS statement? Your support is appreciated!
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!
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!
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.