turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Exponential regression and square root model

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-16-2015 12:20 PM

How to find the exponential regression via SAS?

Accepted Solutions

Solution

07-01-2015
11:05 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-01-2015 11:05 PM

Unfortunately, **proc nlin** is not very generous in terms of fit diagnostics compared to, say, **proc reg**. You thus have to do your own calculations, as I did below for the R square and the AIC.

**data test;**

**input y x;**

**datalines;**

**3.366 3**

**3.052 6**

**2.666 9**

**2.755 12**

**2.203 15**

**1.886 18**

**1.525 21**

**1.547 24**

**0.81 27**

**0.76 30**

**0.27 33**

**0.67 36**

**;**

**title "Corrected sum of squares";**

**proc sql;**

**select css(y) into :CSSy**

**from test;**

**quit;**

**title "Linear fit";**

**ods graphics / imagename="LinearFit";**

**proc nlin data=test plots=fit;**

**parameters S0=1 b=0;**

**model y = S0 - b*x;**

**ods output EstSummary=summLin;**

**run;**

**proc sql;**

**select N.nValue1 as n format=4.0, **

** SSE.nValue1 as SSE, **

** 1 - SSE.nValue1/&CSSy as RSquare,**

** N.nValue1 * log(SSE.nValue1/N.nValue1) + 2*2 as AIC**

**from summLin as N, summLin as SSE**

**where N.Label1="Observations Used" and SSE.Label1="Objective";**

**quit;**

**title "Exponential fit";**

**ods graphics / imagename="ExponentialFit";**

**proc nlin data=test plots=fit;**

**parameters S0=1 b=0;**

**model y = S0 * exp( - b*x);**

**ods output EstSummary=summExp;**

**run;**

**proc sql;**

**select N.nValue1 as n format=4.0, **

** SSE.nValue1 as SSE, **

** 1 - SSE.nValue1/&CSSy as RSquare,**

** N.nValue1 * log(SSE.nValue1/N.nValue1) + 2*2 as AIC**

**from summExp as N, summExp as SSE**

**where N.Label1="Observations Used" and SSE.Label1="Objective";**

**quit;**

