diff options
-rw-r--r-- | DESCRIPTION | 4 | ||||
-rw-r--r-- | R/drfit.R | 17 | ||||
-rw-r--r-- | inst/doc/index.html | 2 | ||||
-rw-r--r-- | man/drfit-package.Rd | 6 | ||||
-rw-r--r-- | man/drfit.Rd | 18 | ||||
-rw-r--r-- | tests/XY.R | 2 | ||||
-rw-r--r-- | tests/XY.Rout.save | 13 |
7 files changed, 38 insertions, 24 deletions
diff --git a/DESCRIPTION b/DESCRIPTION index 7182eda..ee6d4ff 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: drfit -Version: 0.05-78 -Date: 2006-05-08 +Version: 0.05-80 +Date: 2006-05-22 Title: Dose-response data evaluation Author: Johannes Ranke <jranke@uni-bremen.de> Maintainer: Johannes Ranke <jranke@uni-bremen.de> @@ -2,7 +2,8 @@ drfit <- function(data, startlogED50 = NA, chooseone=TRUE, probit = TRUE, logit = FALSE, weibull = FALSE, linlogit = FALSE, level = 0.95, linlogitWrong = NA, allWrong = NA, - s0 = 0.5, b0 = 2, f0 = 0) + ps0 = 1, ls0 = 0.5, ws0 = 0.5, + b0 = 2, f0 = 0) { require(MASS) if(!is.null(data$ok)) data <- subset(data,ok!="no fit") # Don't use data @@ -114,7 +115,7 @@ drfit <- function(data, startlogED50 = NA, chooseone=TRUE, length(subset(allWrong,allWrong == i))==0) { m <- try(nls(response ~ pnorm(-log10(dose),-logED50,scale), data=tmp, - start=list(logED50=startlogED50[[i]],scale=1))) + start=list(logED50=startlogED50[[i]],scale=ps0))) if (chooseone==FALSE || fit==FALSE) { if (!inherits(m, "try-error")) { fit <- TRUE @@ -157,7 +158,7 @@ drfit <- function(data, startlogED50 = NA, chooseone=TRUE, length(subset(allWrong,allWrong == i))==0) { m <- try(nls(response ~ plogis(-log10(dose),-logED50,scale), data=tmp, - start=list(logED50=startlogED50[[i]],scale=1))) + start=list(logED50=startlogED50[[i]],scale=ls0))) if (chooseone==FALSE || fit==FALSE) { if (!inherits(m, "try-error")) { fit <- TRUE @@ -199,7 +200,7 @@ drfit <- function(data, startlogED50 = NA, chooseone=TRUE, length(subset(allWrong,allWrong == i))==0) { m <- try(nls(response ~ pweibull(-log10(dose)+location,shape), data=tmp, - start=list(location=startlogED50[[i]],shape=s0))) + start=list(location=startlogED50[[i]],shape=ws0))) if (chooseone==FALSE || fit==FALSE) { if (!inherits(m, "try-error")) { fit <- TRUE @@ -273,10 +274,10 @@ drfit <- function(data, startlogED50 = NA, chooseone=TRUE, } results <- data.frame(rsubstance, rndl, rn, rlld, rlhd, mtype, logED50, logED50low, logED50high, runit, sigma, a, b) - names(results) <- c("Substance","ndl","n","lld","lhd","mtype","logED50", - paste(100*(1-level)/2,"%",sep=""), - paste(100*(1+level)/2,"%",sep=""), - "unit","sigma","a","b") + names(results) <- c("Substance","ndl","n","lld","lhd","mtype","logED50", + paste(100*(1-level)/2,"%",sep=""), + paste(100*(1+level)/2,"%",sep=""), + "unit","sigma","a","b") if (linlogit) { results$c <- c diff --git a/inst/doc/index.html b/inst/doc/index.html index d6cedf5..6d27f48 100644 --- a/inst/doc/index.html +++ b/inst/doc/index.html @@ -8,7 +8,7 @@ <h2>User Guide for package drfit</h2> <dl> <dt><a href="drfit-Rnews.pdf">drfit-Rnews.pdf</a>:</dt> - <dd> Preliminary version of an Introductory article on drfit</dd> + <dd>Introductory article on drfit, published in R News</dd> </dl> </body> diff --git a/man/drfit-package.Rd b/man/drfit-package.Rd index 43334ff..3064787 100644 --- a/man/drfit-package.Rd +++ b/man/drfit-package.Rd @@ -8,7 +8,9 @@ Dose-response data evaluation See \url{../DESCRIPTION} } \details{ -There is a preliminary version of an introductory article located in \url{../doc/drfit-Rnews.pdf}. +There is an introductory article located in \url{../doc/drfit-Rnews.pdf}, +which will be published in the R News special edition on the use +of R for chemists. } \author{ Author and Maintainer: Johannes Ranke <jranke@uni-bremen.de> @@ -28,5 +30,5 @@ the advantage of my package is its user-friendliness. data(antifoul) r <- drfit(antifoul) format(r,digits=2) -\dontrun{drplot(r,antifoul,overlay=TRUE,bw=FALSE)} +drplot(r,antifoul,overlay=TRUE,bw=FALSE) } diff --git a/man/drfit.Rd b/man/drfit.Rd index 453c0f8..6b98f36 100644 --- a/man/drfit.Rd +++ b/man/drfit.Rd @@ -8,7 +8,7 @@ \usage{ drfit(data, startlogED50 = NA, chooseone = TRUE, probit = TRUE, logit = FALSE, weibull = FALSE, linlogit = FALSE, level = 0.95, linlogitWrong = NA, - allWrong = NA, s0 = 0.5, b0 = 2, f0 = 0) + allWrong = NA, ps0 = 1, ls0 = 0.5, ws0 = 0.5, b0 = 2, f0 = 0) } \arguments{ \item{data}{ @@ -56,12 +56,18 @@ logit, weibull, 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{ps0}{ + If the probit model is fitted, \code{ps0} gives the possibility to adjust + the starting value for the scale parameter of \code{\link{pnorm}}.} + \item{ls0}{ + If the logit model is fitted, \code{ls0} gives the possibility to adjust + the starting value for the scale parameter of \code{\link{plogis}}.} + \item{ws0}{ + If the weibull model is fitted, \code{ws0} 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 - adjust the starting values for the parameters b and f.} + If the linearlogistic model is fitted, \code{b0} and \code{f0} give the + possibility to adjust the starting values for the parameters b and f.} } \value{ \item{results}{ @@ -1,4 +1,4 @@ library(drfit) data(XY) -rXY <- drfit(XY) +rXY <- drfit(XY,logit=TRUE,weibull=TRUE,chooseone=FALSE) rXY diff --git a/tests/XY.Rout.save b/tests/XY.Rout.save index d8098ae..9da519f 100644 --- a/tests/XY.Rout.save +++ b/tests/XY.Rout.save @@ -1,6 +1,6 @@ R : Copyright 2006, The R Foundation for Statistical Computing -Version 2.3.0 (2006-04-24) +Version 2.3.1 beta (2006-05-18 r38119) ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. @@ -19,21 +19,26 @@ Type 'q()' to quit R. Loading required package: MASS Loading required package: RODBC > data(XY) -> rXY <- drfit(XY) +> rXY <- drfit(XY,logit=TRUE,weibull=TRUE,chooseone=FALSE) Control: Fitting data... Substance X: Fitting data... Waiting for profiling to be done... +Waiting for profiling to be done... Substance Y: Fitting data... > rXY Substance ndl n lld lhd mtype logED50 2.5% 97.5% unit 1 Control 1 6 -Inf -Inf inactive NA NA NA mg/L 2 Substance X 4 12 1 3 probit 2.161905 2.105861 2.214359 mg/L -3 Substance Y 4 12 1 3 active NA NA NA mg/L +3 Substance X 4 12 1 3 logit 2.160948 2.112152 2.207912 mg/L +4 Substance X 4 12 1 3 weibull 2.174365 NA NA mg/L +5 Substance Y 4 12 1 3 active NA NA NA mg/L sigma a b 1 NA NA NA 2 0.04131746 2.161905 0.5061306 -3 NA NA NA +3 0.03758732 2.160948 0.2991424 +4 0.05723870 3.009640 2.0362368 +5 NA NA NA > |