Hi all!
I am modelling the correlation between a rheumatic disease (systemic sclerosis = exposure) and cancer (outcome) using a poisson regression model in proc genmod. My co-variates are age and sex. Individuals with systemic sclerosis (1) are compared to comparators (0) without the disease. The estimate I get from this model is incidence rate ratio. Sex is a binary variable and also ssc. Age is a dicrete variable. Can = cancer.
My main model using Proc GENMOD is:
The rate difference can also be estimated by fitting the Poisson model using PROC NLMIXED as follows. The LAMBDA= assignment statement expresses the Poisson mean parameter, lambda, as a function of age, the offset (ln), and the model parameters (b0 and b1). The MODEL statement indicates that the response count, c, is to be modeled as a Poisson variable with mean lambda. The ESTIMATE statement is used to estimate the rate difference. A large degrees of freedom value (df=1e8) is used to produce large-sample (Wald) statistics like those from the NLMeans and NLEstimate macros above. Note that the estimated log rate for age 1 is b0+b1 and the estimated log rate for age 2 is just b0. For details about using PROC NLMIXED, see the NLMIXED documentation.
proc nlmixed data=insure; lambda = exp(b0 + b1*(age=1) + ln); model c ~ poisson(lambda); estimate "Rate Difference" exp(b0+b1)-exp(b0) df=1e8; run;
For those interested, the page that is referred to and shows the NLMIXED code is this SAS note. You can add your sex and age variables as follows. Since you treated age as continuous in your GENMOD code, the same is done in NLMIXED. I assume that the non-reference value of sex is 1 and that sex is a numeric variable.
lambda = exp(b0 + b1*(ssc=1) + b2*(sex=1) + b3*age + logpy);
If the ESTIMATE statement is unchanged from what is shown in the SAS note, it will estimate the rate difference at the reference level of sex (sex=2) and age=0 since that setting adds no contributions involving sex or age.
For those interested, the page that is referred to and shows the NLMIXED code is this SAS note. You can add your sex and age variables as follows. Since you treated age as continuous in your GENMOD code, the same is done in NLMIXED. I assume that the non-reference value of sex is 1 and that sex is a numeric variable.
lambda = exp(b0 + b1*(ssc=1) + b2*(sex=1) + b3*age + logpy);
If the ESTIMATE statement is unchanged from what is shown in the SAS note, it will estimate the rate difference at the reference level of sex (sex=2) and age=0 since that setting adds no contributions involving sex or age.
Hi Dave!
Thanks for your suggestion!
Sex is coded 1 or 2. Ssc is coded 0 or 1. Age is a numeric value in integers.
I tried to run it but I got the following message in the log (and the process was not run):
218 proc nlmixed data=incidence5;
219 lambda = exp(b0 + b1*(ssc=1) + b2*(sex =1) + b3*age + logpy); /*lambda = poisson mean parameter*/
NOTE: Character value converted to numeric for argument 1 of '=' operation.
220 model can ~ poisson(lambda);
221 estimate "Rate Difference" (exp(b0+b1)-exp(b0))*1000 df=1e8; /* *1000 to get the estimates as /1000 person years*/
222 estimate "incidence rate comparators" exp(b0)*1000 df=1e8;
223 estimate "incidence rate SSc" exp(b0+b1)*1000 df=1e8;
224
225 run;
NOTE: To assign starting values to parameters, use the PARMS statement. The default starting value of 1.0 is in effect for all parameters.
ERROR: No valid parameter points were found.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE NLMIXED used (Total process time):
real time 0.04 seconds
cpu time 0.04 seconds
So it sounds like I need to add a PARMS statement. But how do I choose adequate initial values of the estimates?
Thanks again!
Best,
Karin
I think the first Note indicates the problem. It suggests that one of your variables is character, not numeric. If, for example, your sex variable has character values '1' and '2', then in the LAMBDA= statement you need to use ... b2(sex='1') ...
Thanks all!
Sorry I missed the first note about character/numeric variables. You were right sex is a character value and I adjusted the code accordingly.
Now the code looks like this:
Thank you Dave,
If I don't use the PARMS statement I don't get any output estimates. If I use the PARMS statement as suggested I get the estimates but a bit off the expected range when compared to the unadjusted estimates.
Time for a sensitivity analysis of the NLMIXED results. Set up a fairly narrow gridsearch in the PARMS statement so that you can get an idea of how sensitive the parameter values are to the starting values. This may take care of your differences from the expected values.
SteveDenham
Thank you Steve. I will try that.
Best,
Karin
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.