**title """Square root"" fit";**

**ods graphics / imagename="SquareRootFit";**

**proc nlin data=test plots=fit;**

**parameters S0=1 b=0;**

**model y = (sqrt(S0) - b*x)**2;**

**ods output EstSummary=summSqrt;**

**run;**

**proc sql;**

**select N.nValue1 as n format=4.0, **

** SSE.nValue1 as SSE, **

** 1 - SSE.nValue1/&CSSy as RSquare,**

** N.nValue1 * log(SSE.nValue1/N.nValue1) + 2*2 as AIC**

**from summSqrt as N, summSqrt as SSE**

**where N.Label1="Observations Used" and SSE.Label1="Objective";**

**quit;**

R square and AIC are appropriate for comparing models in this case because the dependent data is the same and the number of fitted parameters is the same for the three models. Turns out that for this data, the linear model fits the best.

PG

PG

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-16-2015 03:01 PM

PROC GENMOD and PROC GLIMMIX can fit models where the response is assumed to possess a probability distribution of the exponential form.

If *exponential* and *square root* refer to your model equation, i.e. you are trying to fit a non-linear model, then PROC NLIN will likely accomodate your needs.

PG

PG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-16-2015 03:06 PM

My data

y | x |

3.366 | 3 |

3.052 | 6 |

2.666 | 9 |

2.755 | 12 |

2.203 | 15 |

1.886 | 18 |

1.525 | 21 |

1.547 | 24 |

0.81 | 27 |

0.76 | 30 |

0.27 | 33 |

0.67 | 36 |

I am just a beginner, I know how to find linear (proc reg) but I don't know how to find the square root and exponential regression (nonlinear regression).

I would be glad if you kindly run these proc's on my data and send the calculation as an example to me.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-16-2015 10:50 PM

Here is an example of fitting an exponential function to your data using non-linear regression :

**data test;**

**input y x;**

**datalines;**

**3.366 3**

**3.052 6**

**2.666 9**

**2.755 12**

**2.203 15**

**1.886 18**

**1.525 21**

**1.547 24**

**0.81 27**

**0.76 30**

**0.27 33**

**0.67 36**

**;**

**proc nlin data=test plots=fit;**

**parameters a=1 b=-1;**

**model y = a*exp(b*x);**

**run;**

Check out the output listing and the FitPlot graph.

PG

PG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-01-2015 03:51 AM

Thank you for your help.

Dearest sir, I run it and it works perfectly for exponential model. It means right now I can run linear model, and exponential model on SAS but what about square root model? I need to run the square model too on my data. Dearest sir, I have to run all these three models (together if possible otherwise separately) for my data using SAS.

*P.S The above exponential method doesn't produce any R2 value.

Many many thanks , kind of you

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-01-2015 09:56 AM

I don't know what you mean exactly by "square root model" for this data. Please explain. - PG

PG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-01-2015 09:59 AM

Not Sure. Maybe OP means f(x)=x^2

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-01-2015 10:08 AM

But look at the data. It is inversly proportional to x.

PG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-01-2015 12:55 PM

Here are the equations form of square root model, linear, and exponential. From this plate form with the help of you people I have learnt but now I want to also run square root model. Please have a look at the above picture.

Thanks alot

Solution

07-01-2015
11:05 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-01-2015 11:05 PM

Unfortunately, **proc nlin** is not very generous in terms of fit diagnostics compared to, say, **proc reg**. You thus have to do your own calculations, as I did below for the R square and the AIC.

**data test;**

**input y x;**

**datalines;**

**3.366 3**

**3.052 6**

**2.666 9**

**2.755 12**

**2.203 15**

**1.886 18**

**1.525 21**

**1.547 24**

**0.81 27**

**0.76 30**

**0.27 33**

**0.67 36**

**;**

**title "Corrected sum of squares";**

**proc sql;**

**select css(y) into :CSSy**

**from test;**

**quit;**

**title "Linear fit";**

**ods graphics / imagename="LinearFit";**

**proc nlin data=test plots=fit;**

**parameters S0=1 b=0;**

**model y = S0 - b*x;**

**ods output EstSummary=summLin;**

**run;**

**proc sql;**

**select N.nValue1 as n format=4.0, **

** SSE.nValue1 as SSE, **

** 1 - SSE.nValue1/&CSSy as RSquare,**

** N.nValue1 * log(SSE.nValue1/N.nValue1) + 2*2 as AIC**

**from summLin as N, summLin as SSE**

**where N.Label1="Observations Used" and SSE.Label1="Objective";**

**quit;**

**title "Exponential fit";**

**ods graphics / imagename="ExponentialFit";**

**proc nlin data=test plots=fit;**

**parameters S0=1 b=0;**

**model y = S0 * exp( - b*x);**

**ods output EstSummary=summExp;**

**run;**

**proc sql;**

**select N.nValue1 as n format=4.0, **

** SSE.nValue1 as SSE, **

** 1 - SSE.nValue1/&CSSy as RSquare,**

** N.nValue1 * log(SSE.nValue1/N.nValue1) + 2*2 as AIC**

**from summExp as N, summExp as SSE**

**where N.Label1="Observations Used" and SSE.Label1="Objective";**

**quit;**

**title """Square root"" fit";**

**ods graphics / imagename="SquareRootFit";**

**proc nlin data=test plots=fit;**

**parameters S0=1 b=0;**

**model y = (sqrt(S0) - b*x)**2;**

**ods output EstSummary=summSqrt;**

**run;**

**proc sql;**

**select N.nValue1 as n format=4.0, **

** SSE.nValue1 as SSE, **

** 1 - SSE.nValue1/&CSSy as RSquare,**

** N.nValue1 * log(SSE.nValue1/N.nValue1) + 2*2 as AIC**

**from summSqrt as N, summSqrt as SSE**

**where N.Label1="Observations Used" and SSE.Label1="Objective";**

**quit;**

R square and AIC are appropriate for comparing models in this case because the dependent data is the same and the number of fitted parameters is the same for the three models. Turns out that for this data, the linear model fits the best.

PG

PG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-02-2015 02:59 AM

Dearest sir,

I can;t express my happiness after running your suggested programming on SAS. It really works and fullfil my needs. I will just say wow excellent sir, hats off to you.

Many many thanks dearest sir.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-02-2015 03:58 AM

Dearest sir,

These are the last two models remained. Could make the programming for these above two models too using my data.

In logistic model:

Y = % prey remaining in the stomach

A = estimated parameter

B = scale parameter

C = x-ordinate of the point of inflection of the curve

t = elapsed time after ingestion

In power exponential model:

Y = % prey remaining in the stomach

A = half life of decaying prey

B = shape coefficient

t = elapsed time after ingestion

Many many thanks dearest sir.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-24-2017 10:24 PM

Hi PG Stats,

I am trying to learn about the exponential regression model and was guessing on how you determined the values "a=1 and b=b=-1" (**parameters a=1 b=-1. Are they from the dependant variable of the model? Can you please explain that for my understanding? Thank you**

**Fridge_wpg**