0
$\begingroup$

The exponential relationship between y and x I got is

    model_1 <- nls(y ~ I(a * exp(-b * x)), 
                   start = list(a = 1, b = 0), trace = TRUE) 

and I got the parameter of a and b


Formula: y ~ I(a * exp(-b * x))

Parameters:
    Estimate Std. Error  t value Pr(>|t|)    
a  9.997e-01  2.664e-06 375275.8   <2e-16 ***
b -2.134e-04  4.298e-07   -496.5   <2e-16 ***
---

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.00136 on 626679 degrees of freedom

Number of iterations to convergence: 2 
Achieved convergence tolerance: 3.387e-08

How can I transform y or x so that if I replot them, there will be a linear relationship between them?

$\endgroup$
2
$\begingroup$

In terms of the relationship alone

$ y = a \exp(-b x) $

implies

$\ln y = \ln a - b x$

so that you could regress $\ln y$ on $x$ and accordingly expect that the coefficient of $x$ will be negative. Exponentiating the estimated intercept will give you an estimate of $a$ in the original equation.

But whether this is a good thing to do depends on the variability around the line (in that space). The assumptions behind this include the variation of $\ln y$ being about constant with $x$, which you can assess in various ways. The simplest and usually most fruitful are looking at a scatter plot with $y$ on logarithmic scale and looking at a plot of residual versus fitted for the regression. If the variability is approximately constant on the original scale, then indeed nonlinear least squares is indicated.

Detail: With your sample size, it may be that (say) a 1% random sample gives a scatter plot that will be as easy or easier to think about.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.