[R] Fitting a first order compartment model in nlme

Ranae ranae.dietzel at gmail.com
Tue May 1 20:51:01 CEST 2012


Hello,

I am using SSfol in nlme to fit some data for the change of N concentration
(N) in plant tissue over time (gdd).  The model works nicely for 2 out of 3
treatments, so I would really like to use it, but it consistently has a bad
fit for my third treatment.  I am pasting the figure for the third treatment
only.  I feel that I have my fixed and random effects properly identified,
but have also tried many combinations to see if I can improve the fit.  

Are there any other ideas of what I can do to capture the highest point of N
with the model?

http://r.789695.n4.nabble.com/file/n4601419/Predicted_N_2.png 

Here is my code for the figure followed by a link to the dataset.

library(nlme)
cna<-read.table("aboveground C and N, dates removed, zeros added.txt",
header=TRUE)

###Aboveground 2011, treatment PF only
n11a<-subset(cna, cna$year == "2011" & cna$ground == "Above" & cna$trt ==
"PF")
n11a$plotF <- as.factor(n11a$plot)
n11aG<-groupedData(N ~ gdd | plotF, data=n11a)

fit.dose<- nlsList(N ~ SSfol(dose, gdd, lke, lka, lCl), data = n11aG)
plot(intervals(fit.dose), layout=c(3,1))

fit.nlme.11a<- nlme(fit.dose, random=pdDiag(lCl ~ 1))

fit.nlme2.11a<-update(fit.nlme.11a, random = list(lCl + lka ~ 1))
png("thermaltimefigs/Predicted N 1.png")
plot(augPred(fit.nlme.11a), level = 0:1)
dev.off()

png("thermaltimefigs/Predicted N 2.png")
plot(augPred(fit.nlme2.11a), level = 0:1)
dev.off()

data at:
http://dl.dropbox.com/u/21080842/aboveground%20C%20and%20N%2C%20dates%20removed%2C%20zeros%20added.txt

Thanks,

Ranae








--
View this message in context: http://r.789695.n4.nabble.com/Fitting-a-first-order-compartment-model-in-nlme-tp4601419.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list