BookmarkSubscribeRSS Feed
farazs1
Calcite | Level 5

Why would I be able to run same model (log binomial with same input and output variables) in proc hpgenselect but not in proc genmod? There is no difference in my code. Class and model statements are exactly the same. Distribution and link functions are same of course. Any idea why I can run proc hpgenselect but not proc genmod?

19 REPLIES 19
PaigeMiller
Diamond | Level 26

What makes you believe you can't run it in PROC GENMOD? Is there an error message? If so, please show us the log for the entire PROC GENMOD step, including code, NOTEs, WARNINGs and ERRORs. Or, is there some other problem? Show us. 

--
Paige Miller
farazs1
Calcite | Level 5
proc genmod data = data descending;
 class a(ref='0') b(ref='Non-Blast') c(ref='0') d(ref='0')/param=ref;
 model outcome(ref='No') = a b c d / dist = binomial link = log;
run;

Error I get from this is:

NOTE: PROC GENMOD is modeling the probability that outcome='YES'.
WARNING: The specified model did not converge.
NOTE: The Pearson chi-square and deviance are not computed since the AGGREGATE option is not
specified.
ERROR: The mean parameter is either invalid or at a limit of its range for some observations.
NOTE: The scale parameter was held fixed.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE GENMOD used (Total process time):
real time 0.09 seconds
cpu time 0.06 seconds

 

As compared to proc hpgenselect:

PROC HPGENSELECT data=data;

CLASS a(ref='0') b(ref='Non-Blast') c(ref='0') d(ref='0')/param=ref;

model outcome(ref='No')=a b c d /dist=binomial link=log;

RUN;

log shows -

NOTE: The HPGENSELECT procedure is executing in single-machine mode.
NOTE: You are modeling the probability that outcome='YES'.
NOTE: Convergence criterion (FCONV=2.1073424E-8) satisfied.
NOTE: There were 341 observations read from the data set WORK.DATA.
NOTE: PROCEDURE HPGENSELECT used (Total process time):
real time 0.09 seconds
cpu time 0.04 seconds

 

Am I doing something incorrect?

SAS_Rob
SAS Employee

There are differences in the fitting algorithms between the two procedures such that in certain situations you will get slightly different results or convergence versus non-convergence.

If you were to adjust the convergence criterion and fitting algorithm in HPGENSELECT so that it was identical to GENMOD, I suspect you would get the same message.

 

PROC HPGENSELECT data=data gconv=1e-4 tech=newrap;

 

Unfortunately there is not a way to exactly implement what HPGENSELECT does by default in GENMOD.

farazs1
Calcite | Level 5

Can I modify proc genmod in a way so that I can run it same as proc hpgenselect? I want to generate RR estimates off of this model but I can only get coefficients from proc hpgenselect which I will have to turn into RR estimates I want. if I can run this same model in proc genmod, then I can use estimate statement and get RR estimates. or if you have a different solution, that is also fine.

StatDave
SAS Super FREQ

Since the log link does not ensure that predicted values are valid probabilities, this error is common when fitting the log-linked binomial model. Fortunately, it isn't necessary to fit a log-linked binomial model in order to estimate relative risks. You can fit an ordinary logistic model using PROC LOGISTIC and then use the NLMeans macro to produce the relative risk estimates. See this note

farazs1
Calcite | Level 5

I am attempting this approach.

Unfortunately NLmeans macro is not working at the moment. I will keep at it and see what I get.

Thank you!

Ksharp
Super User
Try :
proc genmod data = data ;
class a(ref='0') b(ref='Non-Blast') c(ref='0') d(ref='0')/param=ref;
model outcome = a b c d / dist = binomial link = log;
run;
farazs1
Calcite | Level 5

I believe I already tried that and it did not work.

 

StatDave
SAS Super FREQ
I'm not aware of anything that would keep the LOGISTIC/NLMeans approach from working. Try it and post your code and any errors you get.
farazs1
Calcite | Level 5

I tried one of the terms, let's say term a by itself using proc logistic and then running nlmixed macro. I also ran log-binomial model using proc genmod. Relative risk that I am getting from proc genmod is vastly different from the one I get using nlmixed approach. That should not be the case, right? I can understand if it off by decimals but proc genmod is giving me almost double the RR of the other approach. Am I missing something?

StatDave
SAS Super FREQ

If you will post the code you used, I might be able to tell you what is wrong. You should just have a PROC LOGISTIC step followed by a call of the NLMeans macro. Show any log messages that they generated.

farazs1
Calcite | Level 5

OK so I was running something wrong actually. I was modeling wrong event in one method. I am finally getting same RR for the two methods. However, 95% CL is different for each. NLmeans macro is giving me tighter bounds. Any opinion on why would this be?

farazs1
Calcite | Level 5

any idea how to run two or more terms in one model using this macro? thank you!

StatDave
SAS Super FREQ

GENMOD and NLMeans use different valid methods to compute confidence limits. In GENMOD, the ESTIMATE statement forms a confidence interval on the specified estimate and then exponentiates the estimate and its limits. This results in an interval that is not symmetric around the relative risk estimate. NLMeans forms a confidence interval directly around the relative risk estimate and is symmetric around the estimate. It uses the delta method to estimate the standard error of the relative risk. Since the two methods are different, the widths of the intervals will differ somewhat.

 

The NLMeans macro provides differences or ratios for one variable. If you want to estimate the relative risk for more than one variable, you just need to run the macro more than once. 

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 19 replies
  • 2701 views
  • 2 likes
  • 5 in conversation