aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
Diffstat (limited to 'R')
-rw-r--r--R/drfit.R11
1 files changed, 7 insertions, 4 deletions
diff --git a/R/drfit.R b/R/drfit.R
index da5b34d..ff19cca 100644
--- a/R/drfit.R
+++ b/R/drfit.R
@@ -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)))

Contact - Imprint