From 9b2cc2780e2acbbcb3927ee8342b46f93d7bb6ff Mon Sep 17 00:00:00 2001 From: ranke Date: Mon, 18 Jul 2005 07:19:18 +0000 Subject: Now the weibull model has an automatic choice of starting values, fixing a bug that prevented fitting the weibull function in most cases in the last version. Also, the log EC50 is reported as estimated with nlm from the fitted weibull model. Because of the important changes, mainly in naming the different models which leads to incompatibility with the old drfit syntax, I am increasing the minor version number to 0.04 with this release. git-svn-id: http://kriemhild.uft.uni-bremen.de/svn/drfit@30 d1b72e20-2ee0-0310-a1c4-ad5adbbefcdc --- R/drfit.R | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'R/drfit.R') diff --git a/R/drfit.R b/R/drfit.R index 603cf94..527b756 100644 --- a/R/drfit.R +++ b/R/drfit.R @@ -39,7 +39,7 @@ linlogitf <- function(x,k,f,mu,b) drfit <- function(data, startlogEC50 = NA, chooseone=TRUE, probit = TRUE, logit = FALSE, weibull = FALSE, linlogit = FALSE, linlogitWrong = NA, allWrong = NA, - b0 = 2, f0 = 0) + s0 = 0.5, b0 = 2, f0 = 0) { if(!is.null(data$ok)) data <- subset(data,ok!="no fit") # Don't use data where ok # was set to "no fit" @@ -130,7 +130,7 @@ drfit <- function(data, startlogEC50 = NA, chooseone=TRUE, length(subset(allWrong,allWrong == i))==0) { m <- try(nls(response ~ pweibull(-log10(dose)+location,shape), data=tmp, - start=list(location=-0.16,shape=0.4659))) + start=list(location=startlogEC50[[i]],shape=s0))) if (chooseone==FALSE || fit==FALSE) { if (!inherits(m, "try-error")) { fit <- TRUE @@ -179,7 +179,8 @@ drfit <- function(data, startlogEC50 = NA, chooseone=TRUE, rlld[[ri]] <- log10(lowestdose) rlhd[[ri]] <- log10(highestdose) mtype[[ri]] <- "logit" - logEC50[[ri]] <- coef(m)[["logEC50"]] + logEC50[[ri]] <- a[[ri]] <- coef(m)[["logEC50"]] + b[[ri]] <- coef(m)[["scale"]] c[[ri]] <- NA if (logEC50[[ri]] > rlhd[[ri]]) { logEC50[[ri]] <- NA @@ -188,8 +189,6 @@ drfit <- function(data, startlogEC50 = NA, chooseone=TRUE, b[[ri]] <- NA } else { stderrlogEC50[[ri]] <- s$parameters["logEC50","Std. Error"] - a[[ri]] <- coef(m)[["logEC50"]] - b[[ri]] <- coef(m)[["scale"]] } } } -- cgit v1.2.1