From 9b08a42e6eb2c35818f904b309da5632fa3eff1c Mon Sep 17 00:00:00 2001 From: ranke Date: Thu, 19 May 2005 15:23:54 +0000 Subject: Added the "allWrong" argument to the drfit function for dose-response data that produce misleading or wrong fits with all dose-response models. git-svn-id: http://kriemhild.uft.uni-bremen.de/svn/drfit@25 d1b72e20-2ee0-0310-a1c4-ad5adbbefcdc --- DESCRIPTION | 4 ++-- R/drfit.R | 11 +++++++---- man/drfit.Rd | 5 ++++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 879d5b8..d082ff6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: drfit -Version: 0.03-24 -Date: 2005-04-27 +Version: 0.03-25 +Date: 2005-05-19 Title: Dose-response data evaluation Author: Johannes Ranke Maintainer: Johannes Ranke 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))) diff --git a/man/drfit.Rd b/man/drfit.Rd index 42bbd07..2ec4a73 100644 --- a/man/drfit.Rd +++ b/man/drfit.Rd @@ -7,7 +7,7 @@ } \usage{ drfit(data, startlogEC50 = NA, chooseone = TRUE, lognorm = TRUE, logis = FALSE, - linearlogis = FALSE, linearlogisWrong = NA, b0 = 2, f0 = 0) + linearlogis = FALSE, linearlogisWrong = NA, allWrong = NA, b0 = 2, f0 = 0) } \arguments{ \item{data}{ @@ -38,6 +38,9 @@ \item{linearlogisWrong}{ An optional vector containing the names of the substances for which the linearlogis function produces a wrong fit.} + \item{allWrong}{ + An optional vector containing the names of the substances for which all + functions produces a wrong fit.} \item{chooseone}{ If TRUE (default), the models are tried in the order linearlogis, logis and lognorm, and the first model that produces a valid fit is used. Usually this will be the one -- cgit v1.2.1