From 9b2cc2780e2acbbcb3927ee8342b46f93d7bb6ff Mon Sep 17 00:00:00 2001 From: ranke Date: Mon, 18 Jul 2005 07:19:18 +0000 Subject: 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 --- DESCRIPTION | 21 +++++++++++---------- R/drfit.R | 9 ++++----- man/drfit.Rd | 7 +++++-- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 6b1b85b..ce7412f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: drfit -Version: 0.03-29 -Date: 2005-07-16 +Version: 0.04-30 +Date: 2005-07-17 Title: Dose-response data evaluation Author: Johannes Ranke Maintainer: Johannes Ranke @@ -8,14 +8,15 @@ Depends: R (>= 2.1.0),stats,RODBC Description: drfit provides basic functions for fitting dose-response curves to dose-response data, calculating some (eco)toxicological parameters and plotting the results. Functions that are fitted are the cumulative densitiy - function of the lognormal distribution, of the logistic distribution and a - linear-logistic model, derived from the latter, which is used to describe - data showing stimulation at low doses (hormesis). In addition, functions - checking, plotting and retrieving dose-response data of the UFT Bremen, - Department of Bioorganic Chemistry, are provided. - I would be delighted if you would join in this effort of creating useful - and useable tools for dealing with dose-response data from biological - testing. + function of the lognormal distribution (probit fit), of the logistic + distribution (logit fit), of the weibull distribution (weibull fit) and + a linear-logistic model ("linlogit" fit), derived from the latter, + which is used to describe data showing stimulation at low doses + (hormesis). In addition, functions checking, plotting and retrieving + dose-response data of the UFT Bremen, Department of Bioorganic + Chemistry, are provided. I would be delighted if you would join in + this effort of creating useful and useable tools for dealing with + dose-response data from biological testing. License: GPL version 2 or newer URL: http://www.r-project.org, http://www.uft.uni-bremen.de/chemie/ranke, 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"]] } } } diff --git a/man/drfit.Rd b/man/drfit.Rd index 0d9ee6f..35d6d94 100644 --- a/man/drfit.Rd +++ b/man/drfit.Rd @@ -8,7 +8,7 @@ \usage{ drfit(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) } \arguments{ \item{data}{ @@ -55,9 +55,12 @@ logit, probit, and the first model that produces a valid fit is used. If FALSE, all models that are set to TRUE and that can be fitted will be reported.} + \item{s0}{ + If the weibull model is fitted, s0 gives the possibility to adjust the + starting value for the shape parameter of \code{\link{pweibull}}.} \item{b0,f0}{ If the linearlogistic model is fitted, b0 and f0 give the possibility to - adapt the starting values for the parameters b and f.} + adjust the starting values for the parameters b and f.} } \value{ \item{results}{ -- cgit v1.2.1