[R] Exponential regression

Larry Hotchkiss larryh at udel.edu
Mon Jan 11 17:09:46 CET 2010


There are a couple of points to keep in mind when doing a log-transform of an exponential model, such as --

     y = a*exp(b*x)

    1. The implicit statistical model is multiplicative in the error. The implied
       statistical model of the log transform is --

         log(y) = log(a) + b*x + u 

       which implies --

         y = a*exp(b*x)*exp(u)

       A linear regression in the log transform is not a least-squares fit in the
       original model, which implies a statistical model like --

         y = a*exp(b*x) + u

       This may be OK, but it should be recognized. The least-squares fit in this
       untransformed model requires a nonlinear fit.

    2. If y is distributed log-normal, its expected value is --

         E(y) = exp(logy.hat + 0.5*var(u))

       not exp(logy.hat) as one might expect. Here logy.hat is the predicted
       value of the log of y in the log-linear regression, and var(u) is the
       error variance around the fitted line of the log-linear regression.

    3. If your model contains an intercept term --

         y = a + c*exp(b*x)

       You need nonlinear least-squares or maximum likelihood to fit it.

Larry Hotchkiss
-----------------------------------------------------------------------------------
Date: Sun, 10 Jan 2010 16:44:02 -0500
From: "Murray Cooper" <myrmail at earthlink.net>
To: "chrisli1223" <chrisli at austwaterenv.com.au>,
<r-help at r-project.org>
Subject: Re: [R] R exponential regression
Message-ID: <1FA457DC6FE04DE4AB2541D89D2D05C1 at ownerc86c2419d>
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
reply-type=original

Chris,

I haven't seen anyone post a reply yet so thought I'd
throw in my thoughts. I'm no R expert!

When you talk about an exponential trend line are you
refering to:

1)  y=ax^b
or
2) y=ae^(bx)

If 1) then take base10 logs of y and x and then fit them
with simple linear regression. Then calculate the antilog
of the residulas and plot these as your trendline.

If 2) then take natural logs of y and x and follow the rest
of the procedure described in 1).

Hope this helps.

Murray M Cooper, Ph.D.
Richland Statistics
9800 N 24th St
Richland, MI, USA 49083
Mail: richstat at earthlink.net

----- Original Message -----
From: "chrisli1223" <chrisli at austwaterenv.com.au>
To: <r-help at r-project.org>
Sent: Thursday, January 07, 2010 10:33 PM
Subject: [R] R exponential regression


>
> Hi all,
>
> I have a dataset which consists of 2 columns. I'd like to plot them on a
> x-y
> scatter plot and fit an exponential trendline. I'd like R to determine the
> equation for the trendline and display it on the graph.
>
> Since I am new to R (and statistics), any advice on how to achieve this
> will
> be greatly appreciated.
>
> Many thanks,
> Chris
> --



More information about the R-help mailing list