[R] NLME model question
Darren Shaw
Darren.Shaw at ed.ac.uk
Fri May 14 12:11:07 CEST 2004
Dear R-helpers
I have a problem related to the use of NLME
I think is simply a matter of getting the nlme coding correct, but i cannot
get my brain around it
I am analysing some 24 growth curves of some cells , and i wanted to say
that there are significant differences between the curves in two parameters
that describe the pattern of growth. these parameters are from a logistic
(r & k) .
i have attempted to construct a self starting routine for nlme ie:
SSGrowth_function(x, r, k)
{
.expr2 <- (k - 100000)/100000
.expr5 <- exp(((r * -1) * x))
.expr7 <- 1 + (.expr2 * .expr5)
.expr13 <- .expr7^2
.value <- k/.expr7
.actualArgs <- match.call()[c("r", "k")]
if(all(unlist(lapply(as.list(.actualArgs), is.name)))) {
.grad <- array(0, c(length(.value), 2), list(NULL, c("r",
"k")))
.grad[, "r"] <- - ((k * (.expr2 * (.expr5 * (-1 *
x))))/.expr13)
.grad[, "k"] <- (1/.expr7) - ((k * (1e-005 * .expr5))/.expr13)
dimnames(.grad) <- list(NULL, .actualArgs)
attr(.value, "gradient") <- .grad
}
.value
}
where x = time, 100000 = known starting conditions, r = growth and k =
carrying capacity
i guessed i should then write
nlme(NoofCells~SSGrowth(Time,r,k),fixed=r+k~1,data=CellData,random=r+k~1)
This runs and tells me that r & k's do differ
BUT. The "CellData" actually consists of replicates - ie there are 4 cell
types, but they are done 6 times each. Therefore, I do not want to ask if
there are significant differences in r & k between 24 sets of data
("Runs")- rather I want to be able to say that there are differences
between the four cell types occurring 6 times each. So how do
i incorporate "CellType" explicitly into my model structure??
i.e. If i was lust looking at say linear growth and was using lme I would
have written something like
lme(NoofCells~Time*CellType,random=~1|Runs,data=CellData)
Any thoughts/suggestions gratefully received
Darren Shaw
-----------------------------------------------------------------
Dr Darren J Shaw
Centre for Tropical Veterinary Medicine (CTVM)
Royal School of Veterinary Studies
The University of Edinburgh
Scotland
More information about the R-help
mailing list