Fluorite | Level 6

## nonlinear regression

Hi!

I want to apply the  nonlinear regression on the data below. my question is  how  identify the parameters value?

`data accidents;input number time intervention time_af_int ;datalines; 17 1 0 010 2 0 015 3 0 014 4 0 026 5 0 09 6 0 011 7 0 017 8 0 010 9 0 015 10 0 021 11 0 011 12 0 014 13 0 016 14 0 09 15 0 011 16 0 013 17 1 110 18 1 2 12 19 1 35 20 1 4 11 21 1 57 22 1 610 23 1 77 24 1 89 25 1 9 6 26 1 106 27 1 116 28 1 12 10 29 1 138 30 1 1411 31 1 157 32 1 168 33 1 175 34 1 18 6 35 1 19;run; proc nlin data=accidents outest=est; parameters b0=            b1=            b2=            b3=            ;  model number=b0+(b1*time**2)+(b2*(intervention**2))+(b3*(time_af_int**2));  run;          `

8 REPLIES 8
SAS Super FREQ

## Re: nonlinear regression

This is a linear regression. You do not need PROC NLIN. You can use PROC GLM to obtain the parameter estimates:

`````` proc glm data=accidents;
model number= time*time intervention*intervention time_af_int*time_af_int;
run;
``````
SAS Super FREQ

## Re: nonlinear regression

Also, given that the response variable is a count, it is more appropriate to use Poisson regression estimated by maximum likelihood, which btw is a log-linear model - a nonlinear model. For example:

``````proc genmod;
model number=time*time intervention*intervention time_af_int*time_af_int / dist=poisson;
run;
``````

Fluorite | Level 6

## Re: nonlinear regression

sorry, the model

number=b0*(time**b1)*(intervention**b2)*(time_af_int**b3)

SAS Super FREQ

## Re: nonlinear regression

Take the log of both sides and you get a linear model for log(number).

But in case you come back with yet another model, the answer to your question is that you make an educated guess. When possible, you can use a reduced model to obtain an initial guess. You can also use a grid search to find initial parameter values for regression models.

SAS Super FREQ

## Re: nonlinear regression

The Poisson model I showed earlier using PROC GENMOD is essentially that model. The only difference is that you are modeling the log(mean), as Rick suggests, rather than the mean directly and provides estimates of those parameters.

Fluorite | Level 6

## Re: nonlinear regression

I used the Poisson model PROC GENMOD to estimate the parameters then use the NLIN.

There is an errors in the output. It is  segmented regression  with breaking point at t=16

SAS Super FREQ

## Re: nonlinear regression

NLIN does not make the same assumption about the response distribution as when you specify DIST=POISSON in PROC GENMOD, and the two procedures do not use the same estimation method. I suggest you use the results from PROC GENMOD and don't use NLIN.

## Re: nonlinear regression

If you are determined to fit this using a nonlinear method, you may want to consider NLMIXED.  There you can specify various distributions in the MODEL statement.  However, I will warn you that NLMIXED, while very powerful and flexible, is one of the most difficult PROCs to implement correctly.  Be sure to check all of the Examples in the documentation (including the two in the Getting Started section) and especially Example 82.4 Poisson-Normal Model with Count Data.

SteveDenham

Discussion stats
• 8 replies
• 787 views
• 5 likes
• 4 in conversation