diff options
Diffstat (limited to 'R')
-rw-r--r-- | R/drfit.R | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -38,7 +38,7 @@ linearlogisf <- function(x,k,f,mu,b) drfit <- function(data, startlogEC50 = NA, chooseone=TRUE, lognorm = TRUE, logis = FALSE, - linearlogis = FALSE, linearlogisWrong = NA, + linearlogis = FALSE, linearlogisWrong = NA, allWrong = NA, b0 = 2, f0 = 0) { if(!is.null(data$ok)) data <- subset(data,ok!="no fit") @@ -84,7 +84,8 @@ drfit <- function(data, startlogEC50 = NA, chooseone=TRUE, inactive <- FALSE if (linearlogis && - length(subset(linearlogisWrong,linearlogisWrong == i))==0) { + length(subset(linearlogisWrong,linearlogisWrong == i))==0 && + length(subset(allWrong,allWrong == i))==0) { m <- try(nls(response ~ linearlogisf(dose,1,f,logEC50,b), data=tmp, start=list(f=f0,logEC50=startlogEC50[[i]],b=b0))) @@ -113,7 +114,8 @@ drfit <- function(data, startlogEC50 = NA, chooseone=TRUE, } } - if (logis) { + if (logis && + length(subset(allWrong,allWrong == i))==0) { m <- try(nls(response ~ plogis(-log10(dose),-logEC50,slope), data=tmp, start=list(logEC50=startlogEC50[[i]],slope=1))) @@ -143,7 +145,8 @@ drfit <- function(data, startlogEC50 = NA, chooseone=TRUE, } } - if (lognorm) { + if (lognorm && + length(subset(allWrong,allWrong == i))==0) { m <- try(nls(response ~ pnorm(-log10(dose),-logEC50,slope), data=tmp, start=list(logEC50=startlogEC50[[i]],slope=1))) |