# [R] Svar: Re: lme, nlsList, nlsList.selfStart

From: Christian Ritz <ritz_at_kvl.dk>
Date: Sat 18 Feb 2006 - 03:58:48 EST

Hi Patrick,

this is not a solution to your problems with getting 'nls' to work, but may still be of some use to you.

The package 'drc' on CRAN offers an alternative to 'nls'. See the following example using your data frame mydata2.

library(drc)

## Defining the non-linear function

"fct1" <- function(dose, parm)
{

100 * exp(parm[,1]+parm[,2]-parm[,3]) *    (exp(-exp(parm[,1])*dose)-exp(-exp(parm[,2])*dose)) /(exp(parm[,2])-exp(parm[,1]))
}

## Fitting the model (for details see ?multdrc)
model1 <- multdrc(Conc+1~Tps, Organ, data=mydata2, fct=list(fct1, NULL, c("lKe","lKa","lCl")), startVal=c(-2.77, -2.77, -2.77, -1.41, -1.41, -1.41, -1.13, -1.13, -1.13))

summary(model1) # a lot of parameters could be 0!

plot(model1, log="")

## Plots for each level of Organ

```plot(model1, level="Carc", ylim=c(0,5), log="")
plot(model1, level="Foie", log="")
plot(model1, level="TD", ylim=c(0,6), log="")

```

## Fitting the model with a transform-both-sides Box-Cox transformation
## - in an attempt to adjust for variance inhomogeneity (visible in the
residual plot)
model2 <- multdrc(Conc+1~Tps, Organ, data=mydata2, fct=list(fct1, NULL, c("lKe","lKa","lCl")), startVal=c(-2.77, -2.77, -2.77, -1.41, -1.41, -1.41, -1.13, -1.13, -1.13),boxcox=T)

summary(model2)

Hope this is of help to you!?

Best regards

Christian

R-help@stat.math.ethz.ch mailing list