Elizabeth,
You should cc rhelp on all correspondence so other readers can follow the
thread of conversation.
Now that I have some data to play with, I see where I went wrong in my
previous e-mail.
First of all, you can't fit a model
CO2 ~ log(a*Time) + b
because log(a*Time) can be rewritten as log(a) + log(Time) and there's no
way that the two parameters, log(a) and b, can be uniquely estimated.
You could change your model to
CO2 ~ a*log(Time) + b
I did this and fit the model using both the base 10 and base e logs ...
same result. So the base of the logs doesn't matter. However, this model
doesn't do a great job of fitting the curve.
I tried another model
CO2 ~ a*(1-exp(-b*Time))
which seemed to do better. Still not great, though. So, I tried it with
one more parameter
CO2 ~ c + a*(1-exp(-b*Time))
and that improved it further.
Jean
fit1 <- nls(CO2 ~ a*log(Time) + b, start=c(a=68, b=400), data=FG2)
plot(FG2$Time, FG2$CO2)
lines(FG2$Time, predict(fit1), col="red")
fit2 <- nls(CO2 ~ a*log10(Time) + b, start=c(a=68, b=400), data=FG2)
lines(FG2$Time, predict(fit1), col="blue", lty=2, lwd=2)
fit3 <- nls(CO2 ~ a*(1-exp(-b*Time)), start=c(a=500, b=0.03), data=FG2)
lines(FG2$Time, predict(fit3), col="green", lwd=2)
fit4 <- nls(CO2 ~ c + a*(1-exp(-b*Time)), start=c(a=500, b=0.03, c=0),
data=FG2)
lines(FG2$Time, predict(fit4), col="brown", lwd=2)
On Tue, Jul 9, 2013 at 8:10 AM, Elizabeth Webb
<
webb.eli...@gmail.com>wrote:
> Hi Jean-
> Thanks for responding. Below I have provided dput(FG2[1:50, ]). I have
> also attached a graph of my data.
> Thanks for the hint on working a third parameter into my model. I will
> certainly try that once I get the model working.
> Elizabeth
>
> dput(FG2[1:50, ])
> structure(list(CO2 = c(383.29, 392, 394.38, 392.85, 413.14, 394.56,
> 405.83, 409.61, 408.15, 412.63, 414.62, 423.19, 422.39, 426.81,
> 433.34, 433.95, 438.02, 438.21, 442.84, 441.81, 444.09, 444.59,
> 446.35, 447.11, 450.03, 452.03, 452.69, 453.7, 455.17, 456.65,
> 458.72, 458.88, 459.25, 459.88, 464.06, 461.34, 464.66, 465.19,
> 466.96, 466.86, 468.41, 469.49, 471.08, 471.61, 472.95, 473.94,
> 474.63, 475.79, 477.07, 476.53), Time = c(53, 54, 55, 56, 57,
> 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
> 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
> 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102)), .Names = c("CO2",
> "Time"), row.names = c(NA, 50L), class = "data.frame")