Hi
r-help-bounces at r-project.org napsal dne 24.02.2009 11:31:22:
Hi,
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
log(exp(whatever))
interactively in R
Regards
Petr
2) How can I calculate the R-squared of a fitted non linear model?
Regards
Saeed
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 =