[R] An error in fitting a non linear regression

Saeed Ahmadi ahmadi_saeed at yahoo.com
Tue Feb 24 11:31:22 CET 2009


Thank you for the reply and suggestions.

I have two questions?
1) If I want to use log, it seems that I have to take log from both sides of
the model which will lead to lm(log(q)~log(-depth)). What is tehdifference
between this syntax and lm(log(q) ~ I(-depth))?

2) How can I calculate the R-squared of a fitted non linear model?


Christian Ritz-3 wrote:
> Hi Saeed,
> one approach is to try out several initial value combinations for a and b.
> It often helps to find initial values of the same order of magnitude and
> of the same sign
> as the final estimates.
> To get such initial values, you could linearize the model:
> lm(log(q) ~ I(-depth))
> and supply the estimated coefficients from the linear regression as
> starting values:
> nreg <- nls(q ~ a*exp(-b*depth), start = list(a = 0.76168, b = -0.08484))
> summary(nreg)
> Christian
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

View this message in context: http://www.nabble.com/An-error-in-fitting-a-non-linear-regression-tp22118160p22179525.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list