[R] An error in fitting a non linear regression
petr.pikal at precheza.cz
Tue Feb 24 11:48:06 CET 2009
r-help-bounces at r-project.org napsal dne 24.02.2009 11:31:22:
> 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
> the model which will lead to lm(log(q)~log(-depth)). What is
> between this syntax and lm(log(q) ~ I(-depth))?
If you have
y = a*exp(-b*x) then log of this equation is
log(y) = log(a) - b * x
at least I was told that by my teacher back at school some decades ago
that log(exp(x)) = x.
You can prove it by
interactively in R
> 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
> > It often helps to find initial values of the same order of magnitude
> > 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 =
> > 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:
> Sent from the R help mailing list archive at Nabble.com.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help