aboutsummaryrefslogtreecommitdiff
path: root/R/drfit.R
diff options
context:
space:
mode:
authorranke <ranke@d1b72e20-2ee0-0310-a1c4-ad5adbbefcdc>2005-07-18 07:19:18 +0000
committerranke <ranke@d1b72e20-2ee0-0310-a1c4-ad5adbbefcdc>2005-07-18 07:19:18 +0000
commit9b2cc2780e2acbbcb3927ee8342b46f93d7bb6ff (patch)
treece4671ca9b77c54b72b43e3330e2057e8f3930e8 /R/drfit.R
parentb83cc0e0ec978b5d047924a222a387152b086f4b (diff)
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
Diffstat (limited to 'R/drfit.R')
-rw-r--r--R/drfit.R9
1 files changed, 4 insertions, 5 deletions
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"]]
}
}
}

Contact - Imprint