BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
pink_poodle
Barite | Level 11

I have multiple predictors and a continuous outcome. I want to do a nonlinear regression, not sure about model parameters. What approach/procedure should I use? Could you please provide good SAS example code? 

 

Many thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

The values in the PARMS statement are starting values for the function.  The maximum likelihood algorithm updates these until the convergence criterion is met.

 

Now if you only want to do Poisson regression, there are other PROCs already geared for that - GENMOD and GLIMMIX come to mind, depending on whether you have random effects (GLIMMIX) or not (GENMOD).  Other PROCs capable of this sort of regression are really not for a first voyage into Poisson regression (BGLIMM, HPGENSELECT, MCMC)  And that is just in SAS/STAT - there are more in SAS/ETS.

 

SteveDenham

View solution in original post

12 REPLIES 12
PaigeMiller
Diamond | Level 26

There are many examples in the PROC NLIN documentation.

https://documentation.sas.com/?docsetId=statug&docsetVersion=14.2&docsetTarget=statug_nlin_examples....

--
Paige Miller
pink_poodle
Barite | Level 11
Yes, I looked through them. They fit exponential functions. How do they
know what to fit? I would like SAS to determine the best-fitting curve.
PaigeMiller
Diamond | Level 26

"Best fitting curve" can mean a lot of different things. Without a much more detailed description of the problem you have, no one can give you a detailed answer.


And just because the examples are exponential, the same methods can be used on other non-linear models.

--
Paige Miller
pink_poodle
Barite | Level 11
Thank you! I would like SAS to determine the equation of the closest
fitting curve. Is there a separate procedure for that? Then i can provide
this equation to proc nlin. There are multiple predictors and the outcome
is a normally distributed continuous variable.
PGStats
Opal | Level 21

Since you don't care for any particular function (or set of functions) I would suggest that you try proc adaptivereg.

 

https://documentation.sas.com/?docsetId=statug&docsetVersion=14.3&docsetTarget=statug_adaptivereg_ov... 

 

it does (almost) everything for you.

PG
PaigeMiller
Diamond | Level 26

Another option is to use PROC TRANSREG, there are many different types of spline fits in there.

--
Paige Miller
pink_poodle
Barite | Level 11

However, proc nlin is parametric, vs. proc adaptivereg is non-parametric. It is good to know about proc adaptivereg, but the results of proc nlin may be more interpretable. 

SteveDenham
Jade | Level 19

Here is the issue:  There are an infinite number of possible non-linear curves.  Some will have interpretable coefficients, some may not.  You need to define a family of possible curves that have some sort of meaning for the data and the process that generates them. Then I would suggest using NLMIXED to fit each of these to exactly the same data, and collecting the AIC values, and selecting the model with the minimum AIC.  This preserves the most information in the data.  In most cases, this is the "best-fitting" model, plus you already have the output you need.

 

SteveDenham

pink_poodle
Barite | Level 11

Thank you very much for helpful suggestions! @SteveDenham , about NLMIXED, maybe I can use Poisson regression described here for my continuous outcome variable?:

https://stats.idre.ucla.edu/sas/faq/how-can-i-run-simple-linear-and-nonlinear-models-using-nlmixed/

Do you know why they set all parameters to zero in the code?:

proc nlmixed data='D:datahsbdemo.sas7bdat';
  parms b0=0 b1=0 b2=0;
  xb=b0+b1*read+b2*female;
  mu = exp(xb);
  model awards ~ poisson(mu);
run;
SteveDenham
Jade | Level 19

The values in the PARMS statement are starting values for the function.  The maximum likelihood algorithm updates these until the convergence criterion is met.

 

Now if you only want to do Poisson regression, there are other PROCs already geared for that - GENMOD and GLIMMIX come to mind, depending on whether you have random effects (GLIMMIX) or not (GENMOD).  Other PROCs capable of this sort of regression are really not for a first voyage into Poisson regression (BGLIMM, HPGENSELECT, MCMC)  And that is just in SAS/STAT - there are more in SAS/ETS.

 

SteveDenham

pink_poodle
Barite | Level 11
Thank you for a helpful reply! I will use GENMOD for Poisson regression.
Ksharp
Super User

Also try EFFECT statement in many PROC ,like proc glm ......

@Rick_SAS  wrote a couple of blog about this topic .

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
  • 12 replies
  • 1519 views
  • 3 likes
  • 5 in conversation