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!
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
There are many examples in the PROC NLIN documentation.
"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.
Since you don't care for any particular function (or set of functions) I would suggest that you try proc adaptivereg.
it does (almost) everything for you.
Another option is to use PROC TRANSREG, there are many different types of spline fits in there.
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.
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
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;
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
Also try EFFECT statement in many PROC ,like proc glm ......
@Rick_SAS wrote a couple of blog about this topic .
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.