aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
Diffstat (limited to '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