├── DESCRIPTION ├── LICENCE ├── MD5 ├── NAMESPACE ├── NEWS ├── R ├── CIcompX.R ├── CRS.6.R ├── ED.drc.R ├── ED.lin.R ├── EDcomp.R ├── EDhelper.R ├── MAX.R ├── NEC.R ├── PR.R ├── Rsq.R ├── absToRel.R ├── anova.drc.R ├── anova.drclist.R ├── arandaordaz.R ├── backfit.R ├── baro5.R ├── boxcox.drc.R ├── braincousens.R ├── braincousens.ssf.R ├── cedergreen.R ├── cedergreen.ssf.R ├── coef.drc.R ├── commatFct.R ├── compParm.R ├── comped.R ├── confint.drc.R ├── cooks.distance.drc.R ├── drm.R ├── drmConvertParm.R ├── drmEMPoisson.R ├── drmEMbinomial.R ├── drmEMeventtime.r ├── drmEMls.R ├── drmEMstandard.R ├── drmLOFbinomial.R ├── drmLOFls.R ├── drmOpt.R ├── drmPNsplit.R ├── drmParNames.R ├── drmRobust.R ├── drmc.R ├── fct2list.R ├── findbe.R ├── findcd.R ├── fitted.drc.R ├── fplogistic.R ├── gammadr.R ├── gaussian.R ├── gaussian.ssf.R ├── genRetFct.R ├── getInitial.R ├── getMeanFunctions.R ├── gompertz.R ├── gompertz.ssf.R ├── gompertzd.R ├── hatvalues.drc.R ├── hewlett.R ├── iband.R ├── idrm.R ├── isobole.R ├── lgaussian.R ├── lin.test.R ├── llogistic.R ├── llogistic.ssf.R ├── llogistic2.R ├── lnormal.R ├── lnormal.ssf.R ├── logLik.drc.R ├── logistic.R ├── logistic.ssf.R ├── maED.R ├── mixture.R ├── modelFit.R ├── modelFunction.R ├── mr.test.R ├── mrdrm.R ├── mselect.R ├── multi2.R ├── neill.test.R ├── noEffect.R ├── onAttach.R ├── pickParm.R ├── plot.drc.R ├── predict.drc.R ├── print.drc.R ├── print.summary.drc.R ├── rdrm.R ├── relpot.R ├── repChar.R ├── resPrint.R ├── residuals.drc.R ├── rse.R ├── sandwich.R ├── searchdrc.R ├── showNews.R ├── siInner.R ├── simDR.R ├── simFct.R ├── summary.drc.R ├── threephase.R ├── twophase.R ├── ucedergreen.R ├── update.drc.R ├── ursa.R ├── vcov.drc.R ├── voelund.R ├── weibull1.R ├── weibull1.ssf.R ├── weibull2.R ├── weibull2.ssf.R ├── weibull2x.R ├── xlogx.R └── yieldLoss.R ├── data ├── G.aparine.rda ├── H.virescens.rda ├── M.bahia.rda ├── O.mykiss.rda ├── P.promelas.rda ├── RScompetition.rda ├── S.alba.rda ├── S.capricornutum.rda ├── acidiq.rda ├── algae.rda ├── auxins.rda ├── chickweed.rda ├── chickweed0.rda ├── daphnids.rda ├── decontaminants.rda ├── deguelin.rda ├── earthworms.rda ├── etmotc.rda ├── finney71.rda ├── germination.rda ├── glymet.rda ├── heartrate.rda ├── leaflength.rda ├── lepidium.rda ├── lettuce.rda ├── mecter.rda ├── metals.rda ├── methionine.rda ├── nasturtium.rda ├── ryegrass.rda ├── secalonic.rda ├── selenium.rda ├── spinach.rda ├── terbuthylazin.rda └── vinclozolin.rda ├── inst └── CITATION ├── man ├── AR.Rd ├── BC.Rd ├── CIcompX.Rd ├── CRS.4a.Rd ├── CRS.5a.Rd ├── ED.drc.Rd ├── EDcomp.Rd ├── EXD.Rd ├── G.aparine.Rd ├── H.virescens.Rd ├── LL.2.Rd ├── LL.3.Rd ├── LL.4.Rd ├── LL.5.Rd ├── M.bahia.Rd ├── MAX.Rd ├── MM.Rd ├── NEC.Rd ├── O.mykiss.Rd ├── P.promelas.Rd ├── PR.Rd ├── RScompetition.Rd ├── S.alba.Rd ├── S.capricornutum.Rd ├── W2.Rd ├── W3.Rd ├── W4.Rd ├── acidiq.Rd ├── algae.Rd ├── anova.drc.Rd ├── auxins.Rd ├── backfit.Rd ├── barley.Rd ├── baro5.Rd ├── boxcox.drc.Rd ├── braincousens.Rd ├── bread.drc.Rd ├── cedergreen.Rd ├── chickweed.Rd ├── coef.drc.Rd ├── compParm.Rd ├── comped.Rd ├── confint.drc.Rd ├── daphnids.Rd ├── decontaminants.Rd ├── deguelin.Rd ├── drm.Rd ├── drmc.Rd ├── earthworms.Rd ├── etmotc.Rd ├── finney71.Rd ├── fitted.drc.Rd ├── fplogistic.Rd ├── gammadr.Rd ├── gaussian.Rd ├── germination.Rd ├── getInitial.Rd ├── getMeanFunctions.Rd ├── glymet.Rd ├── gompertz.Rd ├── gompertzd.Rd ├── hatvalues.drc.Rd ├── heartrate.Rd ├── isobole.Rd ├── lepidium.Rd ├── lettuce.Rd ├── lin.test.Rd ├── llogistic.Rd ├── lnormal.Rd ├── logLik.drc.Rd ├── logistic.Rd ├── maED.Rd ├── mecter.Rd ├── metals.Rd ├── methionine.Rd ├── mixture.Rd ├── modelFit.Rd ├── mr.test.Rd ├── mselect.Rd ├── multi2.Rd ├── nasturtium.Rd ├── neill.test.Rd ├── noEffect.Rd ├── plot.drc.Rd ├── predict.drc.Rd ├── print.drc.Rd ├── print.summary.drc.Rd ├── rdrm.Rd ├── residuals.drc.Rd ├── ryegrass.Rd ├── searchdrc.Rd ├── secalonic.Rd ├── selenium.Rd ├── simDR.Rd ├── spinach.Rd ├── summary.drc.Rd ├── terbuthylazin.Rd ├── twophase.Rd ├── update.drc.Rd ├── ursa.Rd ├── vcov.drc.Rd ├── vinclozolin.Rd ├── weibull1.Rd └── yieldLoss.Rd └── tests ├── test1.R ├── test1.data1.txt ├── test1.w1.txt ├── test2.R ├── test2.redroot_dose.csv └── test3.R /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: drc 2 | Version: 3.0-1 3 | Date: 2016-08-25 4 | Title: Analysis of Dose-Response Curves 5 | Author: Christian Ritz , Jens C. Strebig 6 | Maintainer: Christian Ritz 7 | Depends: R (>= 2.0.0), MASS, stats 8 | Imports: car, gtools, multcomp, plotrix, scales 9 | LazyLoad: yes 10 | LazyData: yes 11 | Description: Analysis of dose-response data is made available through a suite of flexible and versatile model fitting and after-fitting functions. 12 | License: GPL-2 | file LICENCE 13 | URL: http://www.r-project.org, http://www.bioassay.dk 14 | NeedsCompilation: no 15 | Packaged: 2016-08-24 23:24:51 UTC; mwr165 16 | Repository: CRAN 17 | Date/Publication: 2016-08-30 01:33:38 18 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | 2 | The package 'drc' provides functionality for inference in multiple non-linear regression models. 3 | 4 | Copyrights 5 | ========== 6 | 7 | Our understanding is that all data sets are not copyright. 8 | 9 | All other files are copyright (C) 2004 Christian Ritz and Jens C. Streibig. 10 | 11 | 12 | Licence 13 | ======= 14 | 15 | This is free software; you can redistribute it and/or modify 16 | it under the terms of the GNU General Public License as published by 17 | the Free Software Foundation; either version 2 of the License, or 18 | (at your option) any later version. 19 | 20 | This program is distributed in the hope that it will be useful, 21 | but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | GNU General Public License for more details. 24 | 25 | You should have received a copy of the GNU General Public License 26 | along with this program; if not, write to the Free Software 27 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 28 | 29 | 30 | The file COPYING in the R top-level directory is a copy of the 'GNU 31 | General Public License'. 32 | 33 | 34 | ritz@bioassay.dk 35 | streibig@bioassay.dk 36 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/NEWS -------------------------------------------------------------------------------- /R/EDhelper.R: -------------------------------------------------------------------------------- 1 | "EDhelper" <- function(parmVec, respl, reference, typeCalc, cond = TRUE) 2 | { 3 | ## Converting absolute to relative 4 | if (typeCalc == "absolute") 5 | { 6 | p <- 100 * ((parmVec[3] - respl) / (parmVec[3] - parmVec[2])) 7 | # typeCalc <- "relative" 8 | } else { 9 | p <- respl 10 | } 11 | ## Swapping p for an increasing curve 12 | if (cond) 13 | { 14 | if ((typeCalc == "relative") && (parmVec[1] < 0) && (reference == "control")) 15 | { 16 | p <- 100 - p 17 | } 18 | } else { 19 | if ((typeCalc == "relative") && (reference == "control")) 20 | { 21 | p <- 100 - p 22 | } 23 | } 24 | p 25 | } -------------------------------------------------------------------------------- /R/MAX.R: -------------------------------------------------------------------------------- 1 | "MAX" <- function( 2 | object, lower = 1e-3, upper = 1000, pool = TRUE) 3 | { 4 | ## Checking class of 'object' 5 | MAXlist <- object[[11]]$"maxfct" 6 | if (is.null(MAXlist)) {stop("No method available")} 7 | 8 | ## Retrieving relevant quantities 9 | indexMat <- object$"indexMat" 10 | parm <- as.vector(coef(object)) 11 | parmMat <- object$"parmMat" 12 | strParm <- colnames(parmMat) 13 | varMat <- vcov(object, pool = pool) 14 | 15 | ## Calculating ED values 16 | ncolIM <- ncol(indexMat) 17 | indexVec <- 1:ncolIM 18 | dimNames <- rep("", ncolIM) 19 | MAXmat <- matrix(0, ncolIM, 2) 20 | 21 | for (i in indexVec) 22 | { 23 | parmInd <- indexMat[,i] 24 | varCov <- varMat[parmInd, parmInd] 25 | parmChosen <- parmMat[,i] 26 | MAXmat[i, ] <- MAXlist(parmChosen, lower, upper) 27 | dimNames[i] <- strParm[i] 28 | } 29 | 30 | dimnames(MAXmat) <- list(dimNames, c("Dose", "Response")) 31 | printCoefmat(MAXmat) 32 | invisible(MAXmat) 33 | } 34 | -------------------------------------------------------------------------------- /R/PR.R: -------------------------------------------------------------------------------- 1 | "PR" <- function(object, xVec, ...) 2 | { 3 | lenXV <- length(xVec) 4 | 5 | curveId <- as.character(unique(object$data[, 3])) 6 | lenCI <- length(curveId) 7 | 8 | if (lenCI > 1) 9 | { 10 | retMat <- predict(object, data.frame(xVec, rep(curveId, rep(lenXV, lenCI))), se.fit = TRUE, ...) 11 | rownames(retMat) <- paste(rep(curveId, rep(lenXV, lenCI)), rep(as.character(xVec), lenCI), sep = ":") 12 | } else { 13 | retMat <- predict(object, data.frame(xVec)) 14 | if (is.matrix(retMat)) 15 | { 16 | rownames(retMat) <- rep(as.character(xVec), lenCI) 17 | } else { 18 | names(retMat) <- rep(as.character(xVec), lenCI) 19 | } 20 | } 21 | 22 | return(retMat) 23 | } 24 | -------------------------------------------------------------------------------- /R/Rsq.R: -------------------------------------------------------------------------------- 1 | "Rsq" <- function(object) 2 | { 3 | response <- object$data[,2] 4 | curve <- object$data[,4] 5 | uniCurve <- unique(curve) 6 | lenUC <- length(uniCurve) 7 | 8 | numerator <- tapply( residuals(object)^2, curve, sum) # residual ss 9 | denominator <- tapply( (response - mean(response))^2, curve, sum) # total SS 10 | 11 | totnum <- sum(residuals(object)^2) 12 | totden <- sum((response - mean(response))^2) 13 | 14 | if (lenUC==1) 15 | { 16 | hText <- "\nR-square value\n" 17 | rsq <- matrix(c(1 - numerator/denominator), 1, 1) 18 | rownames(rsq) <- "" 19 | } else { 20 | hText <- "\nR-square values\n" 21 | rsq <- matrix(c(1 - numerator/denominator, 1-totnum/totden), lenUC+1, 1) 22 | rownames(rsq) <- c(as.character(uniCurve), "Total") 23 | } 24 | colnames(rsq) <- "" 25 | 26 | cat(hText) 27 | printCoefmat(rsq) 28 | invisible(rsq) 29 | } 30 | -------------------------------------------------------------------------------- /R/absToRel.R: -------------------------------------------------------------------------------- 1 | "absToRel" <- function(parmVec, respl, typeCalc) 2 | { 3 | ## Converting absolute to relative 4 | if (typeCalc == "absolute") 5 | { 6 | p <- 100 * ((parmVec[3] - respl) / (parmVec[3] - parmVec[2])) 7 | } else { 8 | p <- respl 9 | } 10 | 11 | p 12 | } -------------------------------------------------------------------------------- /R/backfit.R: -------------------------------------------------------------------------------- 1 | backfit <- function(drcObject) 2 | { 3 | DL <- drcObject$dataList 4 | DLdose <- DL$dose 5 | meansVec <- tapply(DL$origResp, DLdose, mean, na.rm = TRUE) 6 | # arranged according to ascending dose values 7 | # therefore unique doses are sorted below 8 | 9 | backfitValues <- ED(drcObject, meansVec, type = "absolute", 10 | display = FALSE, multcomp = FALSE)[, 1, drop = FALSE] 11 | 12 | # colnames(backfitValues) <- "backfit" 13 | # rownames(backfitValues) <- sort(unique(DLdose)) 14 | # backfitValues 15 | 16 | retMat <- cbind(dose = sort(unique(DLdose)), backfit = backfitValues) 17 | rownames(retMat) <- NULL 18 | return(retMat) 19 | } -------------------------------------------------------------------------------- /R/braincousens.ssf.R: -------------------------------------------------------------------------------- 1 | "braincousens.ssf" <- function(method = c("1", "2", "3", "4"), fixed, useFixed = FALSE) 2 | { 3 | method <- match.arg(method) 4 | 5 | ## Defining helper functions (used below) 6 | ytrans <- function(y, cVal, dVal) {log((dVal - y)/(y - cVal))} 7 | bfct <- function(x, y, cVal, dVal, eVal) {ytrans(y, cVal, dVal) / log(x / eVal)} 8 | efct <- function(x, y, bVal, cVal, dVal) {x * exp(-ytrans(y, cVal, dVal)/bVal)} 9 | 10 | ## Assigning function for finding initial b and e parameter values 11 | findbe <- switch(method, 12 | "1" = findbe1(function(x) {rVec <- log(x); rVec[!x>0] <- NA; rVec}, ytrans), 13 | "2" = findbe2(bfct, efct, "Anke"), 14 | "3" = findbe3(), 15 | "4" = findbe2(bfct, efct, "Normolle")) 16 | 17 | function(dframe) 18 | { 19 | x <- dframe[, 1] 20 | y <- dframe[, 2] 21 | 22 | ## Finding initial values for c and d parameters 23 | cdVal <- findcd(x, y) 24 | if (useFixed) {} # not implemented at the moment 25 | 26 | ## Finding initial values for b and e parameters 27 | beVal <- findbe(x, y, cdVal[1], cdVal[2]) 28 | 29 | ## Finding initial value for f parameter 30 | fVal <- 0 31 | # better choice than 0 may be possible! 32 | # the f parameter, however, is very rarely a magnitude of 10 larger or smaller 33 | 34 | return(c(beVal[1], cdVal, beVal[2], fVal)[is.na(fixed)]) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /R/cedergreen.ssf.R: -------------------------------------------------------------------------------- 1 | "cedergreen.ssf" <- function(method = c("1", "2", "3", "4"), fixed, alpha, useFixed = FALSE) 2 | { 3 | method <- match.arg(method) 4 | 5 | ## Defining helper functions (used below) 6 | ytrans <- function(y, cVal, dVal) {log((dVal - y)/(y - cVal))} 7 | bfct <- function(x, y, cVal, dVal, eVal) {ytrans(y, cVal, dVal) / log(x / eVal)} 8 | efct <- function(x, y, bVal, cVal, dVal) {x * exp(-ytrans(y, cVal, dVal)/bVal)} 9 | 10 | ## Assigning function for finding initial b and e parameter values 11 | findbe <- switch(method, 12 | "1" = findbe1(function(x) {rVec <- log(x); rVec[!x>0] <- NA; rVec}, ytrans), 13 | "2" = findbe2(bfct, efct, "Anke"), 14 | "3" = findbe3(), 15 | "4" = findbe2(bfct, efct, "Normolle")) 16 | 17 | function(dframe) 18 | { 19 | x <- dframe[, 1] 20 | y <- dframe[, 2] 21 | 22 | ## Finding initial values for c and d parameters 23 | cdVal <- findcd(x, y) 24 | if (useFixed) {} # not implemented at the moment 25 | 26 | ## Finding initial values for b and e parameters 27 | beVal <- findbe(x, y, cdVal[1], cdVal[2]) 28 | 29 | ## Finding initial value for f parameter 30 | fVal <- (2*(median(y) - cdVal[1]) - (cdVal[2] - cdVal[1])) * exp(1/(beVal[2]^alpha)) 31 | 32 | return(c(beVal[1], cdVal, beVal[2], fVal)[is.na(fixed)]) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /R/coef.drc.R: -------------------------------------------------------------------------------- 1 | "coef.drc" <- 2 | function(object, ...) 3 | { 4 | if (!is.null(object$"coefficients")) 5 | { 6 | return(object$"coefficients") 7 | } else { 8 | retVec <- object$fit$par 9 | names(retVec) <- object$parNames[[1]] 10 | return(retVec) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /R/commatFct.R: -------------------------------------------------------------------------------- 1 | commatFct <- function(object, compMatch) 2 | { 3 | parmMat <- object$parmMat 4 | 5 | if (!is.null(compMatch)) 6 | { 7 | return(parmMat[, (colnames(parmMat) %in% c(compMatch[1], compMatch[2])), drop = FALSE ]) 8 | } else { 9 | parmMat 10 | } 11 | } -------------------------------------------------------------------------------- /R/comped.R: -------------------------------------------------------------------------------- 1 | "comped" <- function(est, se, log = TRUE, interval = TRUE, operator = c("-", "/"), level = 0.95, df = NULL) 2 | { 3 | operator <- match.arg(operator) 4 | if (identical(operator, "-")) 5 | { 6 | opText <- "difference" 7 | } else { 8 | opText <- "ratio" 9 | } 10 | 11 | vcMat <- diag(se^2) 12 | if (!log) 13 | { 14 | if (identical(operator, "-")) 15 | { 16 | # resList <- compute.delta.method(vcMat, expression(b1-b2), est, c("b1", "b2"), print = FALSE) 17 | 18 | derivVec <- c(1, -1) 19 | estVal <- est[1] - est[2] 20 | } else { 21 | # resList <- compute.delta.method(vcMat, expression(b1/b2), est, c("b1", "b2"), print = FALSE) 22 | 23 | derivVec <- c(1 / est[2], -est[1] / (est[2]^2)) 24 | estVal <- est[1] / est[2] 25 | } 26 | } else { 27 | # resList <- compute.delta.method(vcMat, expression(b1-b2), est, c("b1", "b2"), print = FALSE) 28 | 29 | derivVec <- c(1, -1) 30 | estVal <- est[1] - est[2] 31 | } 32 | resList <- list(estimate = estVal, se = sqrt(as.numeric(derivVec %*% vcMat %*% derivVec))) 33 | colNames <- c("Estimate", "Std. Error") 34 | 35 | edMat <- matrix(c(resList$estimate, resList$se), nrow = 1) 36 | if (interval) 37 | { 38 | colNames <- c(colNames, "Lower", "Upper") 39 | 40 | ## Setting degrees of freedom (by default based on normality) 41 | if (is.null(df)) 42 | { 43 | quanVal <- qnorm(1 - (1 - level)/2) 44 | } else { 45 | quanVal <- qt(1 - (1 - level)/2, df) 46 | } 47 | ciMat <- matrix(c(edMat[1, 1] - quanVal * edMat[1, 2], edMat[1, 1] + quanVal * edMat[1, 2]), nrow = 1) 48 | 49 | if (log && (identical(operator, "/"))) 50 | { 51 | ciMat <- exp(ciMat) 52 | } 53 | edMat <- cbind(edMat, ciMat) 54 | } 55 | colnames(edMat) <- colNames 56 | 57 | cat("\n") 58 | cat("Estimated", opText, "of effective doses\n") 59 | if (interval && log && (identical(operator, "/"))) {cat("(confidence interval on original scale)\n")} 60 | cat("\n") 61 | 62 | printCoefmat(edMat) 63 | invisible(edMat) 64 | } -------------------------------------------------------------------------------- /R/confint.drc.R: -------------------------------------------------------------------------------- 1 | "confint.drc" <- function(object, parm, level = 0.95, pool = TRUE, ...) 2 | #"confint.drc" <- function(object, parm, level = 0.95, type = "t", pool = TRUE, ...) 3 | { 4 | ## Matching parameter names 5 | if (!missing(parm)) 6 | { 7 | matchVec <- object$"parNames"[[2]] %in% parm 8 | if (!any(matchVec)) {stop("The 'parm' argument does not match an actual parameter")} 9 | } else { 10 | matchVec <- rep(TRUE, length(object$"parNames"[[2]])) 11 | } 12 | 13 | ## Constructing matrix of confidence intervals 14 | confint.basic(summary(object, pool = pool)$"coefficients"[matchVec, 1:2, drop = FALSE], 15 | level, object$"type", df.residual(object)) 16 | 17 | # ## Retrieving estimates and estimated standard errors 18 | # estMat <- summary(object, pool = pool)$"coefficients"[matchVec, 1:2, drop = FALSE] 19 | # 20 | # ## Constructing matrix of confidence intervals 21 | # confMat <- matrix(0, dim(estMat)[1], 2) 22 | # 23 | # alphah <- (1 - level)/2 24 | # if (type == "u") {two <- qnorm(1 - alphah)} 25 | # if (type == "t") {two <- qt(1 - alphah, df.residual(object))} 26 | # confMat[, 1] <- estMat[, 1] - two * estMat[, 2] 27 | # confMat[, 2] <- estMat[, 1] + two * estMat[, 2] 28 | # 29 | # ## Formatting matrix 30 | # colnames(confMat) <- c(paste(format(100 * alphah), "%", sep = " "), paste(format(100*(1 - alphah)), "%", sep = " ") ) 31 | # rownames(confMat) <- rownames(estMat) 32 | # 33 | # return(confMat) 34 | } 35 | 36 | ## Defining basic function for providing confidence intervals 37 | "confint.basic" <- function(estMat, level, intType, dfres, formatting = TRUE) 38 | { 39 | alphah <- (1 - level)/2 40 | # if (type == "u") {two <- qnorm(1 - alphah)} 41 | # if (type == "t") {two <- qt(1 - alphah, df.residual(object))} 42 | tailPercentile <- switch(intType, 43 | binomial = qnorm(1 - alphah), 44 | continuous = qt(1 - alphah, dfres), 45 | event = qnorm(1 - alphah), 46 | Poisson = qnorm(1 - alphah)) 47 | 48 | estVec <- estMat[, 1] 49 | halfLength <- tailPercentile * estMat[, 2] 50 | confMat <- matrix(c(estVec - halfLength, estVec + halfLength), ncol = 2) 51 | 52 | ## Formatting matrix 53 | if (formatting) 54 | { 55 | colnames(confMat) <- c(paste(format(100 * alphah), "%", sep = " "), paste(format(100*(1 - alphah)), "%", sep = " ")) 56 | rownames(confMat) <- rownames(estMat) 57 | } 58 | 59 | return(confMat) 60 | } 61 | -------------------------------------------------------------------------------- /R/cooks.distance.drc.R: -------------------------------------------------------------------------------- 1 | cooks.distance.drc <- function(model, ...) 2 | { 3 | hatVal <- hatvalues(model) 4 | 5 | mse <- (rse(model))^2 6 | if (is.na(mse)) {mse <- 1} 7 | # default for generalized linear models (assuming no overdispersion!) 8 | 9 | (residuals(model)^2) * (hatVal/((1-hatVal)^2)) / ((length(hatVal)- df.residual(model)) * mse) 10 | } 11 | -------------------------------------------------------------------------------- /R/drmConvertParm.R: -------------------------------------------------------------------------------- 1 | "drmConvertParm" <- 2 | function(startVec, startMat, factor1, colList) 3 | { 4 | #print(startMat) 5 | startMat2 <- startMat 6 | # print(factor1) 7 | if (length(unique(factor1)) == 1) {return(startVec)} 8 | 9 | mmat <- model.matrix(~factor(factor1) - 1) 10 | # print(dim(mmat)) 11 | 12 | pm <- list() 13 | for (i in 1:length(colList)) 14 | { 15 | clElt <- colList[[i]] 16 | ncclElt <- dim(clElt)[2] 17 | 18 | indVec <- !is.na(startMat2[, i, drop = FALSE]) 19 | indVal <- min(c(sum(indVec), dim(clElt)[2])) 20 | # print(indVec) 21 | # print(indVal) 22 | 23 | indVec2 <- (1:ncclElt)[indVec] 24 | if (length(indVec2) > ncclElt) {indVec2 <- 1:ncclElt} 25 | # print(indVec2) 26 | # pm[[i]] <- (ginv(t(clElt)%*%clElt)%*%t(clElt))[indVec2, ,drop=FALSE]%*%mmat[,indVec]%*%startMat2[indVec, i, drop=FALSE] 27 | # then cabanne works 28 | 29 | 30 | # print( ((ginv(t(clElt)%*%clElt)%*%t(clElt))[, ,drop=FALSE]%*%mmat[,indVec]%*%startMat2[indVec, i, drop=FALSE])[1:length(indVec2)] ) 31 | 32 | pm[[i]] <- (ginv(t(clElt)%*%clElt)%*%t(clElt))[1:indVal, ,drop = FALSE]%*%mmat[,indVec]%*%startMat2[indVec, i, drop = FALSE] 33 | # print( (ginv(t(clElt)%*%clElt)%*%t(clElt))[1:indVal, ,drop = FALSE]%*%mmat[,indVec]%*%startMat2[indVec, i, drop = FALSE] ) 34 | # print(pm[[i]]) 35 | 36 | 37 | # if ((length(posVec[[i]])>0) && !(upperPos==i)) {pm[[i]] <- pm[[i]][-pos]} 38 | } 39 | tempVec <- unlist(pm) 40 | tempVec <- tempVec[!is.na(tempVec)] 41 | # print(tempVec) 42 | 43 | 44 | ## Checking whether the intercept column has been removed 45 | indVec3 <- ( abs(tempVec)<1e-10 ) 46 | if (any(indVec3)) 47 | { 48 | # tempVec[indVec3] <- startVec[indVec3] 49 | tempVec <- startVec 50 | } 51 | 52 | return(tempVec) 53 | } 54 | -------------------------------------------------------------------------------- /R/drmEMPoisson.R: -------------------------------------------------------------------------------- 1 | "drmEMPoisson" <- 2 | function(dose, resp, multCurves, startVec, weightsVec, doseScaling = 1) 3 | { 4 | 5 | ## Finding indices for doses that give contribution to likelihood function 6 | # iv <- ( (multCurves(dose, startVec) > zeroTol) & (multCurves(dose, startVec) < 1-zeroTol) ) 7 | 8 | 9 | ## Defining the objective function 10 | opfct <- function(c) # dose, resp and weights are fixed 11 | { 12 | lambda <- weightsVec * multCurves(dose / doseScaling, c) 13 | return( -sum(-lambda + resp*log(lambda))) 14 | } 15 | 16 | 17 | ## Defining self starter function 18 | ssfct <- NULL 19 | 20 | 21 | ## Defining the log likelihood function 22 | llfct <- function(object) 23 | { 24 | # total <- (object$"data")[iv, 5] 25 | # success <- total*(object$"data")[iv, 2] 26 | # c( sum(log(choose(total, success))) - object$"fit"$"ofvalue", object$"sumList"$"df.residual" ) 27 | 28 | c( 29 | -object$"fit"$value + sum(log(gamma(resp+1))), 30 | object$"sumList"$"df.residual" 31 | ) # adding scale constant 32 | } 33 | 34 | 35 | ## Defining functions returning the residual variance, the variance-covariance and the fixed effects estimates 36 | rvfct <- NULL 37 | 38 | vcovfct <- function(object) 39 | { 40 | solve(object$fit$hessian) 41 | } 42 | 43 | parmfct <- function(fit, fixed = TRUE) 44 | { 45 | fit$par 46 | } 47 | 48 | 49 | ## Returning list of functions 50 | return(list(llfct = llfct, opfct = opfct, ssfct = ssfct, rvfct = rvfct, vcovfct = vcovfct, 51 | parmfct = parmfct)) 52 | } 53 | 54 | 55 | "drmLOFPoisson" <- function() 56 | { 57 | return(list(anovaTest = NULL, gofTest = NULL)) 58 | } 59 | -------------------------------------------------------------------------------- /R/drmEMbinomial.R: -------------------------------------------------------------------------------- 1 | "drmEMbinomial" <- 2 | function(dose, resp, multCurves, startVec, robustFct, weights, rmNA, zeroTol = 1e-12, 3 | doseScaling = 1, respScaling = 1) 4 | { 5 | ## Finding indices for doses that give contribution to likelihood function 6 | iv <- ( (multCurves(dose/doseScaling, startVec) > zeroTol) & (multCurves(dose/doseScaling, startVec) < 1-zeroTol) ) 7 | 8 | ## Defining the objective function 9 | opfct <- function(c) # dose, resp and weights are fixed 10 | { 11 | # prob <- (multCurves(dose / doseScaling, c))[iv] 12 | # prob <- multCurves(dose, c) 13 | 14 | # prob0 <- (multCurves(dose / doseScaling, c)) 15 | # iv <- (prob0 > zeroTol) & (prob0 < (1 - zeroTol)) 16 | # prob <- prob0[iv] 17 | 18 | # print(log(prob/(1-prob[]))) 19 | # print(-sum((resp*weights)[iv]*log(prob/(1-prob))+weights[iv]*log(1-prob))) 20 | # return( -sum((resp2*weights2)*log(prob/(1-prob))+weights2*log(1-prob)) ) 21 | 22 | prob <- multCurves(dose / doseScaling, c) 23 | omZT <- 1 - zeroTol 24 | prob[prob > omZT] <- omZT 25 | prob[prob < zeroTol] <- zeroTol 26 | -sum((resp * weights) * log(prob / (1 - prob)) + (weights * log(1 - prob))) 27 | 28 | # -sum((resp * weights) * log(prob) + ((weights - resp * weights) * log(1 - prob))) 29 | } 30 | 31 | ## Defining self starter function 32 | ssfct <- NULL 33 | 34 | ## Defining the log likelihood function 35 | llfct <- function(object) 36 | { 37 | # total <- (object$"data")[iv, 5] 38 | # success <- total*(object$"data")[iv, 2] 39 | total <- (object$"data")[, 5] 40 | success <- total*(object$"data")[, 2] 41 | 42 | 43 | c(sum(log(choose(total, success))) - object$"fit"$"ovalue", # object$"fit"$"ofvalue", 44 | object$"sumList"$"lenData" - df.residual(object)) # object$"sumList"$"df.residual") 45 | } 46 | 47 | ## Defining functions returning the residual variance, the variance-covariance and the fixed effects estimates 48 | rvfct <- NULL 49 | 50 | vcovfct <- function(object) 51 | { 52 | solve(object$fit$hessian) 53 | } 54 | 55 | parmfct <- function(fit, fixed = TRUE) 56 | { 57 | fit$par 58 | } 59 | 60 | # 61 | # ## Modifying ANOVA test (removing dose=0 and dose=Inf) 62 | # anovaTest2 <- function(formula, ds) {anovaTest(formula, ds[iv, ])} 63 | 64 | 65 | ## Returning list of functions 66 | return(list(llfct = llfct, opfct = opfct, ssfct = ssfct, rvfct = rvfct, 67 | vcovfct = vcovfct, parmfct = parmfct)) # , anovaTest2=anovaTest2)) 68 | } 69 | 70 | 71 | -------------------------------------------------------------------------------- /R/drmEMeventtime.r: -------------------------------------------------------------------------------- 1 | "drmEMeventtime" <- 2 | function(dose, resp, multCurves, doseScaling = 1) 3 | { 4 | ## Defining the objective function 5 | opfct <- function(c) # dose, resp and weights are fixed 6 | { 7 | Fstart <- multCurves(dose[, 1] / doseScaling, c) 8 | dose2 <- dose[, 2] 9 | # IsFinite <- is.finite(dose2) 10 | # Fend <- rep(1, length(dose2)) 11 | # Fend <- multCurves(dose[, 2] / doseScaling, c) 12 | Fend <- multCurves(dose2 / doseScaling, c) 13 | Fend[!is.finite(dose2)] <- 1 14 | return( -sum(resp * log(Fend - Fstart)) ) 15 | # minus in front of sum() as maximization is done as minimization 16 | } 17 | 18 | 19 | ## Defining self starter function 20 | ssfct <- NULL 21 | 22 | 23 | ## Defining the log likelihood function 24 | llfct <- function(object) 25 | { 26 | # total <- (object$"data")[iv, 5] 27 | # success <- total*(object$"data")[iv, 2] 28 | # c( sum(log(choose(total, success))) - object$"fit"$"ofvalue", object$"sumList"$"df.residual" ) 29 | 30 | c( 31 | -object$"fit"$value, # oops a constant is missing! 32 | object$"sumList"$"df.residual" 33 | ) 34 | } 35 | 36 | 37 | ## Defining functions returning the residual variance, the variance-covariance and the fixed effects estimates 38 | rvfct <- NULL 39 | 40 | vcovfct <- function(object) 41 | { 42 | solve(object$fit$hessian) 43 | } 44 | 45 | parmfct <- function(fit, fixed = TRUE) 46 | { 47 | fit$par 48 | } 49 | 50 | 51 | ## Returning list of functions 52 | return(list(llfct = llfct, opfct = opfct, ssfct = ssfct, rvfct = rvfct, vcovfct = vcovfct, 53 | parmfct = parmfct)) 54 | } 55 | 56 | 57 | "drmLOFeventtime" <- function() 58 | { 59 | return(list(anovaTest = NULL, gofTest = NULL)) 60 | } 61 | -------------------------------------------------------------------------------- /R/drmLOFbinomial.R: -------------------------------------------------------------------------------- 1 | "drmLOFbinomial" <- function() 2 | { 3 | ## Defining a goodness-of-fit test 4 | gofTest <- function(resp, weights, fitted, dfres) 5 | { 6 | ## Removing 0s and 1s in fitted values 7 | zeroTol <- 1e-12 # no global constant 8 | indVec <- ( (fitted < zeroTol) | (fitted > 1-zeroTol) ) 9 | dfReduc <- sum(indVec) 10 | 11 | total <- weights # (object$"data")[, 5] 12 | success <- resp*weights # total*(object$"data")[, 2] 13 | expected <- total*fitted # fitted(object) 14 | 15 | ## Pearson's statistic (sum of squared Pearson residuals) 16 | c( sum( ((success - expected)^2 / (expected*(1 - fitted)))[!indVec] ), dfres - dfReduc) # df.residual(object)) 17 | } 18 | 19 | 20 | ## Defining goodness-of-fit function 21 | anovaTest <- function(formula, ds) 22 | { 23 | # count <- resp*weights 24 | anovaFit <- glm(formula, family=binomial(link = "logit"), data=ds) 25 | if (df.residual(anovaFit)>0) 26 | { 27 | return(list(test = "lr", anovaFit = anovaFit)) 28 | } else { 29 | return(NULL) 30 | } 31 | } 32 | anovaTest <- NULL # lack-of-fit test not meaningful in most situations 33 | 34 | return(list(anovaTest = anovaTest, gofTest = gofTest)) 35 | } 36 | -------------------------------------------------------------------------------- /R/drmLOFls.R: -------------------------------------------------------------------------------- 1 | "drmLOFls" <- function() 2 | { 3 | ## Defining lack-of-fit/goodness-of-fit tests 4 | anovaTest <- function(formula, ds) 5 | { 6 | anovaFit <- lm(formula, data = ds) 7 | if (df.residual(anovaFit) > 0) 8 | { 9 | return(list(test = "F", anovaFit = anovaFit)) 10 | } else { 11 | return(NULL) 12 | } 13 | } 14 | 15 | gofTest <- NULL 16 | 17 | return(list(anovaTest = anovaTest, gofTest = gofTest)) 18 | } -------------------------------------------------------------------------------- /R/drmPNsplit.R: -------------------------------------------------------------------------------- 1 | "drmPNsplit" <- 2 | function(parmVec, sep) 3 | { 4 | lenPV <- length(parmVec) 5 | parmVecA <- rep(0, lenPV) 6 | parmVecB <- rep(0, lenPV) 7 | 8 | splitList <- strsplit(parmVec, sep, fixed = TRUE) 9 | for (i in 1:lenPV) 10 | { 11 | parmVecA[i] <- splitList[[i]][1] 12 | 13 | lenSL <- length(splitList[[i]]) 14 | parmVecB[i] <- paste(splitList[[i]][2:lenSL], collapse = "") # 'paste' is needed in case several ":" occur 15 | } 16 | return(list(parmVec, parmVecA, parmVecB)) 17 | } 18 | -------------------------------------------------------------------------------- /R/drmParNames.R: -------------------------------------------------------------------------------- 1 | "drmParNames" <- 2 | function(numNames, parNames, collapseList2, repStr1 = "factor(pmodels[, i])", repStr2 = "factor(assayNo)") 3 | { 4 | ## Retrieving names for parameters 5 | parmVecList <- list() 6 | for (i in 1:numNames) 7 | { 8 | colNames1 <- colnames(collapseList2[[i]]) 9 | if (is.null(colNames1)) 10 | { 11 | parmVecList[[i]] <- paste(parNames[i], "(Intercept)", sep = ":") 12 | } else { 13 | parmVecList[[i]] <- paste(parNames[i], colNames1, sep = ":") 14 | } 15 | parmVecList[[i]] <- (parmVecList[[i]])[1:ncol(collapseList2[[i]])] # min(maxParm[i], length(colNames1))] 16 | } 17 | parmVec <- unlist(parmVecList) 18 | 19 | parmVec2 <- parmVec 20 | # print(parmVec2) 21 | for (i in 1:length(parmVec)) 22 | { 23 | pos <- regexpr(repStr1, parmVec[i], fixed = TRUE) 24 | if (pos > 0) 25 | { 26 | parmVec2[i] <- paste(substring(parmVec[i], 1, pos-1), substring(parmVec[i], pos + 20), sep = "") 27 | } 28 | 29 | pos <- regexpr(repStr2, parmVec[i], fixed = TRUE) 30 | if (pos > 0) 31 | { 32 | parmVec2[i] <- paste(substring(parmVec[i], 1, pos-1), substring(parmVec[i], pos + 15), sep = "") 33 | } 34 | } 35 | 36 | # print(parmVec2) 37 | return(drmPNsplit(parmVec2, ":")) 38 | } 39 | -------------------------------------------------------------------------------- /R/drmc.R: -------------------------------------------------------------------------------- 1 | "drmc" <- function(constr = FALSE, errorm = TRUE, maxIt = 500, method = "BFGS", 2 | noMessage = FALSE, relTol = 1e-7, rmNA = FALSE, useD = FALSE, trace = FALSE, 3 | otrace = FALSE, warnVal = -1, dscaleThres = 1e-15, rscaleThres = 1e-15) 4 | { 5 | return(list( 6 | constr = constr, 7 | errorm = errorm, 8 | maxIt = maxIt, 9 | method = method, 10 | noMessage = noMessage, 11 | relTol = relTol, 12 | rmNA = rmNA, 13 | useD = useD, 14 | trace = trace, 15 | otrace = otrace, 16 | warnVal = warnVal, 17 | dscaleThres = dscaleThres, 18 | rscaleThres = rscaleThres 19 | )) 20 | } 21 | -------------------------------------------------------------------------------- /R/findcd.R: -------------------------------------------------------------------------------- 1 | "findcd" <- function(x, y, scaleInc = 0.001) 2 | { 3 | yRange <- range(y) 4 | lenyRange <- scaleInc * diff(yRange) 5 | # cVal <- yRange[1] - lenyRange # the c parameter 6 | # dVal <- yRange[2] + lenyRange # the d parameter 7 | 8 | c(yRange[1] - lenyRange, yRange[2] + lenyRange) 9 | } -------------------------------------------------------------------------------- /R/fitted.drc.R: -------------------------------------------------------------------------------- 1 | "fitted.drc" <- 2 | function(object, ...) 3 | { 4 | # if (missing(...)) 5 | # { 6 | # return(object$"predres"[, 1]) 7 | # } else { 8 | # predict(object, ...) 9 | # } 10 | predict(object, ...) 11 | ## return(object$"predres"[, 1]) 12 | } 13 | -------------------------------------------------------------------------------- /R/gaussian.ssf.R: -------------------------------------------------------------------------------- 1 | "gaussian.ssf" <- function(method = c("1", "2", "3", "4"), fixed, logg = FALSE, useFixed = FALSE) 2 | { 3 | method <- match.arg(method) 4 | 5 | function(dframe) 6 | { 7 | x <- dframe[, 1] 8 | y <- dframe[, 2] 9 | 10 | ## Finding initial values for c and d parameters 11 | cdVal <- findcd(x, y) 12 | if (useFixed) {} # not implemented at the moment 13 | 14 | ## Finding initial values for b, e, and f parameters 15 | if (logg) 16 | { 17 | bVal <- 0.75 * sd(log(x[y > quantile(y, .75)])) 18 | } else { 19 | bVal <- 0.75 * sd(x[y > quantile(y, .75)]) 20 | } 21 | befVal <- c(bVal, x[which.max(y)], 1) 22 | # befVal <- c(sd(x), mean(x), 1) 23 | 24 | return(c(befVal[1], cdVal, befVal[2:3])[is.na(fixed)]) 25 | } 26 | } -------------------------------------------------------------------------------- /R/genRetFct.R: -------------------------------------------------------------------------------- 1 | "genRetFct" <- function(fct, parmVec, notFixed) 2 | { 3 | # ## Defining the model function adjusted for scaling 4 | # retFct <- function(doseScaling, respScaling, lenData) 5 | # { 6 | # parmMat <- matrix(parmVec / c(1, respScaling, respScaling, doseScaling, 1), lenData, numParm, byrow = TRUE) 7 | # 8 | # fct <- function(dose, parm) 9 | # { 10 | # parmMat[, notFixed] <- parm 11 | # cParm <- parmMat[, 2] 12 | # cParm + (parmMat[, 3] - cParm)/((1+exp(parmMat[, 1]*(log(dose/parmMat[, 4]))))^parmMat[, 5]) 13 | # } 14 | # fct 15 | # } 16 | # retFct 17 | } -------------------------------------------------------------------------------- /R/getInitial.R: -------------------------------------------------------------------------------- 1 | "getInitial" <- function(object) 2 | { 3 | initval <- object$"start" 4 | names(initval) <- object$"parNames"[[2]] 5 | 6 | initval 7 | } -------------------------------------------------------------------------------- /R/gompertz.ssf.R: -------------------------------------------------------------------------------- 1 | "gompertz.ssf" <- function(method = c("1", "2", "3", "4"), fixed, useFixed = FALSE) 2 | { 3 | method <- match.arg(method) 4 | 5 | ## Defining helper functions (used below) 6 | ytrans <- function(y, cVal, dVal) {log(-log((dVal - y)/(dVal - cVal)))} 7 | bfct <- function(x, y, cVal, dVal, eVal) {ytrans(y, cVal, dVal) / (x - eVal)} 8 | efct <- function(x, y, bVal, cVal, dVal) {x - ytrans(y, cVal, dVal) / bVal} 9 | 10 | ## Assigning function for finding initial b and e parameter values 11 | findbe <- switch(method, 12 | "1" = findbe1(function(x){x}, ytrans, back = I), 13 | "2" = findbe2(bfct, efct, "Anke"), 14 | "3" = findbe3(), 15 | "4" = findbe2(bfct, efct, "Normolle")) 16 | 17 | function(dframe) 18 | { 19 | x <- dframe[, 1] 20 | y <- dframe[, 2] 21 | 22 | ## Finding initial values for the c and d parameters 23 | cdVal <- findcd(x, y) 24 | if (useFixed) {} # not implemented at the moment 25 | 26 | ## Finding initial values for the b and e parameters 27 | beVal <- findbe(x, y, cdVal[1], cdVal[2]) 28 | 29 | return(c( (-1) * beVal[1], cdVal * c(0.8, 1.2), beVal[2])[is.na(fixed)]) 30 | } 31 | } -------------------------------------------------------------------------------- /R/gompertzd.R: -------------------------------------------------------------------------------- 1 | "gompertzd" <- function( 2 | fixed = c(NA, NA), names = c("a", "b")) 3 | { 4 | ## Checking arguments 5 | numParm <- 2 6 | if (!is.character(names) | !(length(names) == numParm)) {stop("Not correct 'names' argument")} 7 | if ( !(length(fixed) == numParm) ) {stop("Not correct 'fixed' argument")} 8 | 9 | ## Handling 'fixed' argument 10 | notFixed <- is.na(fixed) 11 | parmVec <- rep(0, numParm) 12 | parmVec[!notFixed] <- fixed[!notFixed] 13 | 14 | ## Defining the non-linear function 15 | fct <- function(dose, parm) 16 | { 17 | parmMat <- matrix(parmVec, nrow(parm), numParm, byrow=TRUE) 18 | parmMat[, notFixed] <- parm 19 | 20 | innerT1 <- parmMat[, 2]*dose 21 | innerT2 <- parmMat[, 1]/parmMat[, 2]*(exp(innerT1) - 1) 22 | parmMat[, 1]*exp(innerT1 - innerT2) 23 | } 24 | 25 | ## Defining the self starter function 26 | ssfct <- function(dframe) 27 | { 28 | x <- dframe[, 1] 29 | y <- dframe[, 2] 30 | 31 | aVal <- max(y) 32 | bVal <- 1 33 | 34 | return(c(aVal, bVal)) 35 | } 36 | 37 | ## Defining names 38 | names <- names[notFixed] 39 | 40 | ##Defining the first derivatives (in the parameters) 41 | deriv1 <- function(dose, parm) 42 | { 43 | parmMat <- matrix(parmVec, nrow(parm), numParm, byrow = TRUE) 44 | parmMat[, notFixed] <- parm 45 | 46 | help1 <- fct(dose, parm) 47 | help2 <- exp(parmMat[, 2]*dose) 48 | help3 <- help2 - 1 49 | help4 <- parmMat[, 1]/parmMat[, 2] 50 | 51 | deriva <- help1*(1/parmMat[, 1] - help3/parmMat[, 2]) 52 | derivb <- help1*(dose + help4*help3/parmMat[, 2] + help4*help2*dose) 53 | 54 | cbind(deriva, derivb)[, notFixed] 55 | } 56 | 57 | deriv2 <- NULL 58 | 59 | ##Defining the first derivative (in the dose) 60 | derivx <- function(x, parm) 61 | { 62 | parmMat <- matrix(parmVec, nrow(parm), numParm, byrow = TRUE) 63 | parmMat[, notFixed] <- parm 64 | 65 | fct(x, parm)*(parmMat[, 2] - parmMat[, 1]*exp(parmMat[, 2]*x)) 66 | } 67 | 68 | ## Defining the ED function 69 | edfct <- NULL 70 | 71 | ## Returning the function with self starter and names 72 | returnList <- 73 | list(fct = fct, ssfct = ssfct, names = names, deriv1 = deriv1, deriv2 = deriv2, derivx = derivx, edfct = edfct, 74 | name = "gompertzd", 75 | text = "Gompertz derivative", 76 | noParm = sum(is.na(fixed))) 77 | 78 | class(returnList) <- "gompertzd" 79 | invisible(returnList) 80 | } 81 | -------------------------------------------------------------------------------- /R/hatvalues.drc.R: -------------------------------------------------------------------------------- 1 | hatvalues.drc <- function(model, ...) 2 | { 3 | xmat <- model$der 4 | diag(xmat %*% ginv(t(xmat) %*% xmat) %*% t(xmat)) 5 | # names(hvector) <- as.character(1:length(hvector)) 6 | # hvector 7 | } 8 | 9 | -------------------------------------------------------------------------------- /R/iband.R: -------------------------------------------------------------------------------- 1 | "iband" <- function(object) 2 | { 3 | 4 | if (FALSE) 5 | { 6 | 7 | ## Defining a vector of a fine grid of concentrations 8 | concVec<- with(ryegrass, seq(min(conc), max(conc), length.out=150)) 9 | 10 | ## Calculating predicted values including confidence intervals 11 | predictMatrix<-predict(ryegrass.m1, newdata = data.frame(conc = concVec), 12 | interval="confidence") 13 | 14 | ## Adding confidence limits to the plot 15 | plot(ryegrass.m1, broken = TRUE) 16 | lines(concVec, predictMatrix[, 2], lty = 2) 17 | lines(concVec, predictMatrix[, 3], lty = 2) 18 | } 19 | } -------------------------------------------------------------------------------- /R/lnormal.ssf.R: -------------------------------------------------------------------------------- 1 | "lnormal.ssf" <- function(method = c("1", "2", "3", "4"), fixed, loge, useFixed = FALSE) 2 | { 3 | method <- match.arg(method) 4 | 5 | ## Defining helper functions (used below) 6 | ytrans <- function(y, cVal, dVal) {qnorm((y-cVal)/(dVal-cVal))} 7 | bfct <- function(x, y, cVal, dVal, eVal) {ytrans(y, cVal, dVal)/log(x/eVal)} 8 | efct <- function(x, y, bVal, cVal, dVal) {x * exp(-ytrans(y, cVal, dVal)/bVal)} 9 | 10 | ## Assigning function for finding initial b and e parameter values 11 | findbe <- switch(method, 12 | "1" = findbe1(function(x) {rVec <- log(x); rVec[!x>0] <- NA; rVec}, 13 | function(y, cVal, dVal) {qnorm((dVal - y) / (1.01 * max(dVal - y)))}, -1), 14 | "2" = findbe2(bfct, efct, "Anke", -1), 15 | "3" = findbe3(-1), 16 | "4" = findbe2(bfct, efct, "Normolle", -1)) 17 | 18 | function(dframe) 19 | { 20 | x <- dframe[, 1] 21 | y <- dframe[, 2] 22 | 23 | ## Finding initial values for c and d parameters 24 | cdVal <- findcd(x, y) 25 | if (useFixed) {} # not implemented at the moment 26 | 27 | ## Finding initial values for b and e parameters 28 | beVal <- findbe(x, y, cdVal[1], cdVal[2]) 29 | if (loge) {beVal[2] <- log(beVal[2])} 30 | 31 | return(c(beVal[1], cdVal, beVal[2])[is.na(fixed)]) 32 | } 33 | } -------------------------------------------------------------------------------- /R/logLik.drc.R: -------------------------------------------------------------------------------- 1 | "logLik.drc" <- function(object, ...) 2 | { 3 | ## Retrieving the value of the log likelihood function evaluated at the parameter estimates 4 | 5 | if (inherits(object, "bindrc")) 6 | { 7 | llVal <- object$loglik[3] 8 | attr(llVal, "df") <- object$loglik[5] - object$loglik[4] 9 | attr(llVal, "nobs") <- nrow(object$data) # <-- extension provided by Tobias Verbeke 10 | } else { 11 | 12 | # llVal <- summary(object)[[4]][1] 13 | 14 | # if (object$"type"=="continuous") 15 | # { 16 | loglik <- (object$estMethod$llfct)(object) 17 | 18 | llVal <- loglik[1] 19 | attr(llVal, "df") <- loglik[2] 20 | attr(llVal, "nobs") <- nrow(object$data) # <-- extension provided by Tobias Verbeke 21 | # } 22 | 23 | # if (object$"type"=="binomial") 24 | # { 25 | # degfre <- object$summary[6] 26 | # 27 | # total <- (object$"data")[,5] 28 | # success <- total*(object$"data")[,2] 29 | # llVal <- sum(log(choose(total, success))) - object$fit$ofvalue 30 | 31 | # attr(llVal, "df") <- object[[4]][7] - object[[4]][6] 32 | # } 33 | 34 | 35 | # numVarPar <- 1 # + 1 to add variance parameter 36 | # if (object$"type"=="binomial") {numVarPar <- 0} 37 | # attr(llVal, "df") <- object[[4]][7] - object[[4]][6] + numVarPar 38 | # attr(llVal, "df") <- object[[4]][6] 39 | } 40 | 41 | class(llVal) <- "logLik" 42 | return(llVal) 43 | } 44 | 45 | -------------------------------------------------------------------------------- /R/logistic.ssf.R: -------------------------------------------------------------------------------- 1 | "logistic.ssf" <- function(method = c("1", "2", "3", "4"), fixed, useFixed = FALSE) 2 | { 3 | method <- match.arg(method) 4 | 5 | ## Defining helper functions (used below) 6 | ytrans <- function(y, cVal, dVal) {log((dVal - y)/(y - cVal))} 7 | bfct <- function(x, y, cVal, dVal, eVal) {ytrans(y, cVal, dVal) / (x - eVal)} 8 | efct <- function(x, y, bVal, cVal, dVal) {x - ytrans(y, cVal, dVal) / bVal} 9 | 10 | ## Assigning function for finding initial b and e parameter values 11 | findbe <- switch(method, 12 | "1" = findbe1(function(x){x}, ytrans, back = I), 13 | "2" = findbe2(bfct, efct, "Anke"), 14 | "3" = findbe3(), 15 | "4" = findbe2(bfct, efct, "Normolle")) 16 | 17 | function(dframe) 18 | { 19 | x <- dframe[, 1] 20 | y <- dframe[, 2] 21 | 22 | ## Finding initial values for c and d parameters 23 | cdVal <- findcd(x, y) 24 | # if (useFixed) {} # not implemented at the moment 25 | 26 | ## Finding initial values for b and e parameters 27 | beVal <- findbe(x, y, cdVal[1], cdVal[2]) 28 | 29 | ## Finding initial value for f parameter 30 | fVal <- 1 # better choice than 1 may be possible! 31 | 32 | return(c(beVal[1], cdVal, beVal[2], fVal)[is.na(fixed)]) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /R/modelFunction.R: -------------------------------------------------------------------------------- 1 | modelFunction <- function(dose, parm2mat, drcFct, cm, assayNoOld, upperPos, retFct, 2 | doseScaling, respScaling, isFinite, pshifts = NULL) 3 | { 4 | if (!is.null(retFct)) 5 | { 6 | drcFct <- retFct(doseScaling, respScaling) 7 | } 8 | drcFct1 <- function(dose, parm) 9 | { 10 | parmVal <- parm2mat(parm) 11 | # print(c(dim(pshifts), dim(parmVal))) 12 | if ((!is.null(pshifts)) & all(dim(pshifts) == dim(parmVal))) 13 | { 14 | parmVal <- parmVal + pshifts 15 | } 16 | # drcFct(dose, (parm2mat(parm))[isFinite, , drop = FALSE]) 17 | drcFct(dose, parmVal[isFinite, , drop = FALSE]) 18 | } 19 | 20 | if (is.null(cm)) 21 | { 22 | multCurves <- function(dose, parm) 23 | { 24 | drcFct1(dose, parm) 25 | } 26 | } else { # not adapting to scaling (not using drcFct1)!!! 27 | iv <- isFinite & (assayNoOld == cm) 28 | niv <- !iv 29 | fctEval <- rep(0, length(dose)) 30 | 31 | multCurves <- function(dose, parm) 32 | { 33 | parmVal <- (parm2mat(parm))[isFinite, , drop = FALSE] 34 | # print(c(dim(pweights), dim(parmVal))) 35 | if ((!is.null(pshifts)) & all(dim(pshifts) == dim(parmVal))) 36 | { 37 | parmVal <- parmVal + pshifts 38 | } 39 | fctEval[iv] <- parmVal[iv, upperPos, drop = FALSE] 40 | fctEval[niv] <- drcFct(dose[niv], parmVal[niv, , drop = FALSE]) 41 | 42 | fctEval 43 | } 44 | } 45 | 46 | multCurves 47 | } 48 | 49 | -------------------------------------------------------------------------------- /R/noEffect.R: -------------------------------------------------------------------------------- 1 | noEffect <- function(object) 2 | { 3 | if (identical(object$"type", "binomial")) 4 | { 5 | respVec <- object$"dataList"$resp 6 | weiVec <- object$"dataList"$weights 7 | llNull <- logLik(glm(cbind(respVec*weiVec, (1-respVec)*weiVec) ~ 1, family = binomial)) 8 | } 9 | 10 | if (identical(object$"type", "Poisson")) 11 | { 12 | llNull <- logLik(glm(resp ~ 1, family = poisson)) 13 | } 14 | 15 | if (identical(object$"type", "continuous")) 16 | { 17 | llNull <- logLik(lm(object$dataList$resp ~ 1)) 18 | } 19 | lldrc <- logLik(object) 20 | lrt <- -2*(llNull - lldrc) 21 | dfDiff <- attr(lldrc, "df") - attr(llNull, "df") 22 | 23 | retVec <- c(lrt, dfDiff, 1 - pchisq(lrt, dfDiff)) 24 | names(retVec) <- c("Chi-square test", "Df", "p-value") 25 | retVec 26 | } -------------------------------------------------------------------------------- /R/onAttach.R: -------------------------------------------------------------------------------- 1 | .onAttach <- function(libname, pkgname) 2 | { 3 | packageStartupMessage("\n'drc' has been loaded.\n") 4 | packageStartupMessage("Please cite R and 'drc' if used for a publication,") 5 | packageStartupMessage("for references type 'citation()' and 'citation('drc')'.\n") 6 | 7 | # cat("\n") 8 | # cat("'drc' has been loaded.\n\n") 9 | # cat("for references type 'citation()' and 'citation('drc')'.\n\n") 10 | } 11 | -------------------------------------------------------------------------------- /R/pickParm.R: -------------------------------------------------------------------------------- 1 | ## Helper functions for mean functions 2 | "pickParm" <- function(parmVec, indexVec, parmNo) 3 | { 4 | function(parm) 5 | { 6 | parmVec[indexVec] <- parm 7 | parmVec[parmNo] 8 | } 9 | } 10 | 11 | "monoParm" <- function(parmVec, indexVec, parmNo, signVal) 12 | { 13 | function(parm) 14 | { 15 | parmVec[indexVec] <- parm 16 | signVal * parmVec[parmNo] 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /R/print.drc.R: -------------------------------------------------------------------------------- 1 | "print.drc" <- function(x, ..., digits = max(3, getOption("digits") - 3)) 2 | { 3 | object <- x 4 | 5 | classList <- class(object) 6 | cat(paste("\n", "A 'drc' model.", "\n", sep="")) 7 | 8 | ## Borrowing from print.lm 9 | cat("\nCall:\n", deparse(object$"call"), "\n\n", sep = "") 10 | if (length(coef(object))>0) 11 | { 12 | cat("Coefficients:\n") 13 | print.default(format(coef(object), digits = digits), print.gap = 2, quote = FALSE) 14 | } else { 15 | cat("No coefficients\n") 16 | } 17 | cat("\n") 18 | 19 | invisible(object) 20 | } 21 | -------------------------------------------------------------------------------- /R/rdrm.R: -------------------------------------------------------------------------------- 1 | "rdrm" <- function(nosim, fct, mpar, xerror, xpar = 1, yerror = "rnorm", ypar = c(0, 1), 2 | onlyY = FALSE) 3 | { 4 | ## Constructing the predictor values 5 | if (is.numeric(xerror)) 6 | { 7 | x <- xerror 8 | } else { 9 | evalStr1 <- paste(xerror, "(", paste(xpar, sep = ",", collapse = ","), ")") 10 | x <- eval(parse(text = evalStr1)) 11 | } 12 | lenx <- length(x) 13 | x <- sort(x) 14 | x <- rep(x, nosim) 15 | xMat <- matrix(x, nosim, lenx, byrow = TRUE) 16 | 17 | ## Constructing the mean dose-response 18 | meanVec <- fct$fct(x, matrix(mpar, lenx*nosim, length(mpar), byrow = TRUE)) 19 | 20 | ## Constructing the simulated response values 21 | if (yerror == "rbinom") 22 | { 23 | if (length(ypar) == 1) 24 | { 25 | ypar <- rep(ypar, lenx*nosim) 26 | wMat <- matrix(ypar, nosim, lenx, byrow = TRUE) 27 | } else { 28 | wMat <- matrix(ypar, nosim, lenx, byrow = TRUE) 29 | } 30 | evalStr2 <- paste(deparse(substitute(yerror)), "(", lenx*nosim, ", ypar, meanVec)") 31 | errorVec <- eval(parse(text = evalStr2)) 32 | 33 | yMat <- matrix(errorVec, nosim, lenx, byrow = TRUE) 34 | 35 | ## Returning the simulated curves 36 | if (onlyY) 37 | { 38 | return(list(y = yMat)) 39 | } else { 40 | return(list(x = xMat, w = wMat, y = yMat)) 41 | } 42 | } else { 43 | evalStr2 <- paste(yerror, "(", lenx*nosim, ",", 44 | paste(ypar, sep = ",", collapse = ","), ")") 45 | errorVec <- eval(parse(text = evalStr2)) 46 | 47 | yMat <- matrix(meanVec, nosim, lenx, byrow = TRUE) + errorVec 48 | 49 | ## Returning the simulated curves 50 | if (onlyY) 51 | { 52 | return(list(y = yMat)) 53 | } else { 54 | return(list(x = xMat, y = yMat)) 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /R/repChar.R: -------------------------------------------------------------------------------- 1 | "repChar" <- function(str, names, fixed, keep) # used in 'mixdrc' 2 | { 3 | if (is.null(fixed)) {fixed <- rep(NA, length(names))} 4 | 5 | "replaceChar" <- function(str, names, fixed, keep, sep=c(",", ";")) 6 | { 7 | lenK <- length(keep) 8 | lenN <- length(names) 9 | strVal <- str 10 | 11 | cutFrom <- rep(0, lenK) 12 | cutTo <- rep(0, lenK) 13 | keep2 <- rep("", lenK) 14 | for (i in 1:lenK) 15 | { 16 | 17 | cutFrom[i] <- regexpr(keep[i], strVal) # matchVec[i] 18 | cutTo[i] <- cutFrom[i] + attr(regexpr(keep[i], strVal), "match.length") - 1 19 | 20 | keep2[i] <- paste(rep(sep[i], nchar(keep[i])), collapse="") 21 | substr(strVal, cutFrom[i], cutTo[i]) <- keep2[i] 22 | } 23 | #print(strVal) 24 | 25 | for (i in 1:lenN) 26 | { 27 | if (!is.na(fixed[i])) 28 | { 29 | strVal <- gsub(names[i], as.character(fixed[i]), strVal) 30 | } 31 | } 32 | 33 | for (i in 1:lenK) 34 | { 35 | cutFrom[i] <- regexpr(keep2[i], strVal) # matchVec[i] 36 | cutTo[i] <- cutFrom[i] + attr(regexpr(keep2[i], strVal), "match.length") - 1 37 | substr(strVal, cutFrom[i], cutTo[i]) <- keep[i] 38 | } 39 | return(strVal) 40 | } 41 | 42 | 43 | 44 | "buildFct" <- function(bodyStr, names, fixed) 45 | { 46 | argNames <- paste(names[is.na(fixed)], collapse=",") 47 | headerStr <- paste("function(DOSE," , argNames, "){(") 48 | 49 | fctStr <- paste(headerStr, bodyStr, "^lambda - 1)/lambda}") 50 | 51 | 52 | formStr <- paste("formula(respVar ~ opfct(doseVar,", argNames, "))") 53 | 54 | # print(fctStr) 55 | return(list(fctStr, formStr)) 56 | # return(eval(parse(text=fctStr))) 57 | } 58 | 59 | bodyS <- replaceChar(str, names, fixed, keep) 60 | return(buildFct(bodyS, names, fixed)) 61 | } 62 | -------------------------------------------------------------------------------- /R/resPrint.R: -------------------------------------------------------------------------------- 1 | "resPrint" <- function(resMat, headerText, interval, intervalLabel, display) 2 | { 3 | # Note: arguments "interval", "intervalLabel" no longer used 4 | if (display) 5 | { 6 | cat("\n") 7 | cat(paste(headerText, "\n", sep = "")) 8 | # if (!identical(interval, "none")) 9 | # { 10 | # intervalText <- paste("(", intervalLabel, "-based confidence interval(s))\n", sep = "") 11 | # cat(intervalText) 12 | # } 13 | cat("\n") 14 | printCoefmat(resMat, cs.ind = 1:ncol(resMat), tst.ind = NULL, has.Pvalue = FALSE) 15 | } 16 | # invisible(resMat) 17 | } -------------------------------------------------------------------------------- /R/rse.R: -------------------------------------------------------------------------------- 1 | "rse" <- function(object, resvar = FALSE) 2 | { 3 | if (!is.null(object$"objList")) 4 | { 5 | fitValue <- object$"minval" 6 | } else { 7 | fitValue <- object$"fit"$"value" 8 | } 9 | 10 | rse <- switch(object$"type", 11 | "continuous" = fitValue / df.residual(object), 12 | "binomial" = NA, 13 | "Poisson" = NA, 14 | "event" = NA, 15 | "standard" = fitValue / df.residual(object)) 16 | 17 | if (resvar) 18 | { 19 | rse 20 | } else { 21 | sqrt(rse) 22 | } 23 | } -------------------------------------------------------------------------------- /R/searchdrc.R: -------------------------------------------------------------------------------- 1 | "searchdrc" <- function(object, which, range, len = 50) 2 | { 3 | sv <- object$start 4 | 5 | parNames <- object$parNames[[2]] 6 | whichInd <- regexpr(paste("^", which, ":", sep = ""), parNames) 7 | whichInd <- ((1:length(parNames))[whichInd>0])[1] 8 | 9 | if (length(whichInd)<1) {stop(paste("No such parameter ", which, sep = ""))} 10 | 11 | found <- FALSE 12 | for (i in seq(range[1], range[2], length.out = len)) 13 | { 14 | sv[whichInd] <- i 15 | 16 | options(warn = -1) 17 | modelFit <- try(update(object, start = sv, control = drmc(noMessage = TRUE)), silent=TRUE) 18 | if (!inherits(modelFit, "try-error")) {found <- TRUE; break} 19 | options(warn = 0) 20 | } 21 | 22 | if (found) 23 | { 24 | return(modelFit) 25 | } else { 26 | warning("Convergence failed.", call. = FALSE) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /R/showNews.R: -------------------------------------------------------------------------------- 1 | "showNews" <- function(pkgname, filename = c("NEWS", "CHANGES")) 2 | { 3 | filename <- match.arg(filename) 4 | 5 | file.show(paste(.libPaths(), pkgname, filename, sep = "/"), 6 | title = paste("Package information for", pkgname)) 7 | } 8 | ## drc:::showNews("drc") -------------------------------------------------------------------------------- /R/simDR.R: -------------------------------------------------------------------------------- 1 | 2 | ## One curve only 3 | "simDR" <- function(mpar, sigma, fct, noSim = 1000, conc, edVec = c(10, 50), seedVal = 20070723) 4 | { 5 | set.seed(seedVal) 6 | 7 | ## Calculating the true ED values 8 | lened <- length(edVec) 9 | edTRUE <- rep(0, lened) 10 | for (i in 1:lened) 11 | { 12 | edTRUE[i] <- fct$edfct(mpar, edVec[i], type="relative")[[1]] 13 | } 14 | 15 | ## Run simulations 16 | edMat1 <- array(NA, c(length(conc)-4, 6, lened)) 17 | # edMat2 <- array(NA, c(length(conc)-4, 6, 3)) 18 | # edMat3 <- array(NA, c(length(conc)-4, 6, 3)) 19 | tempMat <- matrix(NA, noSim, lened) 20 | for (i in 5:length(conc)) 21 | { 22 | cVec1 <- sort(conc[1:i]) 23 | for (j in 1:6) 24 | { 25 | cVec2 <- rep(cVec1, rep(j, i)) 26 | sim1 <- rdrm(noSim, LL.4(), mpar, cVec2, ypar = sigma) 27 | 28 | for (k in 1:noSim) 29 | { 30 | tempFit <- try(drm(sim1$y[k, ]~sim1$x[k, ], fct = fct), silent = TRUE) 31 | if (!inherits(tempFit, "try-error")) 32 | { 33 | edVal <- ED(tempFit, edVec, display = FALSE) 34 | tempMat[k, ] <- edVal[, 1] - edTRUE 35 | } 36 | } 37 | edMat1[i - 4, j, ] <- apply(tempMat, 2, sd, na.rm = TRUE) 38 | # edMat2[i - 4, j, ] <- apply(tempMat, 2, mean, na.rm = TRUE) 39 | # edMat3[i - 4, j, ] <- apply(tempMat, 2, function(x) {mean(x^2, na.rm = TRUE)}) 40 | } 41 | } 42 | 43 | #print(edMat1) 44 | cat("Concentrations used:", conc, "\n\n") 45 | for (i in 1:lened) 46 | { 47 | tempMat <- edMat1[, , i] 48 | colnames(tempMat) <- 1:6 49 | rownames(tempMat) <- 5:9 50 | 51 | cat("ED value considered:", edVec[i], "\n") 52 | cat("Conc. no.\\Replicates:", "\n") 53 | print(tempMat) 54 | cat("\n\n") 55 | } 56 | 57 | invisible(list(se=edMat1)) # , bias=edMat2, mse=edMat3)) 58 | } 59 | -------------------------------------------------------------------------------- /R/twophase.R: -------------------------------------------------------------------------------- 1 | "twophase" <- function( 2 | fixed = c(NA, NA, NA, NA, NA, NA, NA), names = c("b1", "c1", "d1", "e1", "b2", "d2", "e2"), 3 | fctName, fctText) 4 | { 5 | ## Checking arguments 6 | numParm <- 7 7 | if (!is.character(names) | !(length(names) == numParm)) {stop("Not correct 'names' argument")} 8 | if ( !(length(fixed) == numParm) ) {stop("Not correct 'fixed' argument")} 9 | 10 | ## Handling 'fixed' argument 11 | notFixed <- is.na(fixed) 12 | parmVec <- rep(0, numParm) 13 | parmVec[!notFixed] <- fixed[!notFixed] 14 | 15 | ## Defining the non-linear function 16 | fct <- function(dose, parm) 17 | { 18 | # print("A") 19 | parmMat <- matrix(parmVec, nrow(parm), numParm, byrow = TRUE) 20 | # print(notFixed) 21 | # print(parm) 22 | # print(parmMat[, notFixed]) 23 | parmMat[, notFixed] <- parm 24 | # print("B") 25 | # LL.4(fixed[1:4])$fct(dose, parmMat[, 1:4]) + LL.3(fixed[5:7])$fct(dose, parmMat[, 5:7]) 26 | 27 | fixed1.4 <- fixed[1:4] 28 | fixed5.7 <- fixed[5:7] 29 | LL.4()$fct(dose, parmMat[, 1:4, drop = FALSE]) + LL.3()$fct(dose, parmMat[, 5:7, drop = FALSE]) 30 | } 31 | 32 | ## Defining self starter function 33 | ssfct <- function(dframe) 34 | { 35 | # first4 <- drc:::llogistic.ssf(fixed = fixed[1:4])(dframe) # drc::: not need 36 | # first4 <- drc:::llogistic.ssf(fixed = c(NA, NA, NA, NA, 1))(dframe) 37 | first4 <- llogistic.ssf(fixed = c(NA, NA, NA, NA, 1))(dframe) 38 | 39 | # print(c(first4[1:2], first4[3]/2, first4[4]/3, first4[1], first4[3]/2, first4[4])[is.na(fixed)]) 40 | 41 | # c(first4[1:2], first4[3]/2, first4[4]/3, first4[1], first4[3]/2, first4[4])[is.na(fixed)] 42 | c(first4[1:2], first4[3]/2, first4[4]/3, first4[1], first4[3], first4[4])[is.na(fixed)] 43 | } 44 | 45 | ##Defining the first and second derivative (in the parameters) 46 | deriv1 <- NULL 47 | deriv2 <- NULL 48 | 49 | ##Defining the first derivative (in the dose) 50 | derivx <- NULL 51 | 52 | ## Defining the ED function 53 | edfct <- NULL 54 | 55 | ## Returning the function with self starter and names 56 | returnList <- 57 | list(fct = fct, ssfct = ssfct, names = names[notFixed], 58 | deriv1 = deriv1, deriv2 = deriv2, derivx = derivx, edfct = edfct, 59 | name = ifelse(missing(fctName), as.character(match.call()[[1]]), fctName), 60 | text = ifelse(missing(fctText), "Two-phase", fctText), 61 | noParm = sum(is.na(fixed)) 62 | ) 63 | 64 | class(returnList) <- "two-phase" 65 | invisible(returnList) 66 | } 67 | -------------------------------------------------------------------------------- /R/update.drc.R: -------------------------------------------------------------------------------- 1 | "update.drc" <- function (object, ..., evaluate = TRUE) 2 | { 3 | call <- object$call 4 | if (is.null(call)) 5 | stop("need an object with call component") 6 | 7 | extras <- match.call(expand.dots = FALSE)$... 8 | if (length(extras) > 0) 9 | { 10 | # glsa <- names(as.list(args(multdrc))) 11 | glsa <- names(as.list(args(drm))) 12 | names(extras) <- glsa[pmatch(names(extras), glsa[-length(glsa)])] 13 | existing <- !is.na(match(names(extras), names(call))) 14 | for (a in names(extras)[existing]) call[[a]] <- extras[[a]] 15 | if (any(!existing)) 16 | { 17 | call <- c(as.list(call), extras[!existing]) 18 | call <- as.call(call) 19 | } 20 | } 21 | if (evaluate) 22 | { 23 | # print(parent.frame(n=2)) 24 | # print(ls(envir=parent.frame(n=2))) 25 | # env2 <- parent.frame(n=2) 26 | # print(ls(envir=env2)) 27 | # eval(call, envir = env2) 28 | 29 | # eval(call, envir = parent.frame(), enclos = .GlobalEnv) 30 | eval(call, parent.frame()) 31 | } else call 32 | } 33 | -------------------------------------------------------------------------------- /R/weibull1.ssf.R: -------------------------------------------------------------------------------- 1 | "weibull1.ssf" <- function(method = c("1", "2", "3", "4"), fixed, useFixed = FALSE) 2 | { 3 | method <- match.arg(method) 4 | 5 | ## Defining helper functions (used below) 6 | ytrans <- function(y, cVal, dVal) {log(-log((y - cVal)/(dVal - cVal)))} 7 | bfct <- function(x, y, cVal, dVal, eVal) {ytrans(y, cVal, dVal)/log(x/eVal)} 8 | efct <- function(x, y, bVal, cVal, dVal) {x * exp(-ytrans(y, cVal, dVal)/bVal)} 9 | 10 | ## Assigning function for finding initial b and e parameter values 11 | findbe <- switch(method, 12 | "1" = findbe1(function(x) {rVec <- log(x); rVec[!x>0] <- NA; rVec}, ytrans), 13 | "2" = findbe2(bfct, efct, "Anke"), 14 | "3" = findbe3(), 15 | "4" = findbe2(bfct, efct, "Normolle")) 16 | 17 | function(dframe) 18 | { 19 | x <- dframe[, 1] 20 | y <- dframe[, 2] 21 | 22 | ## Finding initial values for the c and d parameters 23 | cdVal <- findcd(x, y) 24 | if (useFixed) {} # not implemented at the moment 25 | 26 | ## Finding initial values for the b and e parameters 27 | beVal <- findbe(x, y, cdVal[1], cdVal[2]) 28 | 29 | return(c(beVal[1], cdVal, beVal[2])[is.na(fixed)]) 30 | } 31 | } -------------------------------------------------------------------------------- /R/weibull2.ssf.R: -------------------------------------------------------------------------------- 1 | "weibull2.ssf" <- function(method = c("1", "2", "3", "4"), fixed, useFixed = FALSE) 2 | { 3 | method <- match.arg(method) 4 | 5 | ## Defining helper functions (used below) 6 | ytrans <- function(y, cVal, dVal) {log(-log((dVal - y)/(dVal - cVal)))} 7 | bfct <- function(x, y, cVal, dVal, eVal) {ytrans(y, cVal, dVal)/log(x/eVal)} 8 | efct <- function(x, y, bVal, cVal, dVal) {x * exp(-ytrans(y, cVal, dVal)/bVal)} 9 | 10 | ## Assigning function for finding initial b and e parameter values 11 | findbe <- switch(method, 12 | "1" = findbe1(function(x) {rVec <- log(x); rVec[!x>0] <- NA; rVec}, ytrans), 13 | "2" = findbe2(bfct, efct, "Anke"), 14 | "3" = findbe3(-1), 15 | "4" = findbe2(bfct, efct, "Normolle")) 16 | 17 | function(dframe) 18 | { 19 | x <- dframe[, 1] 20 | y <- dframe[, 2] 21 | 22 | ## Finding initial values for the c and d parameters 23 | cdVal <- findcd(x, y) 24 | if (useFixed) {} # not implemented at the moment 25 | 26 | ## Finding initial values for the b and e parameters 27 | beVal <- findbe(x, y, cdVal[1], cdVal[2]) 28 | 29 | return(c(beVal[1], cdVal, beVal[2])[is.na(fixed)]) 30 | } 31 | } -------------------------------------------------------------------------------- /R/xlogx.R: -------------------------------------------------------------------------------- 1 | ## Helper functions 2 | ## used in llogistic, weibull1, weibull2 3 | 4 | #"xlogx" <- function(x, p) 5 | #{ 6 | # lv <- (x < 1e-12) 7 | # nlv <- !lv 8 | # 9 | # rv <- rep(0, length(x)) 10 | # 11 | # xlv <- x[lv] 12 | # rv[lv] <- log(xlv^(xlv^p[lv])) 13 | # 14 | # xnlv <- x[nlv] 15 | # rv[nlv] <- (xnlv^p[nlv])*log(xnlv) 16 | # 17 | # rv 18 | #} 19 | 20 | divAtInf <- function(x, y) 21 | { 22 | retVec <- x / y 23 | retVec[(!is.finite(y))] <- 0 24 | # Assuming the y tends to infinity faster than x 25 | 26 | retVec 27 | } 28 | 29 | 30 | "xlogx" <- function(x, p, f = 0) 31 | { 32 | lv <- (x < 1e-12) 33 | nlv <- !lv 34 | 35 | rv <- rep(0, length(x)) 36 | 37 | xPowerp <- x^p 38 | 39 | # Handling Inf/Inf 40 | # ratioVec <- xPowerp / (1 + xPowerp)^f 41 | # ratioVec[!is.finite(xPowerp)] <- 0 42 | ratioVec <- divAtInf(xPowerp, (1 + xPowerp)^f) 43 | 44 | xlv <- x[lv] 45 | rv[lv] <- log( xlv^ratioVec[lv] ) 46 | # rv[lv] <- log( xlv^(xlv^p[lv] / (1 + xlv^p[lv])^f[lv]) ) 47 | 48 | xnlv <- x[nlv] 49 | rv[nlv] <- ratioVec[nlv] * log(xnlv) 50 | # rv[nlv] <- ( xnlv^p[nlv] / (1 + xnlv^p[nlv])^f[nlv] ) * log(xnlv) 51 | 52 | rv 53 | } 54 | 55 | 56 | "xexpx" <- function(x, p) 57 | { 58 | lv <- (x < 1e-12) 59 | nlv <- !lv 60 | 61 | rv <- rep(0, length(x)) 62 | 63 | xlv <- x[lv] 64 | rv[lv] <- 0 # must be a better approach 65 | 66 | xnlv <- x[nlv] 67 | rv[nlv] <- (xnlv^p[nlv])*exp(-(xnlv^p[nlv])) 68 | 69 | rv 70 | } 71 | 72 | "xexplogx" <- function(x, p) 73 | { 74 | lv <- (x < 1e-12) 75 | nlv <- !lv 76 | 77 | rv <- rep(0, length(x)) 78 | 79 | xlv <- x[lv] 80 | rv[lv] <- 0 # must be a better approach 81 | 82 | xnlv <- x[nlv] 83 | rv[nlv] <- log(xnlv)*(xnlv^p[nlv])*exp(-(xnlv^p[nlv])) 84 | 85 | rv 86 | } 87 | -------------------------------------------------------------------------------- /data/G.aparine.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/G.aparine.rda -------------------------------------------------------------------------------- /data/H.virescens.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/H.virescens.rda -------------------------------------------------------------------------------- /data/M.bahia.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/M.bahia.rda -------------------------------------------------------------------------------- /data/O.mykiss.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/O.mykiss.rda -------------------------------------------------------------------------------- /data/P.promelas.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/P.promelas.rda -------------------------------------------------------------------------------- /data/RScompetition.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/RScompetition.rda -------------------------------------------------------------------------------- /data/S.alba.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/S.alba.rda -------------------------------------------------------------------------------- /data/S.capricornutum.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/S.capricornutum.rda -------------------------------------------------------------------------------- /data/acidiq.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/acidiq.rda -------------------------------------------------------------------------------- /data/algae.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/algae.rda -------------------------------------------------------------------------------- /data/auxins.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/auxins.rda -------------------------------------------------------------------------------- /data/chickweed.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/chickweed.rda -------------------------------------------------------------------------------- /data/chickweed0.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/chickweed0.rda -------------------------------------------------------------------------------- /data/daphnids.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/daphnids.rda -------------------------------------------------------------------------------- /data/decontaminants.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/decontaminants.rda -------------------------------------------------------------------------------- /data/deguelin.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/deguelin.rda -------------------------------------------------------------------------------- /data/earthworms.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/earthworms.rda -------------------------------------------------------------------------------- /data/etmotc.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/etmotc.rda -------------------------------------------------------------------------------- /data/finney71.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/finney71.rda -------------------------------------------------------------------------------- /data/germination.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/germination.rda -------------------------------------------------------------------------------- /data/glymet.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/glymet.rda -------------------------------------------------------------------------------- /data/heartrate.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/heartrate.rda -------------------------------------------------------------------------------- /data/leaflength.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/leaflength.rda -------------------------------------------------------------------------------- /data/lepidium.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/lepidium.rda -------------------------------------------------------------------------------- /data/lettuce.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/lettuce.rda -------------------------------------------------------------------------------- /data/mecter.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/mecter.rda -------------------------------------------------------------------------------- /data/metals.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/metals.rda -------------------------------------------------------------------------------- /data/methionine.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/methionine.rda -------------------------------------------------------------------------------- /data/nasturtium.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/nasturtium.rda -------------------------------------------------------------------------------- /data/ryegrass.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/ryegrass.rda -------------------------------------------------------------------------------- /data/secalonic.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/secalonic.rda -------------------------------------------------------------------------------- /data/selenium.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/selenium.rda -------------------------------------------------------------------------------- /data/spinach.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/spinach.rda -------------------------------------------------------------------------------- /data/terbuthylazin.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/terbuthylazin.rda -------------------------------------------------------------------------------- /data/vinclozolin.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cran/drc/ad2974183da72a4978467f77615d3d41eb4026a5/data/vinclozolin.rda -------------------------------------------------------------------------------- /inst/CITATION: -------------------------------------------------------------------------------- 1 | citHeader("To cite the package 'drc' in publications:") 2 | 3 | citEntry(entry = "Article", 4 | title = "Dose-Response Analysis Using R", 5 | author = personList(as.person("C. Ritz"), as.person("F. Baty"), as.person("J. C. Streibig"), 6 | as.person("D. Gerhard")), 7 | journal = "PLOS ONE", 8 | volume = 10, 9 | issue = 12, 10 | number = "e0146021", 11 | year = 2015, 12 | url = "http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0146021", 13 | 14 | textVersion = 15 | paste("Ritz, C., Baty, F., Streibig, J. C., Gerhard, D. (2015)", 16 | "Dose-Response Analysis Using R", 17 | "PLOS ONE, 10(12), e0146021") 18 | ) 19 | -------------------------------------------------------------------------------- /man/AR.Rd: -------------------------------------------------------------------------------- 1 | \name{AR} 2 | 3 | \alias{AR.2} 4 | \alias{AR.3} 5 | 6 | \title{Asymptotic regression model} 7 | 8 | \description{ 9 | Providing the mean function and the corresponding self starter function for the asymptotic regression model. 10 | } 11 | 12 | \usage{ 13 | AR.2(fixed = c(NA, NA), names = c("d", "e"), ...) 14 | 15 | AR.3(fixed = c(NA, NA, NA), names = c("c", "d", "e"), ...) 16 | } 17 | 18 | \arguments{ 19 | \item{fixed}{numeric vector. Specifies which parameters are fixed and at what value they are fixed. 20 | NAs for parameter that are not fixed.} 21 | \item{names}{vector of character strings giving the names of the parameters (should not contain ":").} 22 | \item{...}{additional arguments to be passed from the convenience functions.} 23 | } 24 | 25 | \details{ 26 | The asymptotic regression model is a three-parameter model with mean function: 27 | 28 | \deqn{ f(x) = c + (d-c)(1-\exp(-x/e))} 29 | 30 | The parameter \eqn{c} is the lower limit (at \eqn{x=0}), the parameter \eqn{d} is the upper limit 31 | and the parameter \eqn{e>0} is determining the steepness of the increase as \eqn{x}. 32 | } 33 | 34 | \value{ 35 | A list of class \code{drcMean}, containing the mean function, the self starter function, 36 | the parameter names and other components such as derivatives and a function for calculating ED values. 37 | } 38 | 39 | %\references{ ~put references to the literature/web site here ~ } 40 | 41 | \author{Christian Ritz} 42 | 43 | \note{ 44 | The functions are for use with the function \code{\link{drm}}. 45 | } 46 | 47 | \seealso{ 48 | A very similar, but monotonously decreasing model is the exponential decay model: 49 | \code{\link{EXD.2}} and \code{\link{EXD.3}}. 50 | } 51 | 52 | \examples{ 53 | 54 | ## First model 55 | met.as.m1<-drm(gain ~ dose, product, data = methionine, fct = AR.3(), 56 | pmodels = list(~1, ~factor(product), ~factor(product))) 57 | plot(met.as.m1, log = "", ylim = c(1450, 1800)) 58 | summary(met.as.m1) 59 | 60 | ## Calculating bioefficacy: approach 1 61 | coef(met.as.m1)[5] / coef(met.as.m1)[4] * 100 62 | 63 | ## Calculating bioefficacy: approach 2 64 | EDcomp(met.as.m1, c(50,50)) 65 | 66 | ## Simplified models 67 | met.as.m2<-drm(gain ~ dose, product, data = methionine, fct = AR.3(), 68 | pmodels = list(~1, ~1, ~factor(product))) 69 | anova(met.as.m2, met.as.m1) # simplification not possible 70 | 71 | met.as.m3 <- drm(gain ~ dose, product, data = methionine, fct = AR.3(), 72 | pmodels = list(~1, ~factor(product), ~1)) 73 | anova(met.as.m3, met.as.m1) # simplification not possible 74 | 75 | } 76 | \keyword{models} 77 | \keyword{nonlinear} 78 | 79 | -------------------------------------------------------------------------------- /man/CRS.4a.Rd: -------------------------------------------------------------------------------- 1 | \name{CRS.4a} 2 | 3 | \alias{CRS.4a} 4 | \alias{CRS.4b} 5 | \alias{CRS.4c} 6 | 7 | \alias{ml3a} 8 | \alias{ml3b} 9 | \alias{ml3c} 10 | 11 | \alias{UCRS.4a} 12 | \alias{UCRS.4b} 13 | \alias{UCRS.4c} 14 | 15 | \alias{uml3a} 16 | \alias{uml3b} 17 | \alias{uml3c} 18 | 19 | \title{The Cedergreen-Ritz-Streibig model} 20 | 21 | \description{ 22 | 'CRS.4a', 'CRS.4b' and 'CRS.4c' provide the Cedergreen-Ritz-Streibig modified log-logistic model 23 | for describing hormesis with the lower limit equal to 0. 24 | 25 | 'UCRS.4a', 'UCRS.4b' and 'UCRS.4c' provide the Cedergreen-Ritz-Streibig modified log-logistic model 26 | for describing u-shaped hormesis with the lower limit equal to 0. 27 | } 28 | 29 | \usage{ 30 | CRS.4a(names = c("b", "d", "e", "f"), ...) 31 | 32 | UCRS.4a(names = c("b", "d", "e", "f"), ...) 33 | } 34 | 35 | \arguments{ 36 | \item{names}{a vector of character strings giving the names of the parameters. 37 | The default is reasonable (see above).} 38 | \item{...}{additional arguments to be passed from the convenience functions.} 39 | } 40 | 41 | \details{ 42 | The model is given by the expression 43 | \deqn{ f(x) = 0 + \frac{d-0+f \exp(-1/x)}{1+\exp(b(\log(x)-\log(e)))}} 44 | which is a five-parameter model. 45 | 46 | It is a modification of the four-parameter logistic curve to take hormesis into account. 47 | 48 | The u-shaped model is given by the expression 49 | \deqn{ f(x) = 0 + d - \frac{d-0+f \exp(-1/x^{\alpha})}{1+\exp(b(\log(x)-\log(e)))}} 50 | 51 | The a,b,c models are obtained by setting alpha equal to 1, 0.5 and 0.25, respectively. 52 | } 53 | 54 | \value{ 55 | See \code{\link{cedergreen}}. 56 | } 57 | 58 | \references{ 59 | See the reference under \code{\link{cedergreen}}. 60 | } 61 | 62 | \author{Christian Ritz} 63 | 64 | \note{ 65 | This function is for use with the function \code{\link{drm}}. 66 | } 67 | 68 | \seealso{ 69 | Similar functions are \code{\link{CRS.5a}} and \code{\link{UCRS.5a}}, 70 | but with an extra parameter for the lower limit.} 71 | 72 | \examples{ 73 | 74 | ## Fitting modified logistic models 75 | lettuce.crsm1 <- drm(lettuce[,c(2,1)], fct=CRS.4a()) 76 | summary(lettuce.crsm1) 77 | ED(lettuce.crsm1, c(50)) 78 | 79 | ## Need to explicitly specify that the upper limit 80 | ## is the reference in order to get ED10 and ED90 right 81 | ED(lettuce.crsm1, c(10, 50, 90), reference = "upper") 82 | 83 | lettuce.crsm2 <- drm(lettuce[,c(2,1)], fct=CRS.4b()) 84 | summary(lettuce.crsm2) 85 | ED(lettuce.crsm2, c(50)) 86 | 87 | lettuce.crsm3 <- drm(lettuce[,c(2,1)], fct=CRS.4c()) 88 | summary(lettuce.crsm3) 89 | ED(lettuce.crsm3, c(50)) 90 | 91 | } 92 | 93 | \keyword{models} 94 | \keyword{nonlinear} 95 | -------------------------------------------------------------------------------- /man/EXD.Rd: -------------------------------------------------------------------------------- 1 | \name{EXD} 2 | 3 | \alias{EXD.2} 4 | \alias{EXD.3} 5 | 6 | \title{Exponential decay model} 7 | 8 | \description{ 9 | Exponential decay model with or without a nonzero lower limit. 10 | } 11 | 12 | \usage{ 13 | EXD.2(fixed = c(NA, NA), names = c("d", "e"), ...) 14 | 15 | EXD.3(fixed = c(NA, NA, NA), names = c("c", "d", "e"), ...) 16 | } 17 | 18 | \arguments{ 19 | \item{fixed}{numeric vector. Specifies which parameters are fixed and at what value they are fixed. 20 | NAs for parameter that are not fixed.} 21 | \item{names}{vector of character strings giving the names of the parameters (should not contain ":"). 22 | The default parameter names are: init, plateau, k.} 23 | \item{...}{additional arguments to be passed from the convenience functions.} 24 | } 25 | 26 | \details{ 27 | The exponential decay model is a three-parameter model with mean function: 28 | 29 | \deqn{f(x) = c + (d-c)(\exp(-x/e))} 30 | 31 | The parameter init is the upper limit (attained at \eqn{x=0}), the parameter plateau is the lower limit 32 | reached for x going to infinity and the parameter \eqn{e>0} is determining the steepness of the 33 | decay. The curve is monotonously decreasing in \eqn{x}. 34 | } 35 | 36 | \value{ 37 | A list of class \code{drcMean}, containing the mean function, the self starter function, 38 | the parameter names and other components such as derivatives and a function for calculating ED values. 39 | } 40 | 41 | \references{ 42 | Organisation for Economic Co-operation and Development (OECD) (2006) 43 | \emph{Current approaches in the statistical analysis of ecotoxicity data: A guidance to application - annexes}, 44 | Paris: OECD (p. 80). 45 | } 46 | 47 | \author{Christian Ritz} 48 | 49 | %\note{} 50 | 51 | \seealso{ 52 | Similar models giving exponential increasing curves are \code{\link{AR.2}} and \code{\link{AR.3}}. 53 | } 54 | 55 | \examples{ 56 | 57 | ## Fitting an exponential decay model 58 | ryegrass.m1<-drm(rootl~conc, data=ryegrass, fct=EXD.3()) 59 | 60 | plot(ryegrass.m1) 61 | 62 | summary(ryegrass.m1) 63 | 64 | } 65 | \keyword{models} 66 | \keyword{nonlinear} 67 | -------------------------------------------------------------------------------- /man/H.virescens.Rd: -------------------------------------------------------------------------------- 1 | \name{H.virescens} 2 | 3 | \alias{H.virescens} 4 | 5 | \docType{data} 6 | 7 | \title{Mortality of tobacco budworms} 8 | 9 | \description{ 10 | For three days, moths of the tobacco budworm (\emph{Heliothis virescens}) were exposed 11 | to doses of the pyrethroid trans-cypermethrin. 12 | } 13 | 14 | \usage{data(H.virescens)} 15 | 16 | \format{ 17 | A data frame with 12 observations on the following 4 variables. 18 | \describe{ 19 | \item{\code{dose}}{a numeric vector of dose values (\eqn{\mu g})} 20 | \item{\code{numdead}}{a numeric vector of dead or knocked-down moths} 21 | \item{\code{total}}{a numeric vector of total number of moths} 22 | \item{\code{sex}}{a factor with levels \code{F} \code{M} denoting a grouping according to sex} 23 | } 24 | } 25 | 26 | \details{ 27 | In Venables and Ripley (2002), these data are analysed using a logistic regression with base-2 logarithm of dose 28 | as explanatory variable. 29 | } 30 | 31 | \source{ 32 | Venables, W. N. and Ripley, B. D (2002) \emph{Modern Applied Statistics with S}, New York: Springer (fourth edition). 33 | } 34 | 35 | %\references{} 36 | 37 | \examples{ 38 | 39 | ## Fitting dose-response model (log-logistic with common slope) 40 | Hv.m1 <- drm(numdead/total~dose, sex, weights = total, data = H.virescens, fct = LL.2(), 41 | pmodels = list(~ 1, ~ sex - 1), type = "binomial") 42 | summary(Hv.m1) 43 | 44 | ## Fitting the same model as in Venables and Riply (2002) 45 | Hv.m2 <- glm(cbind(numdead, total-numdead) ~ sex + I(log2(dose)) - 1, data = H.virescens, 46 | family = binomial) 47 | 48 | ## Comparing the fits 49 | logLik(Hv.m1) 50 | logLik(Hv.m2) 51 | 52 | ## Estimated ED values (matching those given in MASS) 53 | ED(Hv.m1, c(25, 50, 75)) 54 | 55 | 56 | } 57 | \keyword{datasets} 58 | -------------------------------------------------------------------------------- /man/LL.2.Rd: -------------------------------------------------------------------------------- 1 | \name{LL.2} 2 | 3 | \alias{LL.2} 4 | \alias{l2} 5 | 6 | \alias{LL2.2} 7 | 8 | \title{The two-parameter log-logistic function} 9 | 10 | \description{ 11 | 'LL.2' and 'LL2.2' provide the two-parameter log-logistic function where the lower limit is fixed at 0 and the upper limit 12 | is fixed at 1, mostly suitable for binomial/quantal responses. 13 | } 14 | 15 | \usage{ 16 | LL.2(upper = 1, fixed = c(NA, NA), names = c("b", "e"), ...) 17 | 18 | l2(upper = 1, fixed = c(NA, NA), names = c("b", "e"), ...) 19 | 20 | LL2.2(upper = 1, fixed = c(NA, NA), names = c("b", "e"), ...) 21 | } 22 | 23 | \arguments{ 24 | \item{upper}{numeric value. The fixed, upper limit in the model. Default is 1.} 25 | \item{fixed}{numeric vector. Specifies which parameters are fixed and at what value they are fixed. NAs for parameter that are not fixed.} 26 | \item{names}{a vector of character strings giving the names of the parameters. The default is reasonable.} 27 | \item{...}{Additional arguments (see \code{\link{llogistic}}).} 28 | } 29 | 30 | \details{ 31 | The two-parameter log-logistic function is given by the expression 32 | \deqn{ f(x) = \frac{1}{1+\exp(b(\log(x)-\log(e)))}} 33 | 34 | or in another parameterisation 35 | \deqn{ f(x) = \frac{1}{1+\exp(b(\log(x)-e))}} 36 | 37 | The model function is symmetric about the inflection point (\eqn{e}). 38 | } 39 | 40 | \value{ 41 | See \code{\link{llogistic}}. 42 | } 43 | 44 | %\references{ ~put references to the literature/web site here ~ } 45 | 46 | \author{Christian Ritz} 47 | 48 | \note{ 49 | This function is for use with the function \code{\link{drm}}. 50 | } 51 | 52 | \seealso{ 53 | Related functions are \code{\link{LL.3}}, \code{\link{LL.4}}, \code{\link{LL.5}} and the more general 54 | \code{\link{llogistic}}. 55 | } 56 | 57 | \examples{ 58 | 59 | ## Fitting a two-parameter logistic model 60 | ## to binomial responses (a logit model) 61 | earthworms.m1 <- drm(number/total~dose, weights=total, 62 | data = earthworms, fct = LL.2(), type = "binomial") 63 | 64 | plot(earthworms.m1) # not fitting at the upper limit! 65 | 66 | } 67 | 68 | \keyword{models} 69 | \keyword{nonlinear} 70 | 71 | \concept{Hill logit 2-parameter two-parameter} -------------------------------------------------------------------------------- /man/LL.4.Rd: -------------------------------------------------------------------------------- 1 | \name{LL.4} 2 | 3 | \alias{LL.4} 4 | \alias{l4} 5 | 6 | \alias{LL2.4} 7 | 8 | \title{The four-parameter log-logistic function} 9 | 10 | \description{ 11 | 'LL.4' and 'LL2.4' provide the four-parameter log-logistic function, self starter function, names of the parameters and, optionally, 12 | first and second derivatives for a faster estimation. 13 | } 14 | 15 | \usage{ 16 | LL.4(fixed = c(NA, NA, NA, NA), names = c("b", "c", "d", "e"), ...) 17 | 18 | l4(fixed = c(NA, NA, NA, NA), names = c("b", "c", "d", "e"), ...) 19 | 20 | LL2.4(fixed = c(NA, NA, NA, NA), names = c("b", "c", "d", "e"), ...) 21 | } 22 | 23 | \arguments{ 24 | \item{fixed}{numeric vector. Specifies which parameters are fixed and at what value they are fixed. NAs for parameter that are not fixed.} 25 | \item{names}{a vector of character strings giving the names of the parameters. The default is reasonable.} 26 | \item{...}{Additional arguments (see \code{\link{llogistic}}).} 27 | } 28 | 29 | \details{ 30 | The four-parameter log-logistic function is given by the expression 31 | \deqn{ f(x) = c + \frac{d-c}{1+\exp(b(\log(x)-\log(e)))}} 32 | 33 | or in another parameterisation (converting the term \eqn{\log(e)} into a parameter) 34 | \deqn{ f(x) = c + \frac{d-c}{1+\exp(b(\log(x)-\tilde{e}))}} 35 | 36 | The function is symmetric about the inflection point (\eqn{e}). 37 | } 38 | 39 | \value{ 40 | See \code{\link{llogistic}}. 41 | } 42 | 43 | \references{ 44 | Seber, G. A. F. and Wild, C. J (1989) \emph{Nonlinear Regression}, New York: Wiley \& Sons (p. 330). 45 | } 46 | 47 | \author{Christian Ritz and Jens C. Streibig} 48 | 49 | \note{This function is for use with the function \code{\link{drm}}.} 50 | 51 | \seealso{Setting \eqn{c=0} yields \code{\link{LL.3}}. See also \code{\link{LL.5}}.} 52 | 53 | \examples{ 54 | 55 | spinach.m1 <- drm(SLOPE~DOSE, CURVE, data = spinach, fct = LL.4()) 56 | spinach.m1 57 | 58 | 59 | } 60 | 61 | \keyword{models} 62 | \keyword{nonlinear} 63 | 64 | \concept{Hill 4-parameter four-parameter} 65 | -------------------------------------------------------------------------------- /man/LL.5.Rd: -------------------------------------------------------------------------------- 1 | \name{LL.5} 2 | 3 | \alias{LL.5} 4 | \alias{l5} 5 | 6 | \alias{LL2.5} 7 | 8 | \title{The five-parameter log-logistic function} 9 | 10 | \description{ 11 | 'LL.5' and 'LL2.5' provide the five-parameter log-logistic function, self starter function and names of the parameters. 12 | } 13 | 14 | \usage{ 15 | LL.5(fixed = c(NA, NA, NA, NA, NA), names = c("b", "c", "d", "e", "f"), ...) 16 | 17 | l5(fixed = c(NA, NA, NA, NA, NA), names = c("b", "c", "d", "e", "f"), ...) 18 | 19 | LL2.5(fixed = c(NA, NA, NA, NA, NA), names = c("b", "c", "d", "e", "f"), ...) 20 | } 21 | 22 | \arguments{ 23 | \item{fixed}{numeric vector. Specifies which parameters are fixed and at what value they are fixed. NAs for parameter that are not fixed.} 24 | \item{names}{a vector of character strings giving the names of the parameters. The default is reasonable.} 25 | \item{...}{Additional arguments (see \code{\link{llogistic}}).} 26 | } 27 | 28 | \details{ 29 | The five-parameter logistic function is given by the expression 30 | \deqn{ f(x) = c + \frac{d-c}{(1+\exp(b(\log(x)-\log(e))))^f}} 31 | 32 | or in another parameterisation 33 | \deqn{ f(x) = c + \frac{d-c}{(1+\exp(b(\log(x)-e)))^f}} 34 | 35 | The function is asymmetric for \eqn{f} different from 1. 36 | 37 | } 38 | \value{ 39 | See \code{\link{llogistic}}. 40 | } 41 | \references{ 42 | Finney, D. J. (1979) Bioassay and the Practise of Statistical Inference, 43 | \emph{Int. Statist. Rev.}, \bold{47}, 1--12. 44 | } 45 | 46 | \author{Christian Ritz} 47 | 48 | \note{This function is for use with the function \code{\link{drm}}.} 49 | 50 | \seealso{Related functions are \code{\link{LL.4}} and \code{\link{LL.3}}.} 51 | 52 | \examples{ 53 | 54 | ryegrass.m1 <- drm(rootl ~ conc, data = ryegrass, fct = LL.5()) 55 | summary(ryegrass.m1) 56 | 57 | } 58 | 59 | \keyword{models} 60 | \keyword{nonlinear} 61 | 62 | \concept{Hill 5-parameter five-parameter} -------------------------------------------------------------------------------- /man/M.bahia.Rd: -------------------------------------------------------------------------------- 1 | \name{M.bahia} 2 | 3 | \alias{M.bahia} 4 | 5 | \docType{data} 6 | 7 | \title{Effect of an effluent on the growth of mysid shrimp} 8 | 9 | \description{ 10 | Juvenile mysid shrimp (\emph{Mysidopsis bahia}) were exposed to up to 32\% effluent 11 | in a 7-day survival and growth test. The average weight per treatment replicate of 12 | surviving organisms was measured. 13 | } 14 | 15 | \usage{data(M.bahia)} 16 | 17 | \format{ 18 | A data frame with 40 observations on the following 2 variables. 19 | \describe{ 20 | \item{\code{conc}}{a numeric vector of effluent concentrations (\%)} 21 | \item{\code{dryweight}}{a numeric vector of average dry weights (mg)} 22 | } 23 | } 24 | 25 | \details{ 26 | The data are analysed in Bruce and Versteeg (1992) using a log-normal 27 | dose-response model (using the logarithm with base 10). 28 | 29 | At 32\% there was complete mortality, and this justifies using a model where a lower asymptote 30 | of 0 is assumed. 31 | } 32 | 33 | \source{ 34 | Bruce, R. D. and Versteeg, D. J. (1992) A statistical procedure for modeling continuous toxicity data, 35 | \emph{Environ. Toxicol. Chem.}, \bold{11}, 1485--1494. 36 | } 37 | 38 | %\references{} 39 | 40 | \examples{ 41 | 42 | M.bahia.m1 <- drm(dryweight~conc, data=M.bahia, fct=LN.3()) 43 | 44 | ## Variation increasing 45 | plot(fitted(M.bahia.m1), residuals(M.bahia.m1)) 46 | 47 | ## Using transform-both-sides approach 48 | M.bahia.m2 <- boxcox(M.bahia.m1, method = "anova") 49 | summary(M.bahia.m2) # logarithm transformation 50 | 51 | ## Variation roughly constant, but still not a great fit 52 | plot(fitted(M.bahia.m2), residuals(M.bahia.m2)) 53 | 54 | ## Visual comparison of fits 55 | plot(M.bahia.m1, type="all", broken=TRUE) 56 | plot(M.bahia.m2, add=TRUE, type="none", broken=TRUE, lty=2) 57 | 58 | ED(M.bahia.m2, c(10,20,50), ci="fls") 59 | 60 | ## A better fit 61 | M.bahia.m3 <- boxcox(update(M.bahia.m1, fct = LN.4()), method = "anova") 62 | #plot(fitted(M.bahia.m3), residuals(M.bahia.m3)) 63 | plot(M.bahia.m3, add=TRUE, type="none", broken=TRUE, lty=3, col=2) 64 | ED(M.bahia.m3, c(10,20,50), ci="fls") 65 | 66 | } 67 | \keyword{datasets} 68 | -------------------------------------------------------------------------------- /man/MAX.Rd: -------------------------------------------------------------------------------- 1 | \name{MAX} 2 | 3 | \alias{MAX} 4 | 5 | \title{Maximum mean response} 6 | 7 | \description{ 8 | \code{MAX} estimates the maximum mean response and the dose at which it occurs. 9 | } 10 | 11 | \usage{ 12 | MAX(object, lower = 1e-3, upper = 1000, pool = TRUE) 13 | } 14 | 15 | \arguments{ 16 | \item{object}{an object of class 'drc'.} 17 | \item{lower}{numeric. Lower limit for bisection method. Need to be smaller than EDx level to be calculated.} 18 | \item{upper}{numeric. Upper limit for bisection method. Need to be larger than EDx level to be calculated.} 19 | \item{pool}{logical. If TRUE curves are pooled. Otherwise they are not. This argument only works for models with 20 | independently fitted curves as specified in \code{\link{drm}}.} 21 | } 22 | 23 | \details{ 24 | This function is only implemented for the built-in functions of class \code{\link{braincousens}} and 25 | \code{\link{cedergreen}}. 26 | 27 | This function was used for obtaining the results on hormesis effect size reported in Cedergreen et al. (2005). 28 | } 29 | 30 | \value{ 31 | A matrix with one row per curve in the data set and two columns: 32 | one containing the dose at which the maximum occurs 33 | and one containing the corresponding maximum response. 34 | } 35 | 36 | \references{ 37 | Cedergreen, N. and Ritz, C. and Streibig, J. C. (2005) Improved empirical models describing hormesis, 38 | \emph{Environmental Toxicology and Chemistry} \bold{24}, 3166--3172. 39 | } 40 | 41 | \author{Christian Ritz} 42 | 43 | %\note{This function is only implemented for the built-in functions of class 'braincousens' and 'mlogistic'.} 44 | 45 | %\seealso{The related function \code{\link{SI}}.} 46 | 47 | \examples{ 48 | 49 | ## Fitting a Cedergreen-Ritz-Streibig model 50 | lettuce.m1 <- drm(weight~conc, data = lettuce, fct = CRS.4c()) 51 | 52 | ## Finding maximum average response and the corrresponding dose 53 | MAX(lettuce.m1) 54 | 55 | } 56 | \keyword{models} 57 | \keyword{nonlinear} 58 | -------------------------------------------------------------------------------- /man/O.mykiss.Rd: -------------------------------------------------------------------------------- 1 | \name{O.mykiss} 2 | 3 | \alias{O.mykiss} 4 | 5 | \docType{data} 6 | 7 | \title{Test data from a 21 day fish test} 8 | 9 | \description{ 10 | Test data from a 21 day fish test following the guidelines OECD GL204, 11 | using the test organism Rainbow trout \emph{Oncorhynchus mykiss}. 12 | } 13 | 14 | \usage{data(O.mykiss)} 15 | 16 | \format{ 17 | A data frame with 70 observations on the following 2 variables. 18 | \describe{ 19 | \item{\code{conc}}{a numeric vector of concentrations (mg/l)} 20 | \item{\code{weight}}{a numeric vector of wet weights (g)} 21 | } 22 | } 23 | 24 | \details{ 25 | Weights are measured after 28 days. 26 | } 27 | 28 | \source{ 29 | Organisation for Economic Co-operation and Development (OECD) (2006) 30 | \emph{CURRENT APPROACHES IN THE STATISTICAL ANALYSIS OF ECOTOXICITY DATA: A GUIDANCE TO APPLICATION - ANNEXES}, 31 | Paris (p. 65). 32 | } 33 | 34 | \references{ 35 | Organisation for Economic Co-operation and Development (OECD) (2006) 36 | \emph{CURRENT APPROACHES IN THE STATISTICAL ANALYSIS OF ECOTOXICITY DATA: A GUIDANCE TO APPLICATION - ANNEXES}, 37 | Paris (pp. 80--85). 38 | } 39 | 40 | \examples{ 41 | 42 | head(O.mykiss) 43 | 44 | ## Fitting exponential model 45 | O.mykiss.m1 <- drm(weight ~ conc, data = O.mykiss, fct = EXD.2(), na.action = na.omit) 46 | modelFit(O.mykiss.m1) 47 | summary(O.mykiss.m1) 48 | 49 | ## Fitting same model with transform-both-sides approach 50 | O.mykiss.m2 <- boxcox(O.mykiss.m1 , method = "anova") 51 | summary(O.mykiss.m2) 52 | # no need for a transformation 53 | 54 | ## Plotting the fit 55 | plot(O.mykiss.m1, type = "all", xlim = c(0, 500), ylim = c(0,4), 56 | xlab = "Concentration (mg/l)", ylab = "Weight (g)", broken = TRUE) 57 | 58 | } 59 | \keyword{datasets} 60 | -------------------------------------------------------------------------------- /man/P.promelas.Rd: -------------------------------------------------------------------------------- 1 | \name{P.promelas} 2 | 3 | \alias{P.promelas} 4 | 5 | \docType{data} 6 | 7 | \title{Effect of sodium pentachlorophenate on growth of fathead minnow} 8 | 9 | \description{ 10 | Fathead minnows (\emph{Pimephales promelas}) were exposed to sodium pentachlorophenate 11 | concentrations ranging from 32 to 512 micro g/L in a 7-day larval survival and growth test. 12 | The average dry weight was measured. 13 | } 14 | 15 | \usage{data(P.promelas)} 16 | 17 | \format{ 18 | A data frame with 24 observations on the following 2 variables. 19 | \describe{ 20 | \item{\code{conc}}{a numeric vector of sodium pentachlorophenate concentrations (micro g/L).} 21 | \item{\code{dryweight}}{a numeric vector dry weights (mg)} 22 | } 23 | } 24 | 25 | \details{ 26 | The data are analysed in Bruce and Versteeg (1992) using a log-normal 27 | dose-response model (using the logarithm with base 10). 28 | } 29 | 30 | \source{ 31 | Bruce, R. D. and Versteeg, D. J. (1992) A statistical procedure for modeling continuous toxicity data, 32 | \emph{Environ. Toxicol. Chem.}, \bold{11}, 1485--1494. 33 | } 34 | 35 | %\references{} 36 | 37 | \examples{ 38 | 39 | ## Model with ED50 on log scale as parameter 40 | p.prom.m1<-drm(dryweight~conc, data=P.promelas, fct=LN.3()) 41 | 42 | plot(fitted(p.prom.m1), residuals(p.prom.m1)) 43 | 44 | plot(p.prom.m1, type="all", broken=TRUE, xlim=c(0,1000)) 45 | summary(p.prom.m1) 46 | ED(p.prom.m1, c(10,20,50), interval="delta") 47 | 48 | ## Model with ED50 as parameter 49 | p.prom.m2<-drm(dryweight~conc, data=P.promelas, fct=LN.3(loge=TRUE)) 50 | summary(p.prom.m2) 51 | ED(p.prom.m2, c(10,20,50), interval="fls") 52 | 53 | } 54 | \keyword{datasets} 55 | -------------------------------------------------------------------------------- /man/PR.Rd: -------------------------------------------------------------------------------- 1 | \name{PR} 2 | 3 | \alias{PR} 4 | 5 | \title{Expected or predicted response} 6 | 7 | \description{ 8 | The function returns the expected or predicted response for specified dose values. 9 | } 10 | 11 | \usage{ 12 | PR(object, xVec, ...) 13 | } 14 | 15 | \arguments{ 16 | \item{object}{object of class \code{drc} obtaining fitting a dose-response model.} 17 | \item{xVec}{numeric vector of dose values.} 18 | \item{\dots}{additional arguments to be supplied to \code{\link[drc]{predict.drc}}. No effect at the moment.} 19 | } 20 | 21 | \details{ 22 | This function is a convenience function for easy access to predicted values. 23 | } 24 | 25 | \value{ 26 | A numeric vector of predicted values or possibly a matrix of predicted values and corresponding standard errors. 27 | } 28 | 29 | %\references{} 30 | 31 | \author{ 32 | Christian Ritz after a suggestion from Andrew Kniss. 33 | } 34 | 35 | %\note{ ~~further notes~~ } 36 | 37 | \seealso{Predictions can also be obtained using \code{\link[drc]{predict.drc}}.} 38 | 39 | \examples{ 40 | 41 | ryegrass.m1 <- drm(ryegrass, fct = LL.4()) 42 | PR(ryegrass.m1, c(5, 10)) 43 | 44 | ryegrass.m2 <- drm(ryegrass, fct = LL2.4()) 45 | PR(ryegrass.m2, c(5, 10)) 46 | 47 | spinach.m1 <- drm(SLOPE~DOSE, CURVE, data=spinach, fct = LL.4()) 48 | PR(spinach.m1, c(5, 10)) 49 | 50 | } 51 | % Add one or more standard keywords, see file 'KEYWORDS' in the 52 | % R documentation directory. 53 | \keyword{models} 54 | \keyword{nonlinear} 55 | -------------------------------------------------------------------------------- /man/RScompetition.Rd: -------------------------------------------------------------------------------- 1 | \name{RScompetition} 2 | 3 | \alias{RScompetition} 4 | 5 | \docType{data} 6 | 7 | \title{Competition between two biotypes} 8 | 9 | \description{ 10 | To assess the competitive ability between two biotypes of \emph{Lolium rigidum}, one resistant to glyphosate 11 | and the other a sensitive wild type, the density of resistant and sensitive biotypes was counted after 12 | germination. 13 | } 14 | 15 | \usage{data(RScompetition)} 16 | 17 | \format{ 18 | A data frame with 49 observations on the following 3 variables. 19 | \describe{ 20 | \item{\code{z}}{a numeric vector with densities of the resistant biotype (plants/m2)} 21 | \item{\code{x}}{a numeric vector with densities of the sensitive biotype (plants/m2)} 22 | \item{\code{biomass}}{a numeric vector of biomass weight (g/plant)} 23 | } 24 | } 25 | 26 | \details{ 27 | A hyperbolic model (Jensen, 1993) is describing the data reasonably well. 28 | } 29 | 30 | \source{ 31 | The dataset is from Pedersen et al (2007). 32 | } 33 | 34 | \references{ 35 | Jensen, J. E. (1993) Fitness of herbicide-resistant weed biotypes described by competition models, 36 | \emph{Proceedings of the 8th EWRS Symposium, 14-16 June, Braunschweig, Germany}, 37 | \bold{1}, 25--32. 38 | 39 | Pedersen, B. P. and Neve, P. and Andreasen, C. and Powles, S. (2007) Ecological fitness of a glyphosate 40 | resistant \emph{Lolium rigidum} population: Growth and seed production along a competition gradient, 41 | \emph{Basic and Applied Ecology}, \bold{8}, 258--268. 42 | } 43 | 44 | %\examples{} 45 | 46 | \keyword{datasets} 47 | -------------------------------------------------------------------------------- /man/S.alba.Rd: -------------------------------------------------------------------------------- 1 | \name{S.alba} 2 | 3 | \alias{S.alba} 4 | 5 | \docType{data} 6 | 7 | \title{Potency of two herbicides} 8 | 9 | \description{ 10 | Data are from an experiment, comparing the potency of the two herbicides glyphosate and bentazone in 11 | white mustard \emph{Sinapis alba}. 12 | } 13 | 14 | \usage{data(S.alba)} 15 | 16 | \format{ 17 | A data frame with 68 observations on the following 3 variables. 18 | \describe{ 19 | \item{\code{Dose}}{a numeric vector containing the dose in g/ha.} 20 | \item{\code{Herbicide}}{a factor with levels \code{Bentazone} \code{Glyphosate} (the two herbicides applied).} 21 | \item{\code{DryMatter}}{a numeric vector containing the response (dry matter in g/pot).} 22 | } 23 | } 24 | 25 | \details{ 26 | The lower and upper limits for the two herbicides can be assumed identical, whereas slopes and ED50 values 27 | are different (in the log-logistic model). 28 | } 29 | 30 | \source{ 31 | Christensen, M. G. and Teicher, H. B., and Streibig, J. C. (2003) Linking fluorescence 32 | induction curve and biomass in herbicide screening, \emph{Pest Management Science}, 33 | \bold{59}, 1303--1310. 34 | } 35 | 36 | \seealso{ 37 | See the examples sections for \code{\link{drm}} and \code{\link{EDcomp}}. 38 | } 39 | 40 | \examples{ 41 | 42 | ## Fitting a log-logistic model with 43 | ## common lower and upper limits 44 | S.alba.LL.4.1 <- drm(DryMatter~Dose, Herbicide, data=S.alba, fct = LL.4(), 45 | pmodels=data.frame(Herbicide,1,1,Herbicide)) 46 | summary(S.alba.LL.4.1) 47 | 48 | ## Applying the optimal transform-both-sides Box-Cox transformation 49 | ## (using the initial model fit) 50 | S.alba.LL.4.2 <- boxcox(S.alba.LL.4.1, method = "anova") 51 | summary(S.alba.LL.4.2) 52 | 53 | ## Plotting fitted regression curves together with the data 54 | plot(S.alba.LL.4.2) 55 | 56 | } 57 | \keyword{datasets} 58 | -------------------------------------------------------------------------------- /man/S.capricornutum.Rd: -------------------------------------------------------------------------------- 1 | \name{S.capricornutum} 2 | 3 | \alias{S.capricornutum} 4 | 5 | \docType{data} 6 | 7 | \title{Effect of cadmium on growth of green alga} 8 | 9 | \description{ 10 | Green alga (\emph{Selenastrum capricornutum}) was exposed to cadmium chloride concentrations 11 | ranging from 5 to 80 micro g/L in geometric progression in 4-day population growth test. 12 | } 13 | 14 | \usage{data(S.capricornutum)} 15 | 16 | \format{ 17 | A data frame with 18 observations on the following 2 variables. 18 | \describe{ 19 | \item{\code{conc}}{a numeric vector of cadmium chloride concentrations (micro g/L)} 20 | \item{\code{count}}{a numeric vector of algal counts (10000 x cells /ml)} 21 | } 22 | } 23 | 24 | \details{ 25 | The data are analysed in Bruce and Versteeg (1992) using a log-normal 26 | dose-response model (using the logarithm with base 10). 27 | } 28 | 29 | \source{ 30 | Bruce, R. D. and Versteeg, D. J. (1992) A statistical procedure for modeling continuous toxicity data, 31 | \emph{Environ. Toxicol. Chem.}, \bold{11}, 1485--1494. 32 | } 33 | 34 | %\references{} 35 | 36 | \examples{ 37 | 38 | ## Fitting 3-parameter log-normal model 39 | s.cap.m1 <- drm(count ~ conc, data = S.capricornutum, fct = LN.3()) 40 | 41 | ## Residual plot 42 | plot(fitted(s.cap.m1), residuals(s.cap.m1)) 43 | 44 | ## Fitting model with transform-both-sides approach 45 | s.cap.m2 <- boxcox(s.cap.m1, method = "anova") 46 | summary(s.cap.m2) 47 | 48 | ## Residual plot after transformation (looks better) 49 | plot(fitted(s.cap.m2), residuals(s.cap.m2)) 50 | 51 | ## Calculating ED values on log scale 52 | ED(s.cap.m2, c(10, 20, 50), interval="delta") 53 | 54 | ## Fitting model with ED50 as parameter 55 | ## (for comparison) 56 | s.cap.m3 <- drm(count ~ conc, data = S.capricornutum, fct = LN.3(loge=TRUE)) 57 | s.cap.m4 <- boxcox(s.cap.m3, method = "anova") 58 | summary(s.cap.m4) 59 | ED(s.cap.m4, c(10, 20, 50), interval = "fls") 60 | 61 | } 62 | \keyword{datasets} 63 | -------------------------------------------------------------------------------- /man/W2.Rd: -------------------------------------------------------------------------------- 1 | \name{W1.2} 2 | 3 | \alias{W1.2} 4 | \alias{w2} 5 | \alias{W2.2} 6 | 7 | \title{The two-parameter Weibull functions} 8 | 9 | \description{ 10 | 'W1.2' is the two-parameter Weibull function where the lower limit is fixed at 0 and the upper limit 11 | is fixed at 1, mostly suitable for binomial/quantal responses. 12 | } 13 | 14 | \usage{ 15 | W1.2(upper = 1, fixed = c(NA, NA), names = c("b", "e"), ...) 16 | 17 | W2.2(upper = 1, fixed = c(NA, NA), names = c("b", "e"), ...) 18 | } 19 | 20 | \arguments{ 21 | \item{upper}{numeric value. The fixed, upper limit in the model. Default is 1.} 22 | \item{fixed}{numeric vector. Specifies which parameters are fixed and at what value they are fixed. 23 | NAs for parameter that are not fixed.} 24 | \item{names}{a vector of character strings giving the names of the parameters. The default is reasonable.} 25 | \item{...}{additional arguments to be passed from the convenience functions.} 26 | } 27 | 28 | \details{ 29 | The two-parameter Weibull model is given by the expression 30 | \deqn{ f(x) = \exp(-\exp(b(\log(x)-e))).} 31 | 32 | The function is asymmetric about the inflection point, that is the parameter \eqn{\exp(e)}. 33 | } 34 | 35 | \value{ 36 | See \code{\link{weibull1}}. 37 | } 38 | 39 | %\references{ ~put references to the literature/web site here ~ } 40 | 41 | \author{Christian Ritz} 42 | 43 | \note{ 44 | This function is for use with the function \code{\link{drm}}. 45 | } 46 | 47 | \seealso{ 48 | Related functions are \code{\link{W1.3}}, \code{\link{W1.4}}, \code{\link{weibull1}} and \code{\link{weibull2}}. 49 | } 50 | 51 | \examples{ 52 | 53 | ## Fitting a two-parameter Weibull model 54 | earthworms.m1 <- drm(number/total~dose, weights = total, 55 | data = earthworms, fct = W1.2(), type = "binomial") 56 | 57 | summary(earthworms.m1) 58 | 59 | } 60 | \keyword{models} 61 | \keyword{nonlinear} 62 | -------------------------------------------------------------------------------- /man/W3.Rd: -------------------------------------------------------------------------------- 1 | \name{W1.3} 2 | 3 | \alias{W1.3} 4 | \alias{w3} 5 | \alias{W2.3} 6 | \alias{W2x.3} 7 | 8 | \alias{W1.3u} 9 | \alias{W2.3u} 10 | 11 | \title{The three-parameter Weibull functions} 12 | 13 | \description{ 14 | 'W1.3' and \code{W2.3} provide the three-parameter Weibull function, self starter function and names of the parameters. 15 | 16 | 'W1.3u' and 'W2.3u' provide three-parameter Weibull function where the upper limit is equal to 1, mainly 17 | for use with binomial/quantal response. 18 | } 19 | 20 | \usage{ 21 | W1.3(fixed = c(NA, NA, NA), names = c("b", "d", "e"), ...) 22 | 23 | W2.3(fixed = c(NA, NA, NA), names = c("b", "d", "e"), ...) 24 | 25 | W2x.3(fixed = c(NA, NA, NA), names = c("d", "e", "t0"), ...) 26 | 27 | W1.3u(upper = 1, fixed = c(NA, NA, NA), names = c("b", "c", "e"), ...) 28 | 29 | W2.3u(upper = 1, fixed = c(NA, NA, NA), names = c("b", "c", "e"), ...) 30 | } 31 | 32 | \arguments{ 33 | \item{upper}{numeric value. The fixed, upper limit in the model. Default is 1.} 34 | \item{fixed}{numeric vector. Specifies which parameters are fixed and at what value they are fixed. 35 | NAs for parameter that are not fixed.} 36 | \item{names}{a vector of character strings giving the names of the parameters. The default is reasonable.} 37 | \item{...}{additional arguments to be passed from the convenience functions.} 38 | } 39 | 40 | \details{ 41 | The three-parameter Weibull model is given by the expression 42 | \deqn{ f(x) = 0 + (d-0)\exp(-\exp(b(\log(x)-e))).} 43 | 44 | The function is asymmetric about the inflection point, that is the parameter \eqn{\exp(e)}. 45 | 46 | The three-parameter Weibull model with upper limit 1 is given by the expression 47 | \deqn{ f(x) = 0 + (1-0)\exp(-\exp(b(\log(x)-e))).} 48 | 49 | } 50 | 51 | \value{ 52 | See \code{\link{weibull1}}. 53 | } 54 | 55 | %\references{ ~put references to the literature/web site here ~ } 56 | 57 | \author{Christian Ritz} 58 | 59 | \note{This function is for use with the function \code{\link{drm}}.} 60 | 61 | \seealso{Related functions are \code{\link{W1.4}} and \code{\link{weibull1}}.} 62 | 63 | \examples{ 64 | 65 | ## Fitting a three-parameter Weibull model 66 | ryegrass.m1 <- drm(rootl ~ conc, data = ryegrass, fct = W1.3()) 67 | ryegrass.m1 68 | 69 | } 70 | \keyword{models} 71 | \keyword{nonlinear} 72 | -------------------------------------------------------------------------------- /man/acidiq.Rd: -------------------------------------------------------------------------------- 1 | \name{acidiq} 2 | 3 | \alias{acidiq} 4 | 5 | \docType{data} 6 | 7 | \title{Acifluorfen and diquat tested on Lemna minor.} 8 | 9 | \description{ 10 | Data from an experiment where the chemicals acifluorfen and diquat tested on Lemna minor. The dataset has 7 mixtures used in 11 | 8 dilutions with three replicates and 12 common controls, in total 180 observations. 12 | } 13 | 14 | \usage{data(acidiq)} 15 | 16 | \format{ 17 | A data frame with 180 observations on the following 3 variables. 18 | \describe{ 19 | \item{\code{dose}}{a numeric vector of dose values} 20 | \item{\code{pct}}{a numeric vector denoting the grouping according to the mixtures percentages} 21 | \item{\code{rgr}}{a numeric vector of response values (relative growth rates)} 22 | } 23 | } 24 | 25 | \details{ 26 | The dataset is analysed in Soerensen et al (2007). 27 | Hewlett's symmetric model seems appropriate for this dataset. 28 | } 29 | 30 | \source{ 31 | The dataset is kindly provided by Nina Cedergreen, Department of Agricultural Sciences, 32 | Royal Veterinary and Agricultural University, Denmark. 33 | } 34 | 35 | \references{ 36 | Soerensen, H. and Cedergreen, N. and Skovgaard, I. M. and Streibig, J. C. (2007) 37 | An isobole-based statistical model and test for synergism/antagonism in binary mixture toxicity experiments, 38 | \emph{Environmental and Ecological Statistics}, \bold{14}, 383--397. 39 | } 40 | 41 | \examples{ 42 | 43 | ## Fitting the model with freely varying ED50 values 44 | ## Ooops: Box-Cox transformation is needed 45 | acidiq.free <- drm(rgr ~ dose, pct, data = acidiq, fct = LL.4(), 46 | pmodels = list(~factor(pct), ~1, ~1, ~factor(pct) - 1)) 47 | 48 | ## Lack-of-fit test 49 | modelFit(acidiq.free) 50 | summary(acidiq.free) 51 | 52 | ## Plotting isobole structure 53 | isobole(acidiq.free, xlim = c(0, 400), ylim = c(0, 450)) 54 | 55 | ## Fitting the concentration addition model 56 | acidiq.ca <- mixture(acidiq.free, model = "CA") 57 | 58 | ## Comparing to model with freely varying e parameter 59 | anova(acidiq.ca, acidiq.free) # rejected 60 | 61 | ## Plotting isobole based on concentration addition -- poor fit 62 | isobole(acidiq.free, acidiq.ca, xlim = c(0, 420), ylim = c(0, 450)) # poor fit 63 | 64 | ## Fitting the Hewlett model 65 | acidiq.hew <- mixture(acidiq.free, model = "Hewlett") 66 | 67 | ## Comparing to model with freely varying e parameter 68 | anova(acidiq.free, acidiq.hew) # accepted 69 | summary(acidiq.hew) 70 | 71 | ## Plotting isobole based on the Hewlett model 72 | isobole(acidiq.free, acidiq.hew, xlim = c(0, 400), ylim = c(0, 450)) # good fit 73 | 74 | } 75 | \keyword{datasets} 76 | -------------------------------------------------------------------------------- /man/algae.Rd: -------------------------------------------------------------------------------- 1 | \name{algae} 2 | 3 | \alias{algae} 4 | 5 | \docType{data} 6 | 7 | \title{Volume of algae as function of increasing concentrations of a herbicide} 8 | 9 | \description{ 10 | Dataset from an experiment exploring the effect of increasing concentrations of a herbicide on 11 | the volume of the treated algae. 12 | } 13 | 14 | \usage{data(algae)} 15 | 16 | \format{ 17 | A data frame with 14 observations on the following 2 variables. 18 | \describe{ 19 | \item{\code{conc}}{a numeric vector of concentrations.} 20 | \item{\code{vol}}{a numeric vector of response values, that is relative change in volume.} 21 | } 22 | } 23 | 24 | \details{ 25 | This datasets requires a cubic root transformation in order to stabilise the variance. 26 | } 27 | 28 | \source{ 29 | Meister, R. and van den Brink, P. (2000) 30 | \emph{The Analysis of Laboratory Toxicity Experiments}, 31 | Chapter 4 in \emph{Statistics in Ecotoxicology}, Editor: T. Sparks, 32 | New York: John Wiley \& Sons, (pp. 114--116). 33 | } 34 | 35 | %\references{} 36 | 37 | \examples{ 38 | 39 | algae.m1 <- drm(vol~conc, data=algae, fct=LL.3()) 40 | summary(algae.m1) 41 | 42 | algae.m2 <- boxcox(algae.m1) 43 | summary(algae.m2) 44 | 45 | } 46 | \keyword{datasets} 47 | -------------------------------------------------------------------------------- /man/anova.drc.Rd: -------------------------------------------------------------------------------- 1 | \name{anova.drc} 2 | 3 | \alias{anova.drc} 4 | 5 | \title{ANOVA for dose-response model fits} 6 | 7 | \description{ 8 | 'anova' produces an analysis of variance table for one or two non-linear model fits. 9 | } 10 | 11 | \usage{ 12 | 13 | \method{anova}{drc}(object, ..., details = TRUE, test = NULL) 14 | } 15 | 16 | \arguments{ 17 | \item{object}{an object of class 'drc'.} 18 | \item{...}{additional arguments.} 19 | \item{details}{logical indicating whether or not details on the models compared should be displayed. 20 | Default is TRUE (details are displayed).} 21 | \item{test}{a character string specifying the test statistic to be applied. 22 | Use "od" to assess overdispersion for binomial data.} 23 | } 24 | 25 | \details{ 26 | Specifying only a single object gives a test for lack-of-fit, comparing the non-linear regression 27 | model to a more general one-way or two-way ANOVA model. 28 | 29 | If two objects are specified a test for reduction from the larger to the smaller model is given. (This only makes statistical 30 | sense if the models are nested, that is: one model is a submodel of the other model.) 31 | } 32 | 33 | \value{ 34 | An object of class 'anova'. 35 | } 36 | 37 | \references{ 38 | Bates, D. M. and Watts, D. G. (1988) 39 | \emph{Nonlinear Regression Analysis and Its Applications}, 40 | New York: Wiley \& Sons (pp. 103--104) 41 | } 42 | 43 | \author{Christian Ritz} 44 | 45 | \seealso{ 46 | For comparison of nested or non-nested model the function \code{\link{mselect}}can also be used. 47 | 48 | The function \code{\link{anova.lm}} for linear models. 49 | } 50 | 51 | \examples{ 52 | 53 | ## Comparing a Gompertz three- and four-parameter models using an F test 54 | ryegrass.m1 <- drm(rootl ~ conc, data = ryegrass, fct = W1.4()) 55 | ryegrass.m2 <- drm(rootl ~ conc, data = ryegrass, fct = W1.3()) 56 | anova(ryegrass.m2, ryegrass.m1) # reduction to 'W1.3' not possible (highly significant) 57 | 58 | anova(ryegrass.m2, ryegrass.m1, details = FALSE) # without details 59 | 60 | } 61 | \keyword{models} 62 | \keyword{nonlinear} 63 | 64 | \concept{extra sum-of-squares F-test} 65 | \concept{approximate F-test} -------------------------------------------------------------------------------- /man/backfit.Rd: -------------------------------------------------------------------------------- 1 | \name{backfit} 2 | 3 | \alias{backfit} 4 | 5 | \title{ 6 | Calculation of backfit values from a fitted dose-response model 7 | } 8 | 9 | \description{ 10 | By inverse regression backfitted dose values are calculated for the mean response per dose. 11 | } 12 | 13 | \usage{ 14 | backfit(drcObject) 15 | } 16 | 17 | \arguments{ 18 | \item{drcObject}{an object of class 'drc'.} 19 | } 20 | 21 | \value{ 22 | Two columns with the original dose values and the corresponding backfitted values using the fitted dose-response model. 23 | For extreme dose values (e.g., high dose ) the backfitted values may not be well-defined (see the example below). 24 | } 25 | 26 | \references{ 27 | ?? 28 | } 29 | 30 | \author{ 31 | Christian Ritz after a suggestion from Keld Sorensen. 32 | } 33 | 34 | \seealso{ 35 | A related function is \code{\link{ED.drc}}. 36 | } 37 | 38 | \examples{ 39 | 40 | ryegrass.LL.4 <- drm(rootl~conc, data=ryegrass, fct=LL.4()) 41 | 42 | backfit(ryegrass.LL.4) 43 | 44 | } 45 | 46 | \keyword{models} 47 | \keyword{nonlinear} 48 | -------------------------------------------------------------------------------- /man/barley.Rd: -------------------------------------------------------------------------------- 1 | \name{leaflength} 2 | 3 | \alias{leaflength} 4 | 5 | \docType{data} 6 | 7 | \title{Leaf length of barley} 8 | 9 | \description{ 10 | In an experiment barley was grown in a hydroponic solution with a herbicide. 11 | } 12 | 13 | \usage{data(leaflength)} 14 | 15 | \format{ 16 | A data frame with 42 observations on the following 2 variables. 17 | \describe{ 18 | \item{\code{Dose}}{a numeric vector} 19 | \item{\code{DW}}{a numeric vector} 20 | } 21 | } 22 | 23 | \details{ 24 | The dataset exhibits a large hormetical effect. 25 | } 26 | 27 | \source{ 28 | Nina Cedergreen, Royal Veterinary and Agricultural University, Denmark. 29 | } 30 | 31 | %\references{} 32 | 33 | \examples{ 34 | 35 | ## Fitting a hormesis model 36 | leaflength.crs4c1 <- drm(DW ~ Dose, data = leaflength, fct = CRS.4c()) 37 | plot(fitted(leaflength.crs4c1), residuals(leaflength.crs4c1)) 38 | 39 | leaflength.crs4c2 <- boxcox(drm(DW ~ Dose, data = leaflength, fct = CRS.4c()), 40 | method = "anova", plotit = FALSE) 41 | summary(leaflength.crs4c2) 42 | 43 | ## Plottinf fitted curve and original data 44 | plot(leaflength.crs4c2, broken = TRUE, conLevel = 0.001, type = "all", legend = FALSE, 45 | ylab = "Produced leaf length (cm)", xlab = "Metsulfuron-methyl (mg/l)", 46 | main = "Hormesis: leaf length of barley") 47 | 48 | } 49 | \keyword{datasets} 50 | -------------------------------------------------------------------------------- /man/baro5.Rd: -------------------------------------------------------------------------------- 1 | \name{baro5} 2 | 3 | \alias{baro5} 4 | 5 | \title{The modified baro5 function} 6 | 7 | \description{ 8 | 'baro5' allows specification of the baroreflex 5-parameter dose response function, 9 | under various constraints on the parameters. 10 | } 11 | 12 | \usage{ 13 | baro5(fixed = c(NA, NA, NA, NA, NA), names = c("b1", "b2", "c", "d", "e"), 14 | method = c("1", "2", "3", "4"), ssfct = NULL) 15 | } 16 | 17 | \arguments{ 18 | \item{fixed}{numeric vector. Specifies which parameters are fixed and at what value they are fixed. 19 | NAs for parameter that are not fixed.} 20 | \item{names}{a vector of character strings giving the names of the parameters (should not contain ":"). 21 | The order of the parameters is: b1, b2, c, d, e (see under 'Details').} 22 | \item{method}{character string indicating the self starter function to use.} 23 | \item{ssfct}{a self starter function to be used.} 24 | } 25 | 26 | \details{ 27 | The five-parameter function given by the expression 28 | 29 | \deqn{ y = c + \frac{d-c}{1+f\exp(b1(\log(x)-\log(e))) + (1-f)\exp(b2(\log(x)-\log(e)))}} 30 | 31 | \deqn{ f = 1/( 1 + \exp((2b1b2/|b1+b2|)(\log(x)-\log(e))))} 32 | 33 | If the difference between the parameters b1 and b2 is different from 0 then the function is asymmetric. 34 | } 35 | 36 | \value{ 37 | The value returned is a list containing the nonlinear model function, the self starter function 38 | and the parameter names. 39 | } 40 | 41 | \references{ 42 | Ricketts, J. H. and Head, G. A. (1999) 43 | A five-parameter logistic equation for investigating asymmetry of curvature in baroreflex studies. 44 | \emph{Am. J. Physiol. (Regulatory Integrative Comp. Physiol. 46)}, \bold{277}, 441--454. 45 | } 46 | 47 | \author{Christian Ritz} 48 | 49 | \note{See the example for the dataset \code{\link{heartrate}}.} 50 | 51 | %\examples{} 52 | 53 | \keyword{models} 54 | \keyword{nonlinear} 55 | -------------------------------------------------------------------------------- /man/boxcox.drc.Rd: -------------------------------------------------------------------------------- 1 | \name{boxcox.drc} 2 | 3 | \alias{boxcox.drc} 4 | 5 | \title{Transform-both-sides Box-Cox transformation} 6 | 7 | \description{ 8 | Finds the optimal Box-Cox transformation for non-linear regression. 9 | } 10 | 11 | \usage{ 12 | \method{boxcox}{drc}(object, lambda = seq(-2, 2, by = 0.25), plotit = TRUE, bcAdd = 0, 13 | method = c("ml", "anova"), level = 0.95, eps = 1/50, 14 | xlab = expression(lambda), ylab = "log-Likelihood", ...) 15 | } 16 | 17 | \arguments{ 18 | \item{object}{object of class \code{drc}.} 19 | \item{lambda}{numeric vector of lambda values; the default is (-2, 2) in steps of 0.25.} 20 | \item{plotit}{logical which controls whether the result should be plotted.} 21 | \item{bcAdd}{numeric value specifying the constant to be added on both sides prior to Box-Cox transformation. 22 | The default is 0.} 23 | \item{method}{character string specifying the estimation method for lambda: maximum likelihood or ANOVA-based 24 | (optimal lambda inherited from more general ANOVA model fit.} 25 | \item{eps}{numeric value: the tolerance for lambda = 0; defaults to 0.02.} 26 | \item{level}{numeric value: the confidence level required.} 27 | \item{xlab}{character string: the label on the x axis, defaults to "lambda".} 28 | \item{ylab}{character string: the label on the y axis, defaults to "log-likelihood".} 29 | \item{\dots}{additional graphical parameters.} 30 | } 31 | 32 | \details{ 33 | The optimal lambda value is determined using a profile likelihood approach: 34 | For each lambda value the dose-response regression model is fitted and the lambda value (and corresponding model fit) resulting in the largest 35 | value of the log likelihood function is chosen. 36 | } 37 | 38 | \value{ 39 | An object of class "drc" (returned invisibly). 40 | If plotit = TRUE a plot of loglik vs lambda is shown indicating a confidence interval (by default 95%) about 41 | the optimal lambda value. 42 | } 43 | 44 | \references{ 45 | Carroll, R. J. and Ruppert, D. (1988) \emph{Transformation and Weighting in Regression}, 46 | New York: Chapman and Hall (Chapter 4). 47 | } 48 | 49 | \author{Christian Ritz} 50 | 51 | %\note{} 52 | 53 | \seealso{ 54 | For linear regression the analogue is \code{\link[MASS]{boxcox}}. 55 | } 56 | 57 | \examples{ 58 | 59 | ## Fitting log-logistic model without transformation 60 | ryegrass.m1 <- drm(ryegrass, fct = LL.4()) 61 | summary(ryegrass.m1) 62 | 63 | ## Fitting the same model with the optimal Box-Cox transformation 64 | ryegrass.m2 <- boxcox(ryegrass.m1) 65 | summary(ryegrass.m2) 66 | 67 | } 68 | 69 | \keyword{models} 70 | \keyword{nonlinear} 71 | -------------------------------------------------------------------------------- /man/braincousens.Rd: -------------------------------------------------------------------------------- 1 | \name{braincousens} 2 | 3 | \alias{braincousens} 4 | 5 | \title{The Brain-Cousens hormesis models} 6 | 7 | \description{ 8 | 'braincousens' provides a very general way of specifying Brain-Cousens' 9 | modified log- logistic model for describing hormesis, under various constraints on the parameters. 10 | } 11 | 12 | \usage{ 13 | braincousens(fixed = c(NA, NA, NA, NA, NA), 14 | names = c("b", "c", "d", "e", "f"), 15 | method = c("1", "2", "3", "4"), ssfct = NULL, 16 | fctName, fctText) 17 | } 18 | 19 | \arguments{ 20 | \item{fixed}{numeric vector. Specifies which parameters are fixed and at what value they are fixed. 21 | NAs for parameter that are not fixed.} 22 | \item{names}{a vector of character strings giving the names of the parameters (should not contain ":"). 23 | The default is reasonable (see under 'Usage'). The order of the parameters is: b, c, d, e, f (see under 'Details').} 24 | \item{method}{character string indicating the self starter function to use.} 25 | \item{ssfct}{a self starter function to be used.} 26 | \item{fctName}{optional character string used internally by convenience functions.} 27 | \item{fctText}{optional character string used internally by convenience functions.} 28 | } 29 | 30 | \details{ 31 | The Brain-Cousens model is given by the expression 32 | \deqn{ f(x) = c + \frac{d-c+fx}{1+\exp(b(\log(x)-\log(e)))}} 33 | which is a five-parameter model. 34 | 35 | It is a modification of the four-parameter logistic curve to take hormesis into account proposed 36 | by Brain and Cousens (1989). 37 | } 38 | 39 | \value{ 40 | The value returned is a list containing the non-linear function, the self starter function, 41 | the parameter names and additional model specific objects. 42 | } 43 | 44 | \references{ 45 | Brain, P. and Cousens, R. (1989) An equation to describe dose responses 46 | where there is stimulation of growth at low doses, 47 | \emph{Weed Research}, \bold{29}, 93--96. 48 | } 49 | 50 | \author{Christian Ritz} 51 | 52 | \note{ 53 | This function is for use with the function \code{\link{drm}}. 54 | 55 | The convenience functions of \code{braincousens} are \code{\link{BC.4}} and \code{\link{BC.5}}. These functions 56 | should be used rather than \code{braincousens} directly. 57 | } 58 | 59 | %\seealso{} 60 | 61 | %\examples{} 62 | 63 | \keyword{models} 64 | \keyword{nonlinear} 65 | 66 | \concept{hormesis hormetic effect initial stimulation} 67 | -------------------------------------------------------------------------------- /man/bread.drc.Rd: -------------------------------------------------------------------------------- 1 | \name{bread.drc} 2 | 3 | \alias{bread.drc} 4 | \alias{estfun.drc} 5 | 6 | \title{Bread and meat for the sandwich} 7 | 8 | \description{ 9 | Bread and meat for the sandwich estimator of the variance-covariance. 10 | } 11 | 12 | \usage{ 13 | bread.drc(x, ...) 14 | 15 | estfun.drc(x, ...) 16 | } 17 | 18 | \arguments{ 19 | \item{x}{object of class \code{drc}} 20 | \item{\dots}{additional arguments. At the moment none are supported} 21 | } 22 | 23 | \details{ 24 | The details are provided by Zeileis (2006). 25 | } 26 | 27 | \value{ 28 | The unscaled hessian is returned by \code{bread.drc}, whereas \code{estfun.drc} 29 | returns the estimating function evaluated at the data and the parameter estimates. 30 | 31 | By default no clustering is assumed, corresponding to robust standard errors under independence. 32 | If a cluster variable is provided the log likelihood contributions provided by \code{estfun} 33 | are summed up for each cluster. 34 | } 35 | 36 | \references{ 37 | Zeileis, A. (2006) Object-oriented Computation of Sandwich Estimators, 38 | \emph{J. Statist. Software}, \bold{16}, Issue 9. 39 | } 40 | 41 | \author{Christian Ritz} 42 | 43 | %\note{} 44 | 45 | %\seealso{For other applications see \code{\link[sandwich]{sandwich}}.} 46 | 47 | \examples{ 48 | 49 | ## The lines below requires that the packages 50 | ## 'lmtest' and 'sandwich' are installed 51 | # library(lmtest) 52 | # library(sandwich) 53 | 54 | # ryegrass.m1<-drm(rootl ~ conc, data = ryegrass, fct = LL.4()) 55 | 56 | # Standard summary output 57 | # coeftest(ryegrass.m1) 58 | 59 | # Output with robust standard errors 60 | # coeftest(ryegrass.m1, vcov = sandwich) 61 | 62 | } 63 | 64 | \keyword{models} 65 | \keyword{nonlinear} 66 | -------------------------------------------------------------------------------- /man/coef.drc.Rd: -------------------------------------------------------------------------------- 1 | \name{coef.drc} 2 | 3 | \alias{coef.drc} 4 | 5 | \title{Extract Model Coefficients} 6 | 7 | \description{ 8 | Extract parameter estimates. 9 | } 10 | 11 | \usage{ 12 | 13 | \method{coef}{drc}(object, ...) 14 | } 15 | 16 | \arguments{ 17 | \item{object}{an object of class 'drc'.} 18 | \item{...}{additional arguments.} 19 | } 20 | 21 | \value{ 22 | A vector of parameter coefficients which are extracted from the model object 'object'. 23 | } 24 | 25 | \author{Christian Ritz} 26 | 27 | \note{This function may work even in cases where 'summary' does not, because the parameter estimates 28 | are retrieved directly from the model fit object without any additional computations of summary statistics and standard errors.} 29 | 30 | 31 | \seealso{A more comprehensive summary is obtained using \code{\link{summary.drc}}.} 32 | 33 | \examples{ 34 | 35 | ## Fitting a four-parameter log-logistic model 36 | ryegrass.m1 <- drm(rootl ~ conc, data = ryegrass, fct = LL.4()) 37 | coef(ryegrass.m1) 38 | 39 | } 40 | \keyword{models} 41 | \keyword{nonlinear} 42 | -------------------------------------------------------------------------------- /man/compParm.Rd: -------------------------------------------------------------------------------- 1 | \name{compParm} 2 | 3 | \alias{compParm} 4 | 5 | \title{Comparison of parameters} 6 | 7 | \description{ 8 | Compare parameters from different assays, either by means of ratios or differences. 9 | } 10 | 11 | \usage{ 12 | compParm(object, strVal, operator = "/", vcov. = vcov, od = FALSE, 13 | pool = TRUE, display = TRUE) 14 | } 15 | 16 | \arguments{ 17 | \item{object}{an object of class 'drc'.} 18 | \item{strVal}{a name of parameter to compare.} 19 | \item{operator}{a character. If equal to "/" (default) parameter ratios are compared. If equal to "-" parameter differences are compared.} 20 | \item{vcov.}{function providing the variance-covariance matrix. \code{\link{vcov}} is the default, 21 | but \code{sandwich} is also an option (for obtaining robust standard errors).} 22 | \item{od}{logical. If TRUE adjustment for over-dispersion is used.} 23 | \item{pool}{logical. If TRUE curves are pooled. Otherwise they are not. This argument only works for models with 24 | independently fitted curves as specified in \code{\link{drm}}.} 25 | \item{display}{logical. If TRUE results are displayed. Otherwise they are not (useful in simulations).} 26 | } 27 | 28 | \value{ 29 | A matrix with columns containing the estimates, estimated standard errors, values of t-statistics and p-values for the null hypothesis that 30 | the ratio equals 1 or that the difference equals 0 (depending on the \code{operator} argument). 31 | } 32 | 33 | \details{ 34 | The function compares actual parameter estimates, and therefore the results depend on the parameterisation used. Probably it is most useful 35 | in combination with the argument \code{collapse} in \code{\link{drm}} for specifying parameter constraints in models, either through 36 | data frames or lists with formulas without intercept (-1). 37 | } 38 | 39 | \author{Christian Ritz} 40 | 41 | \examples{ 42 | 43 | # Fitting a model with names assigned to the parameters! 44 | spinach.m1 <- drm(SLOPE~DOSE, CURVE, data = spinach, 45 | fct = LL.4(names = c("b", "lower", "upper", "ed50"))) 46 | 47 | ## Calculating ratios of parameter estimates for the parameter named "ed50" 48 | compParm(spinach.m1, "ed50") 49 | 50 | ## Calculating differences between parameter estimates for the parameter named "ed50" 51 | compParm(spinach.m1, "ed50", "-") 52 | 53 | } 54 | \keyword{models} 55 | \keyword{nonlinear} 56 | -------------------------------------------------------------------------------- /man/confint.drc.Rd: -------------------------------------------------------------------------------- 1 | \name{confint.drc} 2 | 3 | \alias{confint.drc} 4 | 5 | \title{Confidence Intervals for model parameters} 6 | 7 | \description{ 8 | Computes confidence intervals for one or more parameters in a model of class 'drc'. 9 | } 10 | 11 | \usage{ 12 | 13 | \method{confint}{drc}(object, parm, level = 0.95, pool = TRUE, ...) 14 | 15 | } 16 | 17 | \arguments{ 18 | \item{object}{a model object of class 'drc'.} 19 | \item{parm}{a specification of which parameters are to be given 20 | confidence intervals, either a vector of numbers or a vector 21 | of names. If missing, all parameters are considered.} 22 | \item{level}{the confidence level required.} 23 | % \item{type}{the type of confidence interval: based on the standard normal distribution or 24 | % based on a t-distribution (default).} 25 | \item{pool}{logical. If TRUE curves are pooled. Otherwise they are not. This argument only works for models with 26 | independently fitted curves as specified in \code{\link{drm}}.} 27 | \item{\dots}{additional argument(s) for methods. Not used.} 28 | } 29 | 30 | \details{ 31 | For binomial and Poisson data the confidence intervals are based on the normal distribution, whereas \emph{t} distributions 32 | are used of for continuous/quantitative data. 33 | } 34 | 35 | \value{ 36 | A matrix (or vector) with columns giving lower and upper confidence limits for each parameter. These will be labelled as 37 | (1-level)/2 and 1 - (1-level)/2 in % (by default 2.5% and 97.5%). 38 | } 39 | 40 | %\references{ ~put references to the literature/web site here ~ } 41 | 42 | \author{Christian Ritz} 43 | 44 | %\note{} 45 | 46 | %\seealso{} 47 | 48 | \examples{ 49 | 50 | ## Fitting a four-parameter log-logistic model 51 | ryegrass.m1 <- drm(rootl ~ conc, data = ryegrass, fct = LL.4()) 52 | 53 | ## Confidence intervals for all parameters 54 | confint(ryegrass.m1) 55 | 56 | ## Confidence interval for a single parameter 57 | confint(ryegrass.m1, "e") 58 | 59 | } 60 | \keyword{models} 61 | \keyword{nonlinear} 62 | -------------------------------------------------------------------------------- /man/daphnids.Rd: -------------------------------------------------------------------------------- 1 | \name{daphnids} 2 | 3 | \alias{daphnids} 4 | 5 | \docType{data} 6 | 7 | \title{Daphnia test} 8 | 9 | \description{ 10 | The number of immobile daphnids --in contrast to mobile daphnids-- out of a total of 20 daphnids was counted 11 | for several concentrations of a toxic substance. 12 | } 13 | 14 | \usage{data(daphnids)} 15 | 16 | \format{ 17 | A data frame with 16 observations on the following 4 variables. 18 | \describe{ 19 | \item{\code{dose}}{a numeric vector} 20 | \item{\code{no}}{a numeric vector} 21 | \item{\code{total}}{a numeric vector} 22 | \item{\code{time}}{a factor with levels \code{24h} \code{48h}} 23 | } 24 | } 25 | 26 | \details{ 27 | The same daphnids were counted at 24h and later again at 48h. 28 | } 29 | 30 | \source{ 31 | Nina Cedergreen, Faculty of Life Sciences, University of Copenhagen, Denmark. 32 | } 33 | 34 | %\references{} 35 | 36 | \examples{ 37 | 38 | ## Fitting a model with different parameters 39 | ## for different curves 40 | daphnids.m1 <- drm(no/total~dose, time, weights = total, 41 | data = daphnids, fct = LL.2(), type = "binomial") 42 | 43 | ## Goodness-of-fit test 44 | modelFit(daphnids.m1) 45 | 46 | ## Summary of the data 47 | summary(daphnids.m1) 48 | 49 | ## Fitting a model with a common intercept parameter 50 | daphnids.m2 <- drm(no/total~dose, time, weights = total, 51 | data = daphnids, fct = LL.2(), type = "binomial", 52 | pmodels = list(~1, ~time)) 53 | 54 | } 55 | \keyword{datasets} 56 | -------------------------------------------------------------------------------- /man/decontaminants.Rd: -------------------------------------------------------------------------------- 1 | \name{decontaminants} 2 | 3 | \alias{decontaminants} 4 | 5 | \docType{data} 6 | 7 | \title{ 8 | Performance of decontaminants used in the culturing of a micro-organism 9 | } 10 | 11 | \description{ 12 | The two decontaminants 1-hexadecylpyridium chloride and oxalic acid were used. Additionally there was a control group (coded as concentration 0 and only included under oxalic acid). 13 | } 14 | 15 | \usage{data("decontaminants")} 16 | \format{ 17 | A data frame with 128 observations on the following 3 variables. 18 | \describe{ 19 | \item{\code{conc}}{a numeric vector of percentage weight per volume} 20 | \item{\code{count}}{a numeric vector of numbers of M. bovis colonies at stationarity} 21 | \item{\code{group}}{a factor with levels \code{hpc} and \code{oxalic} of the decontaminants used} 22 | } 23 | } 24 | 25 | \details{ 26 | These data examplify Wadley's problem: counts where the maximum number is not known. The data were analyzed by Trajstman (1989) using a three-parameter logistic model and then re-analyzed by Morgan and Smith (1992) using a three-parameter Weibull type II model. In both cases the authors adjusted for overdispersion (in different ways). 27 | 28 | It seems that Morgan and Smith (1992) fitted separate models for the two decontaminants and using the control group for both model fits. In the example below a joint model is fitted where the control group is used once to determine a shared upper limit at concentration 0. 29 | } 30 | 31 | \source{ 32 | Trajstman, A. C. (1989) Indices for Comparing Decontaminants when Data Come from Dose-Response Survival and Contamination Experiments, \emph{Applied Statistics}, \bold{38}, 481--494. 33 | } 34 | 35 | \references{ 36 | Morgan, B. J. T. and Smith, D. M. (1992) A Note on Wadley's Problem with Overdispersion, \emph{Applied Statistics}, \bold{41}, 349--354. 37 | } 38 | 39 | \examples{ 40 | 41 | ## Wadley's problem using a three-parameter log-logistic model 42 | decon.LL.3.1 <- drm(count~conc, group, data = decontaminants, fct = LL.3(), 43 | type = "Poisson", pmodels = list(~group, ~1, ~group)) 44 | 45 | summary(decon.LL.3.1) 46 | 47 | plot(decon.LL.3.1) 48 | 49 | 50 | ## Same model fit in another parameterization (no intercepts) 51 | decon.LL.3.2 <- drm(count~conc, group, data = decontaminants, fct=LL.3(), 52 | type = "Poisson", pmodels = list(~group-1, ~1, ~group-1)) 53 | 54 | summary(decon.LL.3.2) 55 | 56 | } 57 | \keyword{datasets} 58 | -------------------------------------------------------------------------------- /man/deguelin.Rd: -------------------------------------------------------------------------------- 1 | \name{deguelin} 2 | 3 | \alias{deguelin} 4 | 5 | \docType{data} 6 | 7 | \title{Deguelin applied to chrysanthemum aphis} 8 | 9 | \description{ 10 | Quantal assay data from an experiment where the insectide deguelin was applied to 11 | \emph{Macrosiphoniella sanborni}. 12 | } 13 | \usage{data(deguelin)} 14 | 15 | \format{ 16 | A data frame with 6 observations on the following 4 variables. 17 | \describe{ 18 | \item{\code{dose}}{a numeric vector of doses applied} 19 | \item{\code{log10dose}}{a numeric vector of logarithm-transformed doses} 20 | \item{\code{r}}{a numeric vector contained number of dead insects} 21 | \item{\code{n}}{a numeric vector contained the total number of insects} 22 | } 23 | } 24 | 25 | \details{ 26 | The log-logistic model provides an inadequate fit. 27 | 28 | The dataset is used in Nottingham and Birch (2000) to illustrate a semiparametric approach to dose-response 29 | modelling. 30 | } 31 | 32 | \source{ 33 | Morgan, B. J. T. (1992) \emph{Analysis of Quantal Response Data}, London: Chapman \& Hall/CRC (Table 3.9, p. 117). 34 | } 35 | 36 | \references{ 37 | Notttingham, Q. J. and Birch, J. B. (2000) A semiparametric approach to analysing dose-response data, \emph{Statist. Med.}, \bold{19}, 389--404. 38 | } 39 | 40 | \examples{ 41 | 42 | ## Log-logistic fit 43 | deguelin.m1 <- drm(r/n~dose, weights=n, data=deguelin, fct=LL.2(), type="binomial") 44 | modelFit(deguelin.m1) 45 | summary(deguelin.m1) 46 | 47 | ## Loess fit 48 | deguelin.m2 <- loess(r/n~dose, data=deguelin, degree=1) 49 | 50 | ## Plot of data with fits superimposed 51 | plot(deguelin.m1, ylim=c(0.2,1)) 52 | lines(1:60, predict(deguelin.m2, newdata=data.frame(dose=1:60)), col = 2, lty = 2) 53 | 54 | lines(1:60, 0.95*predict(deguelin.m2, 55 | newdata=data.frame(dose=1:60))+0.05*predict(deguelin.m1, newdata=data.frame(dose=1:60), se = FALSE), 56 | col = 3, lty=3) 57 | 58 | } 59 | 60 | \keyword{datasets} 61 | -------------------------------------------------------------------------------- /man/drmc.Rd: -------------------------------------------------------------------------------- 1 | \name{drmc} 2 | 3 | \alias{drmc} 4 | 5 | \title{Sets control arguments} 6 | 7 | \description{ 8 | Set control arguments in the control argument in the function 'drm'. 9 | } 10 | 11 | \usage{ 12 | drmc(constr = FALSE, errorm = TRUE, maxIt = 500, method="BFGS", 13 | noMessage = FALSE, relTol = 1e-07, rmNA=FALSE, useD = FALSE, 14 | trace = FALSE, otrace = FALSE, warnVal = -1, dscaleThres = 1e-15, rscaleThres = 1e-15) 15 | } 16 | 17 | \arguments{ 18 | \item{constr}{logical. If TRUE optimisation is constrained, only yielding non-negative parameters.} 19 | \item{errorm}{logical specifying whether failed convergence in \code{\link{drm}} should result 20 | in an error or only a warning.} 21 | \item{maxIt}{numeric. The maximum number of iterations in the optimisation procedure.} 22 | \item{method}{character string. The method used in the optimisation procedure. 23 | See \code{\link{optim}} for available methods.} 24 | \item{noMessage}{logical, specifying whether or not messages should be displayed.} 25 | \item{relTol}{numeric. The relative tolerance in the optimisation procedure.} 26 | \item{rmNA}{logical. Should NAs be removed from sum of squares used for estimation? 27 | Default is FALSE (not removed).} 28 | \item{useD}{logical. If TRUE derivatives are used for estimation (if available).} 29 | \item{trace}{logical. If TRUE the trace from \code{\link{optim}} is displayed.} 30 | \item{otrace}{logical. If TRUE the output from \code{\link{optim}} is displayed.} 31 | \item{warnVal}{numeric. If equal to 0 then the warnings are stored and displayed at the end. 32 | See under 'warn' in \code{\link{options}}. The default results in suppression of warnings.} 33 | \item{dscaleThres}{numeric value specifying the threshold for dose scaling.} 34 | \item{rscaleThres}{numeric value specifying the threshold for response scaling.} 35 | } 36 | 37 | \value{ 38 | A list with 8 components, one for each of the above arguments. 39 | } 40 | 41 | \author{Christian Ritz} 42 | 43 | \note{ 44 | The use of a non-zero constant \code{bcAdd} may in some cases 45 | make it more difficult to obtain convergence of the estimation procedure.} 46 | 47 | %\seealso{} 48 | 49 | \examples{ 50 | 51 | ### Displaying the default settings 52 | drmc() 53 | 54 | ### Using 'method' argument 55 | model1 <- drm(ryegrass, fct = LL.4()) 56 | 57 | model2 <- drm(ryegrass, fct = LL.4(), 58 | control = drmc(method = "Nelder-Mead")) 59 | 60 | } 61 | \keyword{models} 62 | \keyword{nonlinear} 63 | -------------------------------------------------------------------------------- /man/earthworms.Rd: -------------------------------------------------------------------------------- 1 | \name{earthworms} 2 | 3 | \alias{earthworms} 4 | 5 | \docType{data} 6 | 7 | \title{Earthworm toxicity test} 8 | 9 | \description{ 10 | The dataset was obtained from a toxicity test using earthworms, and it contains the number of earthworms 11 | remaining in a container that was contaminated with a toxic substance (not disclosed) at various doses; so the number of earthworms not migrating to the neighbouring uncontaminated container. 12 | } 13 | 14 | \usage{data(earthworms)} 15 | 16 | \format{ 17 | A data frame with 35 observations on the following 3 variables. 18 | \describe{ 19 | \item{\code{dose}}{a numeric vector of dose values} 20 | \item{\code{number}}{a numeric vector containing counts of remaining earthworms in the container} 21 | \item{\code{total}}{a numeric vector containing total number of earthworms put in the containers} 22 | } 23 | } 24 | 25 | \details{ 26 | At dose 0 around half of the earthworms is expected be in each of the two containers. Thus it is not 27 | appropriate to fit an ordinary logistic regression with log(dose) as explanatory variable to these data 28 | as it implies an upper limit of 1 at dose 0 and in fact this model does not utilise the observations 29 | at dose 0 (see the example section below). 30 | } 31 | 32 | \source{ 33 | The dataset is kindly provided by Nina Cedergreen, Faculty of Life Sciences, University of Copenhagen, 34 | Denmark. 35 | } 36 | 37 | %\references{} 38 | 39 | \examples{ 40 | 41 | ## Fitting a logistic regression model 42 | earthworms.m1 <- drm(number/total~dose, weights = total, data = earthworms, 43 | fct = LL.2(), type = "binomial") 44 | modelFit(earthworms.m1) # a crude goodness-of-fit test 45 | 46 | ## Fitting an extended logistic regression model 47 | ## where the upper limit is estimated 48 | earthworms.m2 <- drm(number/total~dose, weights = total, data = earthworms, 49 | fct = LL.3(), type = "binomial") 50 | modelFit(earthworms.m2) # goodness-of-fit test 51 | # improvement not visible in test!!! 52 | 53 | ## Comparing model1 and model2 54 | ## (Can the first model be reduced to the second model?) 55 | anova(earthworms.m1, earthworms.m2) 56 | 57 | } 58 | \keyword{datasets} 59 | -------------------------------------------------------------------------------- /man/etmotc.Rd: -------------------------------------------------------------------------------- 1 | \name{etmotc} 2 | 3 | \alias{etmotc} 4 | 5 | \docType{data} 6 | 7 | \title{Effect of erythromycin on mixed sewage microorganisms} 8 | 9 | \description{ 10 | Relative growth rate in biomass of mixed sewage microorganisms (per hour) as a function of 11 | increasing concentrations of the antibiotic erythromycin (mg/l). 12 | } 13 | 14 | \usage{data(etmotc)} 15 | 16 | \format{ 17 | A data frame with 57 observations on the following 4 variables. 18 | \describe{ 19 | \item{\code{cell}}{a numeric vector} 20 | \item{\code{dose1}}{a numeric vector} 21 | \item{\code{pct1}}{a numeric vector} 22 | \item{\code{rgr1}}{a numeric vector} 23 | } 24 | } 25 | 26 | \details{ 27 | Data stem from an experiment investigating the effect of pharmaceuticals, 28 | that are used in human and veterinary medicine and that are being released into the aquatic environment through 29 | waste water or through manure used for fertilising agricultural land. The experiment constitutes a typical 30 | dose-response situation. The dose is concentration of the antibiotic erythromycin (mg/l), which is an antibiotic 31 | that can be used by persons or animals showing allergy to penicillin, and the measured response is the relative 32 | growth rate in biomass of mixed sewage microorganisms (per hour), measured as turbidity two hours after exposure 33 | by means of a spectrophotometer. The experiment was designed in such a way that eight replicates were assigned 34 | to the control (dose 0), but no replicates were assigned to the 7 non-zero doses. Further details are found in 35 | Christensen et al (2006). 36 | } 37 | 38 | \source{ 39 | Christensen, A. M. and Ingerslev, F. and Baun, A. 2006 40 | Ecotoxicity of mixtures of antibiotics used in aquacultures, 41 | \emph{Environmental Toxicology and Chemistry}, \bold{25}, 2208--2215. 42 | } 43 | 44 | %\references{} 45 | 46 | \examples{ 47 | 48 | etmotc.m1<-drm(rgr1~dose1, data=etmotc[1:15,], fct=LL.4()) 49 | plot(etmotc.m1) 50 | modelFit(etmotc.m1) 51 | summary(etmotc.m1) 52 | 53 | etmotc.m2<-drm(rgr1~dose1, data=etmotc[1:15,], fct=W2.4()) 54 | plot(etmotc.m2, add = TRUE) 55 | modelFit(etmotc.m2) 56 | summary(etmotc.m2) 57 | 58 | etmotc.m3<-drm(rgr1~dose1, data=etmotc[1:15,], fct=W2.3()) 59 | plot(etmotc.m3, add = TRUE) 60 | modelFit(etmotc.m3) 61 | summary(etmotc.m3) 62 | 63 | } 64 | \keyword{datasets} 65 | -------------------------------------------------------------------------------- /man/finney71.Rd: -------------------------------------------------------------------------------- 1 | \name{finney71} 2 | 3 | \alias{finney71} 4 | 5 | \docType{data} 6 | 7 | \title{Example from Finney (1971)} 8 | 9 | \description{ 10 | For each of six concentration of an insecticid the number of insects affected (out of the number of insects) 11 | was recorded. 12 | } 13 | 14 | \usage{data(finney71)} 15 | 16 | \format{ 17 | A data frame with 6 observations on the following 3 variables. 18 | \describe{ 19 | \item{\code{dose}}{a numeric vector} 20 | \item{\code{total}}{a numeric vector} 21 | \item{\code{affected}}{a numeric vector} 22 | } 23 | } 24 | 25 | %\details{} 26 | 27 | \source{ 28 | Finney, D. J. (1971) \emph{Probit Analysis}, Cambridge: Cambridge University Press. 29 | } 30 | 31 | %\references{} 32 | 33 | \examples{ 34 | 35 | ## Model with ED50 as a parameter 36 | finney71.m1 <- drm(affected/total ~ dose, weights = total, 37 | data = finney71, fct = LL.2(), type = "binomial") 38 | 39 | summary(finney71.m1) 40 | plot(finney71.m1, broken = TRUE, bp = 0.1, lwd = 2) 41 | 42 | ED(finney71.m1, c(10, 20, 50), interval = "delta", reference = "control") 43 | 44 | ## Model fitted with 'glm' 45 | #fitl.glm <- glm(cbind(affected, total-affected) ~ log(dose), 46 | #family=binomial(link = logit), data=finney71[finney71$dose != 0, ]) 47 | #summary(fitl.glm) # p-value almost agree for the b parameter 48 | # 49 | #xp <- dose.p(fitl.glm, p=c(0.50, 0.90, 0.95)) # from MASS 50 | #xp.ci <- xp + attr(xp, "SE") %*% matrix(qnorm(1 - 0.05/2)*c(-1,1), nrow=1) 51 | #zp.est <- exp(cbind(xp.ci[,1],xp,xp.ci[,2])) 52 | #dimnames(zp.est)[[2]] <- c("zp.lcl","zp","zp.ucl") 53 | #zp.est # not far from above results with 'ED' 54 | 55 | ## Model with log(ED50) as a parameter 56 | finney71.m2 <- drm(affected/total ~ dose, weights = total, 57 | data = finney71, fct = LL2.2(), type = "binomial") 58 | 59 | ## Confidence intervals based on back-transformation 60 | ## complete agreement with results based on 'glm' 61 | ED(finney71.m2, c(10, 20, 50), interval = "fls", reference = "control") 62 | 63 | } 64 | \keyword{datasets} 65 | -------------------------------------------------------------------------------- /man/fitted.drc.Rd: -------------------------------------------------------------------------------- 1 | \name{fitted.drc} 2 | 3 | \alias{fitted.drc} 4 | 5 | \title{Extract fitted values from model} 6 | 7 | \description{ 8 | Extracts fitted values from an object of class 'drc'. 9 | } 10 | 11 | \usage{ 12 | 13 | \method{fitted}{drc}(object, ...) 14 | 15 | } 16 | 17 | \arguments{ 18 | \item{object}{an object of class 'drc'.} 19 | \item{...}{additional arguments.} 20 | } 21 | 22 | \value{ 23 | Fitted values extracted from 'object'. 24 | } 25 | 26 | \author{Christian Ritz} 27 | 28 | \examples{ 29 | 30 | ryegrass.m1 <- drm(rootl ~ conc, data = ryegrass, fct = LL.4()) 31 | plot(fitted(ryegrass.m1), residuals(ryegrass.m1)) # a residual plot 32 | 33 | } 34 | \keyword{models} 35 | \keyword{nonlinear} 36 | -------------------------------------------------------------------------------- /man/fplogistic.Rd: -------------------------------------------------------------------------------- 1 | \name{fplogistic} 2 | 3 | \Rdversion{1.1} 4 | 5 | \alias{fplogistic} 6 | \alias{FPL.4} 7 | 8 | \title{Fractional polynomial-logistic dose-response models} 9 | 10 | \description{ 11 | Model function for specifying dose-response models that are a combination of a logistic model and an appropriate 12 | class of fractional polynomials. 13 | } 14 | 15 | \usage{ 16 | fplogistic(p1, p2, fixed = c(NA, NA, NA, NA), names = c("b", "c", "d", "e"), 17 | method = c("1", "2", "3", "4"), ssfct = NULL, fctName, fctText) 18 | 19 | FPL.4(p1, p2, fixed = c(NA, NA, NA, NA), names = c("b", "c", "d", "e"), ...) 20 | } 21 | 22 | \arguments{ 23 | \item{p1}{numeric denoting the negative power of log(dose+1) in the fractional polynomial.} 24 | \item{p2}{numeric denoting the positive power of log(dose+1) in the fractional polynomial.} 25 | \item{fixed}{numeric vector. Specifies which parameters are fixed and at what value they are fixed. 26 | NAs for parameter that are not fixed.} 27 | \item{names}{a vector of character strings giving the names of the parameters (should not contain ":"). 28 | The default is reasonable (see under 'Usage'). The order of the parameters is: b, c, d, e, f 29 | (see under 'Details').} 30 | \item{method}{character string indicating the self starter function to use.} 31 | \item{ssfct}{a self starter function to be used.} 32 | \item{fctName}{optional character string used internally by convenience functions.} 33 | \item{fctText}{optional character string used internally by convenience functions.} 34 | \item{...}{Additional arguments (see \code{\link{fplogistic}}).} 35 | } 36 | 37 | \details{ 38 | The fractional polynomial dose-response models introduced by Namata \emph{et al.} (2008) are implemented 39 | using the logistic model as base. 40 | } 41 | 42 | \value{ 43 | The value returned is a list containing the nonlinear function, the self starter function 44 | and the parameter names. 45 | } 46 | 47 | \references{ 48 | Namata, Harriet and Aerts, Marc and Faes, Christel and Teunis, Peter (2008) 49 | Model Averaging in Microbial Risk Assessment Using Fractional Polynomials, 50 | \emph{Risk Analysis} \bold{28}, 891--905. 51 | } 52 | 53 | \author{Christian Ritz} 54 | 55 | %\note{} 56 | 57 | \seealso{ 58 | Examples are found \code{\link{maED}}. 59 | } 60 | 61 | %\examples{} 62 | 63 | \keyword{models} 64 | \keyword{nonlinear} -------------------------------------------------------------------------------- /man/gammadr.Rd: -------------------------------------------------------------------------------- 1 | \name{gammadr} 2 | 3 | \Rdversion{1.1} 4 | 5 | \alias{gammadr} 6 | 7 | \title{ 8 | Gamma dose-response model 9 | } 10 | 11 | \description{ 12 | The gamma dose-response model is a four-parameter model derived from the cumulative distribution function of the gamma distribution. 13 | } 14 | 15 | \usage{ 16 | gammadr(fixed = c(NA, NA, NA, NA), 17 | names = c("b", "c", "d", "e"), fctName, fctText) 18 | } 19 | 20 | \arguments{ 21 | \item{fixed}{numeric vector specifying which parameters are fixed and at what value they are fixed. 22 | NAs are used for parameters that are not fixed.} 23 | \item{names}{a vector of character strings giving the names of the parameters (should not contain ":"). 24 | The default is reasonable (see under 'Usage').} 25 | \item{fctName}{optional character string used internally by convenience functions.} 26 | \item{fctText}{optional character string used internally by convenience functions.} 27 | } 28 | 29 | \details{ 30 | Following Wheeler and Bailer (2009) the model function is defined as follows: 31 | 32 | \deqn{f(x) = c + (d-c) * pgamma(b*x, e, 1)} 33 | 34 | 35 | This model is only suitable for increasing dose-response data. 36 | } 37 | 38 | \value{ 39 | The value returned is a list containing the nonlinear function, the self starter function 40 | and the parameter names. 41 | } 42 | 43 | \references{ 44 | Wheeler, M. W., Bailer, A. J. (2009) 45 | Comparing model averaging with other model selection strategies for benchmark dose estimation, 46 | \emph{Environmental and Ecological Statistics}, \bold{16}, 37--51. 47 | } 48 | 49 | \author{ 50 | Christian Ritz 51 | } 52 | 53 | %\note{} 54 | 55 | %\seealso{ 56 | % The basic component in the two-phase model is the log-logistic model 57 | % \code{\link{llogistic}}. 58 | %} 59 | 60 | %\examples{} 61 | 62 | \keyword{models} 63 | \keyword{nonlinear} 64 | -------------------------------------------------------------------------------- /man/gaussian.Rd: -------------------------------------------------------------------------------- 1 | \name{gaussian} 2 | 3 | \alias{gaussian} 4 | \alias{lgaussian} 5 | 6 | 7 | \title{ 8 | Normal and log-normal biphasic dose-response models 9 | } 10 | 11 | \description{ 12 | Model functions for fitting symmetric or skewed bell-shaped/biphasic dose-response patterns. 13 | } 14 | 15 | \usage{ 16 | gaussian(fixed = c(NA, NA, NA, NA, NA), names = c("b", "c", "d", "e", "f"), 17 | method = c("1", "2", "3", "4"), ssfct = NULL, fctName, fctText, loge = FALSE) 18 | 19 | lgaussian(fixed = c(NA, NA, NA, NA, NA), names = c("b", "c", 20 | "d", "e", "f"), method = c("1", "2", "3", "4"), ssfct = NULL, 21 | fctName, fctText, loge = FALSE) 22 | } 23 | %- maybe also 'usage' for other objects documented here. 24 | \arguments{ 25 | \item{fixed}{numeric vector. Specifies which parameters are fixed and at what value they are fixed. 26 | NAs for parameter that are not fixed.} 27 | 28 | \item{names}{a vector of character strings giving the names of the parameters (should not contain ":"). 29 | The default is reasonable (see under 'Usage'). The order of the parameters is: b, c, d, e, f 30 | (see under 'Details').} 31 | 32 | \item{method}{character string indicating the self starter function to use.} 33 | 34 | \item{ssfct}{a self starter function to be used.} 35 | 36 | \item{fctName}{optional character string used internally by convenience functions.} 37 | 38 | \item{fctText}{optional character string used internally by convenience functions.} 39 | 40 | \item{loge}{logical indicating whether or not e or log(e) should be a parameter in the model. By default e is a model parameter.} 41 | 42 | } 43 | 44 | \details{ 45 | Details yet to be provided. 46 | } 47 | 48 | \value{ 49 | The value returned is a list containing the nonlinear function, the self starter function 50 | and the parameter names. 51 | } 52 | 53 | \author{Christian Ritz} 54 | 55 | \note{ 56 | The functions are for use with the function \code{\link{drm}}. 57 | } 58 | 59 | \keyword{models} 60 | \keyword{nonlinear} -------------------------------------------------------------------------------- /man/getInitial.Rd: -------------------------------------------------------------------------------- 1 | \name{getInitial} 2 | 3 | \Rdversion{1.1} 4 | 5 | \alias{getInitial} 6 | 7 | \title{ 8 | Showing starting values used 9 | } 10 | 11 | \description{ 12 | Function for showing the starting values of the model parameters used when fitting a dose-response model 13 | } 14 | 15 | \usage{ 16 | getInitial(object) 17 | } 18 | 19 | \arguments{ 20 | \item{object}{object of class 'drc'} 21 | } 22 | 23 | %\details{} 24 | 25 | \value{ 26 | A vector of starting values for the model parameters used to initialize the estimation procedure. 27 | } 28 | 29 | %\references{} 30 | 31 | \author{Christian Ritz} 32 | 33 | \note{This function is masking the standard function in the stats package.} 34 | 35 | %\seealso{} 36 | 37 | %\examples{} 38 | 39 | \keyword{models} 40 | \keyword{nonlinear} -------------------------------------------------------------------------------- /man/getMeanFunctions.Rd: -------------------------------------------------------------------------------- 1 | \name{getMeanFunctions} 2 | 3 | \alias{getMeanFunctions} 4 | 5 | \title{Display available dose-response models} 6 | 7 | \description{ 8 | Display information about available, built-in dose-response models. 9 | } 10 | 11 | \usage{ 12 | getMeanFunctions(noParm = NA, fname = NULL, flist = NULL, display =TRUE) 13 | } 14 | 15 | \arguments{ 16 | \item{noParm}{numeric specifying the number of parameters of the models to be displayed. 17 | The default (NA) results in display of all models, regardless of number of parameters.} 18 | \item{fname}{character string or vector of character strings specifying the short name(s) 19 | of the models to be displayed (need to match exactly).} 20 | \item{flist}{list of built-in functions to be displayed.} 21 | \item{display}{logical indicating whether or not the requested models should be displayed on the R console.} 22 | } 23 | 24 | \details{ 25 | The arguments \code{noParm} and \code{fname} can be combined. 26 | } 27 | 28 | \value{ 29 | An invisible list of functions or a list of strings with brief function descriptions is returned. 30 | } 31 | 32 | %\references{} 33 | 34 | \author{Christian Ritz} 35 | 36 | %\note{} 37 | 38 | %\seealso{} 39 | 40 | \examples{ 41 | 42 | ## Listing all functions 43 | getMeanFunctions() 44 | 45 | ## Listing all functions with 4 parameters 46 | getMeanFunctions(4) 47 | 48 | ## Listing all (log-)logistic functions 49 | getMeanFunctions(fname = "L") 50 | 51 | ## Listing all three-parameter (log-)logistic or Weibull functions 52 | getMeanFunctions(3, fname = c("LL", "W")) 53 | 54 | ## Listing all four-parameter (log-)logistic or Weibull functions 55 | getMeanFunctions(4, fname = c("LL", "W")) 56 | 57 | } 58 | \keyword{models} 59 | \keyword{nonlinear} 60 | -------------------------------------------------------------------------------- /man/glymet.Rd: -------------------------------------------------------------------------------- 1 | \name{glymet} 2 | 3 | \alias{glymet} 4 | 5 | \docType{data} 6 | 7 | \title{Glyphosate and metsulfuron-methyl tested on algae.} 8 | 9 | \description{ 10 | The dataset has 7 mixtures, 8 dilutions, two replicates and 5 common control controls. 11 | Four observations are missing, giving a total of 113 observations. 12 | } 13 | 14 | \usage{data(glymet)} 15 | 16 | \format{ 17 | A data frame with 113 observations on the following 3 variables. 18 | \describe{ 19 | \item{\code{dose}}{a numeric vector of dose values} 20 | \item{\code{pct}}{a numeric vector denoting the grouping according to the mixtures percentages} 21 | \item{\code{rgr}}{a numeric vector of response values (relative growth rates)} 22 | } 23 | } 24 | 25 | \details{ 26 | The dataset is analysed in Soerensen et al (2007). 27 | The concentration addition model can be entertained for this dataset. 28 | } 29 | 30 | \source{ 31 | The dataset is kindly provided by Nina Cedergreen, Department of Agricultural Sciences, 32 | Royal Veterinary and Agricultural University, Denmark. 33 | } 34 | 35 | \references{ 36 | Soerensen, H. and Cedergreen, N. and Skovgaard, I. M. and Streibig, J. C. (2007) 37 | An isobole-based statistical model and test for synergism/antagonism in binary mixture toxicity experiments, 38 | \emph{Environmental and Ecological Statistics}, \bold{14}, 383--397. 39 | } 40 | 41 | \examples{ 42 | 43 | 44 | ## Fitting the model with freely varying ED50 values 45 | glymet.free <- drm(rgr~dose, pct, data = glymet, 46 | fct = LL.3(), pmodels = list(~factor(pct) , ~1, ~factor(pct))) 47 | 48 | ## Lack-of-fit test 49 | modelFit(glymet.free) # acceptable 50 | summary(glymet.free) 51 | 52 | ## Plotting isobole structure 53 | isobole(glymet.free, exchange=0.01) 54 | 55 | ## Fitting the concentration addition model 56 | glymet.ca <- mixture(glymet.free, model = "CA") 57 | 58 | ## Comparing to model with freely varying e parameter 59 | anova(glymet.ca, glymet.free) # borderline accepted 60 | 61 | ## Plotting isobole based on concentration addition 62 | isobole(glymet.free, glymet.ca, exchange = 0.01) # acceptable fit 63 | 64 | ## Fitting the Hewlett model 65 | glymet.hew <- mixture(glymet.free, model = "Hewlett") 66 | 67 | ### Comparing to model with freely varying e parameter 68 | anova(glymet.ca, glymet.hew) 69 | # borderline accepted 70 | # the Hewlett model offers no improvement over concentration addition 71 | 72 | ## Plotting isobole based on the Hewlett model 73 | isobole(glymet.free, glymet.hew, exchange = 0.01) 74 | # no improvement over concentration addition 75 | 76 | } 77 | 78 | \keyword{datasets} 79 | -------------------------------------------------------------------------------- /man/gompertzd.Rd: -------------------------------------------------------------------------------- 1 | \name{gompertzd} 2 | 3 | \alias{gompertzd} 4 | 5 | \title{The derivative of the Gompertz function} 6 | 7 | \description{ 8 | 'gompertzd' provides a way of specifying the derivative of the Gompertz function 9 | as a dose-response model. 10 | } 11 | 12 | \usage{ 13 | gompertzd(fixed = c(NA, NA), names = c("a", "b")) 14 | } 15 | 16 | \arguments{ 17 | \item{fixed}{numeric vector. Specifies which parameters are fixed and at what value they are fixed. 18 | NAs for parameter that are not fixed.} 19 | \item{names}{a vector of character strings giving the names of the parameters (should not contain ":"). 20 | The default is (notice the order): a, b.} 21 | } 22 | 23 | \details{ 24 | The derivative of the Gompertz function is defined as 25 | 26 | \deqn{ f(x) = a \exp(bx-a/b(exp(bx)-1))} 27 | 28 | For \eqn{a>0} and \eqn{b} not 0, the function is decreasing, equaling \eqn{a} at \eqn{x=0} 29 | and approaching 0 at plus infinity. 30 | } 31 | 32 | \value{ 33 | The value returned is a list containing the model function, the self starter function 34 | and the parameter names. 35 | } 36 | 37 | %\references{} 38 | 39 | \author{Christian Ritz} 40 | 41 | \note{ 42 | This function is for use with the function \code{\link{drm}}. 43 | } 44 | 45 | %\seealso{} 46 | 47 | %\examples{} 48 | 49 | \keyword{models} 50 | \keyword{nonlinear} 51 | -------------------------------------------------------------------------------- /man/hatvalues.drc.Rd: -------------------------------------------------------------------------------- 1 | \name{hatvalues.drc} 2 | 3 | \alias{hatvalues.drc} 4 | \alias{cooks.distance.drc} 5 | 6 | \title{ 7 | Model diagnostics for nonlinear dose-response models 8 | } 9 | 10 | \description{ 11 | Hat values (leverage values) and Cook's distance are provided for nonlinear dose-response model fits using the same formulas 12 | as in linear regression but based on the corresponding but approximate quantities available for nonlinear models. 13 | } 14 | 15 | \usage{ 16 | \method{cooks.distance}{drc}(model, ...) 17 | 18 | \method{hatvalues}{drc}(model, ...) 19 | } 20 | 21 | \arguments{ 22 | \item{model}{an object of class 'drc'.} 23 | \item{\dots}{additional arguments (not used).} 24 | } 25 | 26 | \details{ 27 | Hat values and Cook's distance are calculated using the formula given by Cook et al. (1986) and McCullagh and Nelder (1989). 28 | 29 | The output values can be assessed in the same way as in linear regression. 30 | } 31 | 32 | \value{ 33 | A vector of leverage values (hat values) or values of Cook's distance (one value per observation). 34 | } 35 | \references{ 36 | 37 | Cook, R. D. and Tsai, C.-L. and Wei, B. C. (1986) 38 | Bias in Nonlinear Regression, 39 | \emph{Biometrika} 40 | \bold{73}, 615--623. 41 | 42 | McCullagh, P. and Nelder, J. A. (1989) 43 | emph{Generalized Linear Models}, 44 | Second edition, Chapman \& Hall/CRC. 45 | } 46 | 47 | \author{ 48 | Christian Ritz 49 | } 50 | 51 | %\note{ 52 | %} 53 | 54 | \examples{ 55 | 56 | ryegrass.LL.4 <- drm(rootl ~ conc, data = ryegrass, fct = LL.4()) 57 | 58 | hatvalues(ryegrass.LL.4) 59 | 60 | cooks.distance(ryegrass.LL.4) 61 | 62 | } 63 | \keyword{models} 64 | \keyword{nonlinear} -------------------------------------------------------------------------------- /man/heartrate.Rd: -------------------------------------------------------------------------------- 1 | \name{heartrate} 2 | 3 | \alias{heartrate} 4 | 5 | \docType{data} 6 | 7 | \title{Heart rate baroreflexes for rabbits} 8 | 9 | \description{ 10 | The dataset contains measurements of mean arterial pressure (mmHG) and heart rate (b/min) for a baroreflex curve. 11 | } 12 | 13 | \usage{data(heartrate)} 14 | 15 | \format{ 16 | A data frame with 18 observations on the following 2 variables. 17 | \describe{ 18 | \item{\code{pressure}}{a numeric vector containing measurements of arterial pressure.} 19 | \item{\code{rate}}{a numeric vector containing measurements of heart rate.} 20 | } 21 | } 22 | 23 | \details{ 24 | The dataset is an example of an asymmetric dose-response curve, that is not 25 | easily handled using the log-logistic or Weibull models (\code{\link{LL.4}}, \code{\link{LL.5}}, 26 | \code{\link{W1.4}} and \code{\link{W2.4}}), whereas the \code{baro5} model provides a nice fit. 27 | } 28 | 29 | \source{ 30 | Ricketts, J. H. and Head, G. A. (1999) A five-parameter logistic equation for investigating asymmetry of 31 | curvature in baroreflex studies, 32 | \emph{Am. J. Physiol. (Regulatory Integrative Comp. Physiol. 46)}, \bold{277}, 441--454. 33 | } 34 | 35 | \examples{ 36 | 37 | ## Fitting the baro5 model 38 | heartrate.m1 <- drm(rate~pressure, data=heartrate, fct=baro5()) 39 | plot(heartrate.m1) 40 | 41 | coef(heartrate.m1) 42 | 43 | #Output: 44 | #b1:(Intercept) b2:(Intercept) c:(Intercept) d:(Intercept) e:(Intercept) 45 | # 11.07984 46.67492 150.33588 351.29613 75.59392 46 | 47 | ## Inserting the estimated baro5 model function in deriv() 48 | baro5Derivative <- deriv(~ 150.33588 + ((351.29613 - 150.33588)/ 49 | (1 + (1/(1 + exp((2 * 11.07984 * 46.67492/(11.07984 + 46.67492)) * 50 | (log(x) - log(75.59392 ))))) * (exp(11.07984 * (log(x) - log(75.59392)))) + 51 | (1 - (1/(1 + exp((2 * 11.07984 * 46.67492/(11.07984 + 46.67492)) * 52 | (log(x) - log(75.59392 )))))) * (exp(46.67492 * (log(x) - log(75.59392 )))))), "x", function(x){}) 53 | 54 | ## Plotting the derivative 55 | #pressureVector <- 50:100 56 | pressureVector <- seq(50, 100, length.out=300) 57 | derivativeVector <- attr(baro5Derivative(pressureVector), "gradient") 58 | plot(pressureVector, derivativeVector, type = "l") 59 | 60 | ## Finding the minimum 61 | pressureVector[which.min(derivativeVector)] 62 | 63 | 64 | } 65 | \keyword{datasets} 66 | -------------------------------------------------------------------------------- /man/isobole.Rd: -------------------------------------------------------------------------------- 1 | \name{isobole} 2 | \alias{isobole} 3 | 4 | \title{Creating isobolograms} 5 | 6 | \description{ 7 | 'isobole' displays isobole based on EC/ED50 estimates from a log-logistic model. 8 | Additionally isoboles determined by the concentration addition model, Hewlett's 9 | model and Voelund's model can be added to the plot. 10 | } 11 | 12 | \usage{ 13 | isobole(object1, object2, exchange = 1, cifactor = 2, ename = "e", 14 | xaxis = "100", xlab, ylab, xlim, ylim, ...) 15 | } 16 | 17 | \arguments{ 18 | \item{object1}{object of class 'drc' where EC/ED50 parameters vary freely.} 19 | \item{object2}{object of class 'drc' where EC/ED50 parameters vary according to Hewlett's model.} 20 | \item{ename}{character string. The name of the EC/ED50 variable.} 21 | \item{xaxis}{character string. Is the mixture "0:100" or "100:0" on the x axis?} 22 | \item{exchange}{numeric. The exchange rate between the two substances.} 23 | \item{cifactor}{numeric. The factor to be used in the confidence intervals. 24 | Default is 2, but 1 has been used in publications.} 25 | \item{xlab}{an optional label for the x axis.} 26 | \item{ylab}{an optional label for the y axis.} 27 | \item{xlim}{a numeric vector of length two, containing the lower and upper limit for the x axis.} 28 | \item{ylim}{a numeric vector of length two, containing the lower and upper limit for the y axis.} 29 | \item{\dots}{Additional graphical parameters.} 30 | } 31 | 32 | \details{ 33 | The model fits to be supplied as first and optionally second argument are obtained 34 | using \code{\link{mixture}} and \code{\link{drm}}. 35 | } 36 | 37 | \value{ 38 | No value is returned. Only used for the side effect: the isobologram shown. 39 | } 40 | 41 | \references{ 42 | Ritz, C. and Streibig, J. C. (2014) 43 | From additivity to synergism - A modelling perspective 44 | \emph{Synergy}, \bold{1}, 22--29. 45 | } 46 | 47 | \author{Christian Ritz} 48 | 49 | %\note{} 50 | 51 | \seealso{ 52 | The examples in \code{\link{acidiq}}, \code{\link{glymet}} and \code{\link{mecter}}. 53 | } 54 | 55 | %\examples{} 56 | 57 | \keyword{models} 58 | \keyword{nonlinear} 59 | -------------------------------------------------------------------------------- /man/lepidium.Rd: -------------------------------------------------------------------------------- 1 | \name{lepidium} 2 | 3 | \alias{lepidium} 4 | 5 | \docType{data} 6 | 7 | \title{Dose-response profile of degradation of agrochemical using lepidium} 8 | 9 | \description{ 10 | Estimation of the degradation profile of an agrochemical based on soil samples at depth 0-10cm 11 | from a calibration experiment. 12 | } 13 | 14 | \usage{data(lepidium)} 15 | 16 | \format{ 17 | A data frame with 42 observations on the following 2 variables. 18 | \describe{ 19 | \item{\code{conc}}{a numeric vector of concentrations (g/ha)} 20 | \item{\code{weight}}{a numeric vector of plant weight (g) after 3 weeks' growth} 21 | } 22 | } 23 | 24 | \details{ 25 | It is an experiment with seven concentrations and six replicates per concentration. \emph{Lepidium} 26 | is rather robust as it only responds to high concentrations. 27 | } 28 | 29 | \source{ 30 | Racine-Poon, A. (1988) A Bayesian Approach to Nonlinear Calibration Problems, 31 | \emph{J. Am. Statist. Ass.}, \bold{83}, 650--656. 32 | } 33 | 34 | %\references{} 35 | 36 | \examples{ 37 | 38 | lepidium.m1 <- drm(weight~conc, data=lepidium, fct = LL.4()) 39 | 40 | modelFit(lepidium.m1) 41 | 42 | plot(lepidium.m1, type = "all", log = "") 43 | } 44 | \keyword{datasets} 45 | -------------------------------------------------------------------------------- /man/lettuce.Rd: -------------------------------------------------------------------------------- 1 | \name{lettuce} 2 | 3 | \alias{lettuce} 4 | 5 | \docType{data} 6 | 7 | \title{Hormesis in lettuce plants} 8 | 9 | \description{ 10 | Data are from an experiment where isobutylalcohol was dissolved in a nutrient solution in which lettuce 11 | (\emph{Lactuca sativa}) plants were grown. The plant biomass of the shoot was determined af 21 days. 12 | } 13 | 14 | \usage{data(lettuce)} 15 | 16 | \format{ 17 | A data frame with 14 observations on the following 2 variables. 18 | \describe{ 19 | \item{conc}{a numeric vector of concentrations of isobutylalcohol (mg/l)} 20 | \item{weight}{a numeric vector of biomass of shoot (g)} 21 | } 22 | } 23 | 24 | \details{ 25 | The data set illustrates hormesis, presence of a subtoxic stimulus at low concentrations. 26 | } 27 | 28 | \source{ 29 | van Ewijk, P. H. and Hoekstra, J. A. (1993) 30 | Calculation of the EC50 and its Confidence Interval When Subtoxic Stimulus Is Present, 31 | \emph{ECOTOXICOLOGY AND ENVIRONMENTAL SAFETY}, \bold{25}, 25--32. 32 | } 33 | 34 | \references{ 35 | van Ewijk, P. H. and Hoekstra, J. A. (1994) 36 | Curvature Measures and Confidence Intervals for the Linear Logistic Model, 37 | \emph{Appl. Statist.}, \bold{43}, 477--487. 38 | } 39 | 40 | \examples{ 41 | 42 | ## Look at data 43 | lettuce 44 | 45 | ## Monotonous dose-response model 46 | lettuce.m1 <- drm(weight~conc, data=lettuce, fct=LL.3()) 47 | 48 | plot(lettuce.m1, broken = TRUE) 49 | 50 | ## Model fit in van Ewijk and Hoekstra (1994) 51 | lettuce.m2 <- drm(weight~conc, data=lettuce, fct=BC.4()) 52 | modelFit(lettuce.m2) 53 | 54 | plot(lettuce.m2, add = TRUE, broken = TRUE, type = "none", lty = 2) 55 | 56 | ## Hormesis effect only slightly significant 57 | summary(lettuce.m2) 58 | 59 | ## Hormesis effect highly significant 60 | ## compare with t-test for the "f" parameter in the summary output) 61 | anova(lettuce.m1, lettuce.m2) 62 | 63 | } 64 | \keyword{datasets} 65 | -------------------------------------------------------------------------------- /man/logLik.drc.Rd: -------------------------------------------------------------------------------- 1 | \name{logLik.drc} 2 | 3 | \alias{logLik.drc} 4 | 5 | \title{Extracting the log likelihood} 6 | 7 | \description{ 8 | \code{loglik} extracts the value of the log likelihood function evaluated at the parameter estimates. 9 | } 10 | \usage{ 11 | \method{logLik}{drc}(object, ...) 12 | } 13 | 14 | \arguments{ 15 | \item{object}{an object of class 'drc'.} 16 | \item{...}{additional arguments.} 17 | } 18 | 19 | \value{ 20 | The evaluated log likelihood as a numeric value and the corresponding degrees of freedom as well as the number of observations as attributes. 21 | } 22 | 23 | \note{ 24 | The value of the log likelihood could be used to compare model fits of the same data based on different 25 | dose-response models or based on the same model but fitted different algorithms, software programmes, or 26 | starting values. For comparisons: Larger is better. 27 | } 28 | 29 | \author{Christian Ritz} 30 | 31 | \examples{ 32 | 33 | ## Fitting a four-parameter log-logistic model 34 | ryegrass.m1 <- drm(rootl ~conc, data = ryegrass, fct = LL.4()) 35 | logLik(ryegrass.m1) 36 | 37 | } 38 | \keyword{models} 39 | \keyword{nonlinear} 40 | -------------------------------------------------------------------------------- /man/metals.Rd: -------------------------------------------------------------------------------- 1 | \name{metals} 2 | \alias{metals} 3 | \docType{data} 4 | 5 | \title{ 6 | Data from heavy metal mixture experiments 7 | } 8 | 9 | \description{ 10 | Data are from a study of the response of the cyanobacterial self-luminescent metallothionein-based whole-cell biosensor Synechoccocus elongatus PCC 7942 pBG2120 to binary mixtures of 6 heavy metals (Zn, Cu, Cd, Ag, Co and Hg). 11 | } 12 | 13 | \usage{data("metals")} 14 | \format{ 15 | A data frame with 543 observations on the following 3 variables. 16 | \describe{ 17 | \item{\code{metal}}{a factor with levels \code{Ag} \code{AgCd} \code{Cd} \code{Co} \code{CoAg} \code{CoCd} \code{Cu} \code{CuAg} \code{CuCd} \code{CuCo} \code{CuHg} \code{CuZn} \code{Hg} \code{HgCd} \code{HgCo} \code{Zn} \code{ZnAg} \code{ZnCd} \code{ZnCo} \code{ZnHg}} 18 | \item{\code{conc}}{a numeric vector of concentrations} 19 | \item{\code{BIF}}{a numeric vector of luminescence induction factors} 20 | } 21 | } 22 | 23 | \details{ 24 | Data are from the study described by Martin-Betancor et al. (2015). 25 | } 26 | 27 | \source{ 28 | Martin-Betancor, K. and Ritz, C. and Fernandez-Pinas, F. and Leganes, F. and Rodea-Palomares, I. (2015) 29 | Defining an additivity framework for mixture research in inducible whole-cell biosensors, 30 | \emph{Scientific Reports} 31 | \bold{17200}.} 32 | 33 | %\references{} 34 | 35 | \examples{ 36 | ## One example from the paper by Martin-Betancor et al (2015) 37 | 38 | ## Figure 2 39 | 40 | ## Fitting a model for "Zn" 41 | Zn.lgau <- drm(BIF ~ conc, data = subset(metals, metal == "Zn"), 42 | fct = lgaussian(), bcVal = 0, bcAdd = 10) 43 | 44 | ## Plotting data and fitted curve 45 | plot(Zn.lgau, log = "", type = "all", 46 | xlab = expression(paste(plain("Zn")^plain("2+"), " ", mu, "", plain("M")))) 47 | 48 | ## Calculating effective doses 49 | ED(Zn.lgau, 50, interval = "delta") 50 | ED(Zn.lgau, -50, interval = "delta", bound = FALSE) 51 | ED(Zn.lgau, 99.999,interval = "delta") # approx. for ED0 52 | 53 | ## Fitting a model for "Cu" 54 | Cu.lgau <- drm(BIF ~ conc, data = subset(metals, metal == "Cu"), 55 | fct = lgaussian()) 56 | 57 | ## Fitting a model for the mixture Cu-Zn 58 | CuZn.lgau <- drm(BIF ~ conc, data = subset(metals, metal == "CuZn"), 59 | fct = lgaussian()) 60 | 61 | ## Calculating effects needed for the FA-CI plot 62 | CuZn.effects <- CIcompX(0.015, list(CuZn.lgau, Cu.lgau, Zn.lgau), 63 | c(-5, -10, -20, -30, -40, -50, -60, -70, -80, -90, -99, 99, 90, 80, 70, 60, 50, 40, 30, 20, 10)) 64 | 65 | ## Reproducing the FA-cI plot shown in Figure 5d 66 | plotFACI(CuZn.effects, "ED", ylim = c(0.8, 1.6), showPoints = TRUE) 67 | 68 | } 69 | 70 | \keyword{datasets} 71 | -------------------------------------------------------------------------------- /man/methionine.Rd: -------------------------------------------------------------------------------- 1 | %\encoding{latin1} 2 | 3 | \name{methionine} 4 | 5 | \alias{methionine} 6 | 7 | \docType{data} 8 | 9 | \title{Weight gain for different methionine sources} 10 | 11 | \description{ 12 | Data consist of average body weight gain of chickens being treated 13 | with one of the two methionine sources DLM and HMTBA. 14 | } 15 | 16 | \usage{data(methionine)} 17 | 18 | \format{ 19 | A data frame with 9 observations on the following 3 variables: 20 | \describe{ 21 | \item{\code{product}}{a factor with levels \code{control}, \code{DLM} and \code{MHA} denoting the treatments} 22 | \item{\code{dose}}{a numeric vector of methionine dose} 23 | \item{\code{gain}}{a numeric vector of average body weight gain} 24 | } 25 | } 26 | 27 | \details{ 28 | The dataset contains a common control measurement for the two treatments. More examples using this 29 | dataset are found under \code{\link{AR.2}} and \code{\link{MM.2}}. 30 | } 31 | 32 | \source{ 33 | Kratzer. D. D. and Littell, R. C. (2006) Appropriate Statistical Methods to Compare 34 | Dose Responses of Methionine Sources, \emph{Poultry Science}, \bold{85}, 947--954. 35 | } 36 | 37 | %\references{ 38 | % Schutte, J. B. and de Jong, J. (1996) Biological efficacy of DL-methinonine hydroxy analog free acid compared 39 | % to DL-methionine in broiler chicks as determined by performance and breast meat yield, 40 | % \emph{Agribiol. Res.}, \bold{49}, 74--82. 41 | %} 42 | 43 | \examples{ 44 | 45 | ## Fitting model with constraint on one parameter 46 | met.ar.m1 <- drm(gain~dose, product, data = methionine, 47 | fct = AR.3(), pmodels = list(~1, ~factor(product), ~factor(product)), 48 | upperl = c(Inf, Inf, 1700, Inf, Inf)) 49 | 50 | plot(met.ar.m1, xlim=c(0,0.3), ylim=c(1450, 1800)) 51 | abline(h=1700, lty=1) 52 | 53 | summary(met.ar.m1) 54 | 55 | } 56 | \keyword{datasets} 57 | -------------------------------------------------------------------------------- /man/mixture.Rd: -------------------------------------------------------------------------------- 1 | \name{mixture} 2 | 3 | \alias{mixture} 4 | 5 | \title{Fitting binary mixture models} 6 | 7 | \description{ 8 | 'mixture' fits a concentration addition, Hewlett or Voelund model to data from binary mixture toxicity experiments. 9 | } 10 | 11 | \usage{ 12 | mixture(object, model = c("CA", "Hewlett", "Voelund"), start, startm, control = drmc()) 13 | } 14 | 15 | \arguments{ 16 | \item{object}{object of class 'drc' corresponding to the model with freely varying EC50 values.} 17 | \item{model}{character string. It can be "CA", "Hewlett" or "Voelund".} 18 | \item{start}{optional numeric vector supplying starting values for all parameters in the mixture model.} 19 | \item{startm}{optional numeric vector supplying the lambda parameter in the Hewlett model or 20 | the eta parameters (two parameters) in the Voelund model.} 21 | \item{control}{list of arguments controlling constrained optimisation (zero as boundary), 22 | maximum number of iteration in the optimisation, 23 | relative tolerance in the optimisation, warnings issued during the optimisation.} 24 | } 25 | 26 | \details{ 27 | The function is a wrapper to \code{\link{drm}}, implementing the models described in Soerensen et al. (2007). 28 | See the paper for a discussion of the merits of the different models. 29 | 30 | Currently only the log-logistic models are available. Application of Box-Cox transformation is not yet available. 31 | } 32 | 33 | \value{ 34 | An object of class 'drc' with a few additional components. 35 | } 36 | 37 | \references{ 38 | Ritz, C. and Streibig, J. C. (2014) 39 | From additivity to synergism - A modelling perspective 40 | \emph{Synergy}, \bold{1}, 22--29. 41 | } 42 | 43 | \author{Christian Ritz} 44 | 45 | \seealso{ 46 | The examples in \code{\link{acidiq}} (the Hewlett model), \code{\link{glymet}} (dose/concentration addition) 47 | and \code{\link{mecter}} (the Voelund model). 48 | } 49 | 50 | %\examples{} 51 | 52 | \keyword{models} 53 | \keyword{nonlinear} 54 | -------------------------------------------------------------------------------- /man/modelFit.Rd: -------------------------------------------------------------------------------- 1 | \name{modelFit} 2 | 3 | \alias{modelFit} 4 | 5 | \title{Assessing the model fit} 6 | 7 | \description{ 8 | Checking the fit of dose-response model by means of formal significance tests or graphical procedures. 9 | } 10 | 11 | \usage{ 12 | modelFit(object, test = NULL, method = c("gof", "cum")) 13 | } 14 | 15 | \arguments{ 16 | \item{object}{object of class 'drc'} 17 | \item{test}{character string defining the test method to apply} 18 | \item{method}{character string specifying the method to be used for assessing the model fit} 19 | } 20 | 21 | \details{ 22 | Currently two methods are available. For continuous data the clasical lack-of-fit test is applied 23 | (Bates and Watts, 1988). The test compares the dose-response model to a more general ANOVA model 24 | using an approximate F-test. For quantal data the crude goodness-of-fit test based on Pearson's statistic is used. 25 | 26 | None of these tests are very powerful. A significant test result is more alarming than a non-significant one. 27 | } 28 | 29 | \value{ 30 | An object of class 'anova' which will be displayed in much the same way as an ordinary ANOVA table. 31 | } 32 | 33 | \references{ 34 | Bates, D. M. and Watts, D. G. (1988) 35 | \emph{Nonlinear Regression Analysis and Its Applications}, 36 | New York: Wiley \& Sons (pp. 103--104). 37 | } 38 | 39 | \author{Christian Ritz} 40 | 41 | %\note{} 42 | 43 | %\seealso{ ~~objects to See Also as \code{\link{help}}, ~~~ } 44 | 45 | \examples{ 46 | 47 | ## Comparing the four-parameter log-logistic model 48 | ## to a one-way ANOVA model using an approximate F test 49 | ## in other words applying a lack-of-fit test 50 | ryegrass.m1 <- drm(rootl ~ conc, data = ryegrass, fct = W1.4()) 51 | modelFit(ryegrass.m1) 52 | 53 | } 54 | 55 | \keyword{models} 56 | \keyword{nonlinear} 57 | -------------------------------------------------------------------------------- /man/multi2.Rd: -------------------------------------------------------------------------------- 1 | \name{multi2} 2 | 3 | \alias{multi2} 4 | 5 | \title{ 6 | Multistage dose-response model with quadratic terms 7 | } 8 | 9 | \description{ 10 | The multistage dose-response model is a combination of log-logistic models that should be useful for describing 11 | more complex dose-response patterns. 12 | } 13 | 14 | \usage{ 15 | multi2( 16 | fixed = c(NA, NA, NA, NA, NA), 17 | names = c("b1", "b2", "b3", "c", "d"), 18 | ssfct = NULL, 19 | fctName, 20 | fctText) 21 | } 22 | 23 | \arguments{ 24 | \item{fixed}{numeric vector specifying which parameters are fixed and at what value they are fixed. 25 | NAs are used for parameters that are not fixed.} 26 | \item{names}{a vector of character strings giving the names of the parameters (should not contain ":"). 27 | The default is reasonable (see under 'Usage').} 28 | \item{ssfct}{a self starter function to be used.} 29 | \item{fctName}{optional character string used internally by convenience functions.} 30 | \item{fctText}{optional character string used internally by convenience functions.} 31 | } 32 | 33 | \details{ 34 | The multistage model function with quadratic terms is defined as follows 35 | 36 | \deqn{ f(x) = c + (d-c)\exp(-b1-b2x-b3x^2)} 37 | 38 | where x denotes the dose or the logarithm-transformed dose. 39 | } 40 | 41 | \value{ 42 | The value returned is a list containing the nonlinear function, the self starter function 43 | and the parameter names. 44 | } 45 | 46 | \references{ 47 | Wheeler, M. W., Bailer, A. J. (2009) 48 | Comparing model averaging with other model selection strategies for benchmark dose estimation, 49 | \emph{Environmental and Ecological Statistics}, \bold{16}, 37--51. 50 | } 51 | 52 | \author{ 53 | Christian Ritz 54 | } 55 | 56 | %\note{} 57 | 58 | %\seealso{} 59 | 60 | %\examples{} 61 | 62 | \keyword{models} 63 | \keyword{nonlinear} 64 | -------------------------------------------------------------------------------- /man/nasturtium.Rd: -------------------------------------------------------------------------------- 1 | \name{nasturtium} 2 | 3 | \alias{nasturtium} 4 | 5 | \docType{data} 6 | 7 | \title{Dose-response profile of degradation of agrochemical using nasturtium} 8 | 9 | \description{ 10 | Estimation of the degradation profile of an agrochemical based on soil samples at depth 0-10cm 11 | from a calibration experiment. 12 | } 13 | 14 | \usage{data(nasturtium)} 15 | 16 | \format{ 17 | A data frame with 42 observations on the following 2 variables. 18 | \describe{ 19 | \item{\code{conc}}{a numeric vector of concentrations (g/ha)} 20 | \item{\code{weight}}{a numeric vector of plant weight (mg) after 3 weeks' growth} 21 | } 22 | } 23 | 24 | \details{ 25 | It is an experiment with seven concentrations and six replicates per concentration. \emph{Nasturtium} 26 | is sensitive and its weight reduces noticeable at low concentrations. 27 | 28 | Racine-Poon (1988) suggests using a three-parameter log-logistic model. 29 | } 30 | 31 | \source{ 32 | Racine-Poon, A. (1988) A Bayesian Approach to Nonlinear Calibration Problems, 33 | \emph{J. Am. Statist. Ass.}, \bold{83}, 650--656. 34 | } 35 | 36 | %\references{} 37 | 38 | \examples{ 39 | 40 | nasturtium.m1 <- drm(weight~conc, data=nasturtium, fct = LL.3()) 41 | 42 | modelFit(nasturtium.m1) 43 | 44 | plot(nasturtium.m1, type = "all", log = "", xlab = "Concentration (g/ha)", ylab = "Weight (mg)") 45 | } 46 | 47 | \keyword{datasets} 48 | -------------------------------------------------------------------------------- /man/neill.test.Rd: -------------------------------------------------------------------------------- 1 | \name{neill.test} 2 | 3 | \alias{neill.test} 4 | 5 | \title{ 6 | Neill's lack-of-fit test for dose-response models 7 | } 8 | 9 | \description{ 10 | 'neill.test' provides a lack-of-fit test for non-linear regression models. It is applicable both in cases 11 | where there are replicates (in which case it reduces to the standard lack-of-fit test against an ANOVA 12 | model) and in cases where there are no replicates, though then a grouping has to be provided. 13 | } 14 | 15 | \usage{ 16 | neill.test(object, grouping, method = c("c-finest", "finest", "percentiles"), 17 | breakp = NULL, display = TRUE) 18 | } 19 | 20 | \arguments{ 21 | \item{object}{ 22 | object of class 'drc' or 'nls'. 23 | } 24 | \item{grouping}{ 25 | character or numeric vector that provides the grouping of the dose values. 26 | } 27 | \item{method}{ 28 | character string specifying the method to be used to generate a grouping of the dose values. 29 | } 30 | \item{breakp}{ 31 | numeric vector of break points for generating dose intervals that form a grouping. 32 | } 33 | \item{display}{ 34 | logical. If TRUE results are displayed. Otherwise they are not (useful in simulations). 35 | } 36 | } 37 | 38 | \details{ 39 | The functions used the methods \code{\link{df.residual}} and \code{\link{residuals}} and the 'data' 40 | component of \code{object} (only for determining the number of observations). 41 | } 42 | 43 | \value{ 44 | The function returns an object of class anova which is displayed using \code{print.anova}. 45 | } 46 | 47 | \references{ 48 | Neill, J. W. (1988) Testing for lack of fit in nonlinear regression, 49 | \emph{Ann. Statist.}, \bold{16}, 733--740 50 | } 51 | 52 | \author{Christian Ritz} 53 | 54 | \note{ 55 | A clustering technique could be employed to determine the grouping to be used in cases where there are 56 | no replicates. There should at most be ceiling(n/2) clusters as otherwise some observations will not be used 57 | in the test. At the other end there need to be more clusters than parameters in the model. 58 | } 59 | 60 | \seealso{ 61 | See also \code{\link{modelFit}} for details on the lack-of-fit test against an ANOVA model.} 62 | 63 | \examples{ 64 | 65 | ### Example with 'drc' object 66 | 67 | ## Lack-of-fit test against ANOVA 68 | ryegrass.m1 <-drm(rootl~conc, data = ryegrass, fct = LL.4()) 69 | modelFit(ryegrass.m1) 70 | 71 | ## The same test using 'neill.test' 72 | neill.test(ryegrass.m1, ryegrass$conc) 73 | 74 | ## Generating a grouping 75 | neill.test(ryegrass.m1, method="c-finest") 76 | neill.test(ryegrass.m1, method="finest") 77 | neill.test(ryegrass.m1, method="perc") 78 | 79 | 80 | } 81 | 82 | \keyword{models} 83 | \keyword{nonlinear} 84 | -------------------------------------------------------------------------------- /man/noEffect.Rd: -------------------------------------------------------------------------------- 1 | \name{noEffect} 2 | 3 | \alias{noEffect} 4 | 5 | \title{ 6 | Testing if there is a dose effect at all 7 | } 8 | 9 | \description{ 10 | A significance test is provided for the comparison of the dose-response model considered and the simple linear regression 11 | model with slope 0 (a horizontal regression line corresponding to no dose effect) 12 | } 13 | 14 | \usage{ 15 | noEffect(object) 16 | } 17 | 18 | \arguments{ 19 | \item{object}{an object of class 'drc'.} 20 | } 21 | 22 | \details{ 23 | Perhaps useful for screening purposes. 24 | } 25 | 26 | \value{ 27 | The likelihood ratio test statistic and the corresponding degrees of freedom and p-value are reported. 28 | } 29 | 30 | %\references{ 31 | %} 32 | 33 | \author{Christian Ritz} 34 | 35 | %\note{ 36 | %} 37 | 38 | \examples{ 39 | 40 | ryegrass.LL.4 <- drm(rootl ~ conc, data = ryegrass, fct = LL.4()) 41 | 42 | noEffect(ryegrass.LL.4) 43 | # p-value < 0.0001: there is a highly significant dose effect! 44 | 45 | } 46 | 47 | \keyword{models} 48 | \keyword{nonlinear} 49 | 50 | -------------------------------------------------------------------------------- /man/print.drc.Rd: -------------------------------------------------------------------------------- 1 | \name{print.drc} 2 | 3 | \alias{print.drc} 4 | 5 | \title{Printing key features} 6 | 7 | \description{ 8 | 'print' displays brief information on an object of class 'drc'. 9 | } 10 | 11 | \usage{ 12 | 13 | \method{print}{drc}(x, ..., digits = max(3, getOption("digits") - 3)) 14 | 15 | } 16 | 17 | \arguments{ 18 | \item{x}{an object of class 'drc'.} 19 | \item{...}{additional arguments.} 20 | \item{digits}{an integer giving the number of digits of the parameter coefficients. Default is 3.} 21 | } 22 | 23 | \author{Christian Ritz} 24 | 25 | \examples{ 26 | 27 | ## Fitting a four-parameter log-logistic model 28 | ryegrass.m1 <- drm(rootl ~conc, data = ryegrass, fct = LL.4()) 29 | 30 | ## Displaying the model fit 31 | print(ryegrass.m1) 32 | ryegrass.m1 # gives the same output as the previous line 33 | 34 | } 35 | \keyword{models} 36 | \keyword{nonlinear} 37 | -------------------------------------------------------------------------------- /man/print.summary.drc.Rd: -------------------------------------------------------------------------------- 1 | \name{print.summary.drc} 2 | 3 | \alias{print.summary.drc} 4 | 5 | \title{Printing summary of non-linear model fits} 6 | 7 | \description{ 8 | This method produces formatted output of the summary statistics: parameter estimates, estimated standard errors, 9 | z-test statistics and corresponding p-values. 10 | } 11 | 12 | \usage{ 13 | 14 | \method{print}{summary.drc}(x, ...) 15 | 16 | } 17 | 18 | \arguments{ 19 | \item{x}{an object of class 'drc'.} 20 | \item{...}{additional arguments.} 21 | } 22 | 23 | \value{ 24 | The object (argument \code{x}) is returned invisibly. 25 | } 26 | 27 | \author{Christian Ritz} 28 | 29 | \examples{ 30 | 31 | ryegrass.m1 <- drm(rootl~conc, data=ryegrass, fct= LL.4()) 32 | 33 | summary(ryegrass.m1) 34 | 35 | } 36 | \keyword{models} 37 | \keyword{nonlinear} 38 | -------------------------------------------------------------------------------- /man/residuals.drc.Rd: -------------------------------------------------------------------------------- 1 | \name{residuals.drc} 2 | 3 | \alias{residuals.drc} 4 | 5 | \title{Extracting residuals from the fitted dose-response model} 6 | 7 | \description{ 8 | 'residuals' extracts different types of residuals from an object of class 'drc'. 9 | } 10 | 11 | \usage{ 12 | 13 | \method{residuals}{drc}(object, typeRes = c("working", "standardised", "studentised"), 14 | trScale = TRUE, ...) 15 | 16 | } 17 | 18 | \arguments{ 19 | \item{object}{an object of class 'drc'.} 20 | \item{typeRes}{character string specifying the type of residual to be returned: raw/working residuals, 21 | residuals standardised using the estimated residual standard error, 22 | or studentised residuals based on the H matrix of partial derivatives of the model function.} 23 | \item{trScale}{logical value indicating whether or not to return residuals on the transformed scale (in case a Box-Cox transformation was applied).} 24 | \item{...}{additional arguments.} 25 | } 26 | 27 | \value{ 28 | The raw (also called working) residuals or some kind of scaled residuals extracted from 'object'. 29 | } 30 | 31 | \details{ 32 | Standardised residuals are the raw residuals divided by a scale estimate (if available). 33 | 34 | Studentised residuals are obtained by dividing by a scale estimate and in 35 | addition a correction factor (square root of 1 minus h with h is a diagonal element in the hat matrix). 36 | } 37 | 38 | \note{ 39 | The 'standardised' residuals are available for least squares estimation 40 | with or without Box-Cox transformation or variance as a power of the 41 | mean. 42 | } 43 | 44 | \author{Christian Ritz} 45 | 46 | \examples{ 47 | 48 | ## Fitting a four-parameter log-logistic model 49 | ryegrass.m1 <- drm(rootl ~conc, data = ryegrass, fct = LL.4()) 50 | 51 | ## Displaying the residual plot (raw residuals) 52 | plot(fitted(ryegrass.m1), residuals(ryegrass.m1)) 53 | 54 | ## Using the standardised residuals 55 | plot(fitted(ryegrass.m1), residuals(ryegrass.m1, typeRes = "standard")) 56 | 57 | ## Overlayering the studentised residuals ... not much of a difference 58 | points(fitted(ryegrass.m1), residuals(ryegrass.m1, typeRes = "student"), col = 2) 59 | 60 | } 61 | \keyword{models} 62 | \keyword{nonlinear} 63 | -------------------------------------------------------------------------------- /man/ryegrass.Rd: -------------------------------------------------------------------------------- 1 | \name{ryegrass} 2 | 3 | \alias{ryegrass} 4 | 5 | \docType{data} 6 | 7 | \title{Effect of ferulic acid on growth of ryegrass} 8 | 9 | \description{ 10 | A single dose-response curve. 11 | } 12 | 13 | \usage{data(ryegrass)} 14 | 15 | \format{ 16 | A data frame with 24 observations on the following 2 variables. 17 | \describe{ 18 | \item{rootl}{a numeric vector of root lengths} 19 | \item{conc}{a numeric vector of concentrations of ferulic acid} 20 | } 21 | } 22 | 23 | \details{ 24 | The data are part of a study to investigate the joint action 25 | of phenolic acids on root growth inhibition of perennial ryegrass (\emph{Lolium perenne L}). 26 | 27 | \code{conc} is the concentration of ferulic acid is in mM, and \code{rootl} is the root length 28 | of perennial ryegrass measured in cm. 29 | } 30 | 31 | \source{ 32 | Inderjit and J. C. Streibig, and M. Olofsdotter (2002) Joint action of 33 | phenolic acid mixtures and its significance in allelopathy 34 | research, \emph{Physiologia Plantarum}, \bold{114}, 422--428, 2002. 35 | } 36 | 37 | \examples{ 38 | 39 | ## Displaying the data set 40 | ryegrass 41 | 42 | ## Fitting a four-parameter Weibull model (type 2) 43 | ryegrass.m1 <- drm(rootl ~ conc, data = ryegrass, fct = W2.4()) 44 | 45 | ## Displaying a summary of the model fit 46 | summary(ryegrass.m1) 47 | 48 | ## Plotting the fitted curve together with the original data 49 | plot(ryegrass.m1) 50 | 51 | ## Fitting a four-parameter Weibull model (type 1) 52 | ryegrass.m2 <- drm(rootl ~ conc, data = ryegrass, fct = W1.4()) 53 | plot(ryegrass.m2) 54 | 55 | ## Fitting a four-parameter log-logistic model 56 | ## with user-defined parameter names 57 | ryegrass.m3 <- drm(rootl ~ conc, data = ryegrass, 58 | fct = LL.4(names = c("Slope", "Lower Limit", "Upper Limit", "ED50"))) 59 | summary(ryegrass.m3) 60 | 61 | ## Comparing log-logistic and Weibull models 62 | ## (Figure 2 in Ritz (2009)) 63 | ryegrass.m0 <- drm(rootl ~ conc, data = ryegrass, fct = LL.4()) 64 | ryegrass.m1 <- drm(rootl ~ conc, data = ryegrass, fct = W1.4()) 65 | ryegrass.m2 <- drm(rootl ~ conc, data = ryegrass, fct = W2.4()) 66 | 67 | plot(ryegrass.m0, broken=TRUE, xlab="Dose (mM)", ylab="Root length (cm)", lwd=2, 68 | cex=1.2, cex.axis=1.2, cex.lab=1.2) 69 | plot(ryegrass.m1, add=TRUE, broken=TRUE, lty=2, lwd=2) 70 | plot(ryegrass.m2, add=TRUE, broken=TRUE, lty=3, lwd=2) 71 | 72 | arrows(3, 7.5, 1.4, 7.5, 0.15, lwd=2) 73 | text(3,7.5, "Weibull-2", pos=4, cex=1.2) 74 | 75 | arrows(2.5, 0.9, 5.7, 0.9, 0.15, lwd=2) 76 | text(3,0.9, "Weibull-1", pos=2, cex=1.2) 77 | 78 | 79 | } 80 | \keyword{datasets} 81 | 82 | -------------------------------------------------------------------------------- /man/searchdrc.Rd: -------------------------------------------------------------------------------- 1 | \name{searchdrc} 2 | \alias{searchdrc} 3 | 4 | \title{Searching through a range of initial parameter values to obtain convergence} 5 | 6 | \description{ 7 | 'searchdrc' provides a facility for searching through a range of parameter values (one-dimensional) 8 | in order to obtain convergence of the estimation procedure. 9 | } 10 | 11 | \usage{ 12 | searchdrc(object, which, range, len = 50) 13 | } 14 | 15 | \arguments{ 16 | \item{object}{an object of class 'drc'. The object can be from a model that could not fitted.} 17 | \item{which}{a character string containing the parameter name} 18 | \item{range}{a numeric vector of length 2 specifying the interval endpoints for the range.} 19 | \item{len}{numeric. The number of points in the interval.} 20 | } 21 | 22 | \details{ 23 | The function goes through the range with increments such that in total at most \code{len} sets of parameter values 24 | are used as initial values for the estimation procedure. You would need to identify the parameter which is most likely to 25 | cause problems for the estimation procedure. 26 | } 27 | 28 | \value{ 29 | An object of class 'drc'. 30 | } 31 | 32 | %\references{ ~put references to the literature/web site here ~ } 33 | 34 | \author{Christian Ritz} 35 | 36 | %\note{ ~~further notes~~ } 37 | 38 | %\seealso{ ~~objects to See Also as \code{\link{~~fun~~}}, ~~~ } 39 | 40 | \examples{ 41 | 42 | ## No example yet 43 | 44 | } 45 | \keyword{models} 46 | \keyword{nonlinear} 47 | -------------------------------------------------------------------------------- /man/secalonic.Rd: -------------------------------------------------------------------------------- 1 | \name{secalonic} 2 | 3 | \alias{secalonic} 4 | 5 | \docType{data} 6 | 7 | \title{Root length measurements} 8 | 9 | \description{ 10 | Data stem from an experiment assessing the inhibitory effect of secalonic acids on plant growth. 11 | } 12 | 13 | \usage{data(secalonic)} 14 | 15 | \format{ 16 | A data frame with 7 observations on the following 2 variables: 17 | \describe{ 18 | \item{\code{dose}}{a numeric vector containing dose values (mM)} 19 | \item{\code{rootl}}{a numeric vector containing root lengths (cm)} 20 | } 21 | } 22 | 23 | \details{ 24 | For each dose the root length is an average three measurements. 25 | } 26 | 27 | \source{ 28 | Gong, X. and Zeng, R. and Luo, S. and Yong, C. and Zheng, Q. (2004) Two new 29 | secalonic acids from \emph{Aspergillus Japonicus} and their allelopathic effects on higher plants, 30 | \emph{Proceedings of International Symposium on Allelopathy Research and Application, 27-29 April, 31 | Shanshui, Guangdong, China (Editors: R. Zeng and S. Luo)}, 209--217. 32 | 33 | Ritz, C (2009) 34 | Towards a unified approach to dose-response modeling in ecotoxicology 35 | \emph{To appear in Environ Toxicol Chem}. 36 | } 37 | 38 | %\references{} 39 | 40 | \examples{ 41 | 42 | ## Fitting a four-parameter log-logistic model 43 | secalonic.m1 <- drm(rootl ~ dose, data = secalonic, fct = LL.4()) 44 | summary(secalonic.m1) 45 | 46 | ## Fitting a three-parameter log-logistic model 47 | ## lower limit fixed at 0 48 | secalonic.m2 <- drm(rootl ~ dose, data = secalonic, fct = LL.3()) 49 | summary(secalonic.m1) 50 | 51 | ## Comparing logistic and log-logistic models 52 | ## (Figure 1 in Ritz (2009)) 53 | secalonic.LL4 <- drm(rootl ~ dose, data = secalonic, fct = LL.4()) 54 | secalonic.L4 <- drm(rootl ~ dose, data = secalonic, fct = L.4()) 55 | 56 | plot(secalonic.LL4, broken=TRUE, ylim=c(0,7), xlab="Dose (mM)", ylab="Root length (cm)", 57 | cex=1.2, cex.axis=1.2, cex.lab=1.2, lwd=2) 58 | 59 | plot(secalonic.L4, broken=TRUE, ylim=c(0,7), add=TRUE, type="none", lty=2, lwd=2) 60 | 61 | abline(h=coef(secalonic.L4)[3], lty=3, lwd=2) 62 | 63 | } 64 | \keyword{datasets} 65 | -------------------------------------------------------------------------------- /man/simDR.Rd: -------------------------------------------------------------------------------- 1 | \name{simDR} 2 | 3 | \alias{simDR} 4 | 5 | \title{Simulating ED values under various scenarios} 6 | 7 | \description{ 8 | Simulating ED values for a given model and given dose values. 9 | } 10 | 11 | \usage{ 12 | simDR(mpar, sigma, fct, noSim = 1000, conc, edVec = c(10, 50), seedVal = 20070723) 13 | } 14 | 15 | \arguments{ 16 | \item{mpar}{numeric vector of model parameters} 17 | \item{sigma}{numeric specifying the residual standard deviation} 18 | \item{fct}{list supplying the chosen mean function} 19 | \item{conc}{numeric vector of concentration/dose values} 20 | \item{edVec}{numeric vector of ED values to estimate in each simulation} 21 | \item{noSim}{numeric giving the number of simulations} 22 | \item{seedVal}{numeric giving the seed used to initiate the random number generator} 23 | } 24 | 25 | \details{ 26 | The arguments \code{mpar} and \code{sigma} are typically obtained from a previous model fit. 27 | 28 | Only dose-response models assuming normally distributed errors can be used. 29 | } 30 | 31 | \value{ 32 | A list of matrices with as many components as there are chosen ED values. The entries in the matrices are 33 | empirical standard deviations of the estimated ED values. Row-wise from top to bottom more and more 34 | concentration/dose values are included in the simulations; top row starting with 5 concentrations. The 35 | number of replicates increases column by column from left to right. 36 | 37 | The list is returned invisbly as the matrices also are displayed. 38 | } 39 | 40 | %\references{ ~put references to the literature/web site here ~ } 41 | 42 | \author{Christian Ritz} 43 | 44 | %\note{} 45 | 46 | %\seealso{ ~~objects to See Also as \code{\link{help}}, ~~~ } 47 | 48 | \examples{ 49 | 50 | ryegrass.m1 <- drm(ryegrass, fct=LL.4()) 51 | 52 | simDR(coef(ryegrass.m1), sqrt(summary(ryegrass.m1)$resVar), LL.4(), 2, 53 | c(1.88, 3.75, 7.50, 0.94, 15, 0.47, 30, 0.23, 60), seedVal = 200710291) 54 | 55 | } 56 | \keyword{models} 57 | \keyword{nonlinear} 58 | -------------------------------------------------------------------------------- /man/spinach.Rd: -------------------------------------------------------------------------------- 1 | \name{spinach} 2 | 3 | \alias{spinach} 4 | 5 | \docType{data} 6 | 7 | \title{Inhibition of photosynthesis} 8 | 9 | \description{ 10 | Data from an experiment investigating the inhibition of photosynthesis in response to two synthetic 11 | photosystem II inhibitors, the herbicides diuron and bentazon. 12 | More specifically, the effect of oxygen consumption of thylakoid membranes (chloroplasts) from spinach 13 | was measured after incubation with the synthetic inhibitors in 5 assays, resulting in 5 dose-response curves. 14 | } 15 | 16 | \usage{data(spinach)} 17 | 18 | \format{ 19 | A data frame with 105 observations on the following four variables: 20 | \describe{ 21 | \item{CURVE}{a numeric vector specifying the assay or curve (a total of 5 independent assays where used in this experiment).} 22 | \item{HERBICIDE}{a character vector specifying the herbicide applied: bentazon or diuron.} 23 | \item{DOSE}{a numeric vector giving the herbicide concentration in muMol.} 24 | \item{SLOPE}{a numeric vector with the measured response: oxygen consumption of thylakoid membranes.} 25 | } 26 | } 27 | 28 | \details{ 29 | The experiment is described in more details by Streibig (1998). 30 | } 31 | 32 | \source{ 33 | Streibig, J. C. (1998) Joint action of natural and synthetic photosystem II inhibitors, \emph{Pesticide Science}, \bold{55}, 137--146. 34 | } 35 | 36 | \examples{ 37 | 38 | ## Displaying the first rows in the dataset 39 | head(spinach) # displaying first 6 rows in the data set 40 | 41 | } 42 | \keyword{datasets} 43 | -------------------------------------------------------------------------------- /man/summary.drc.Rd: -------------------------------------------------------------------------------- 1 | \name{summary.drc} 2 | 3 | \alias{summary.drc} 4 | 5 | \title{Summarising non-linear model fits} 6 | 7 | \description{ 8 | 'summary' compiles a comprehensive summary for objects of class 'drc'. 9 | } 10 | 11 | \usage{ 12 | 13 | \method{summary}{drc}(object, od = FALSE, pool = TRUE, ...) 14 | } 15 | 16 | \arguments{ 17 | \item{object}{an object of class 'drc'.} 18 | \item{od}{logical. If TRUE adjustment for over-dispersion is used.} 19 | \item{pool}{logical. If TRUE curves are pooled. Otherwise they are not. This argument only works for models with 20 | independently fitted curves as specified in \code{\link{drm}}.} 21 | \item{...}{additional arguments.} 22 | } 23 | 24 | \value{ 25 | A list of summary statistics that includes parameter estimates and estimated standard errors. 26 | } 27 | 28 | \author{Christian Ritz} 29 | 30 | \note{ 31 | Examples on usage are for instance found in the help pages of \code{\link{ryegrass}} and \code{\link{secalonic}}. 32 | } 33 | 34 | %\examples{} 35 | 36 | \keyword{models} 37 | \keyword{nonlinear} 38 | -------------------------------------------------------------------------------- /man/terbuthylazin.Rd: -------------------------------------------------------------------------------- 1 | \name{terbuthylazin} 2 | 3 | \alias{terbuthylazin} 4 | 5 | \docType{data} 6 | 7 | \title{The effect of terbuthylazin on growth rate} 8 | 9 | \description{ 10 | Test on the effect of terbuthylazin on \emph{Lemna minor}, performed on an aseptic 11 | culture according to the OECD-guidelines. 12 | } 13 | 14 | \usage{data(terbuthylazin)} 15 | 16 | \format{ 17 | A data frame with 30 observations on the following 2 variables. 18 | \describe{ 19 | \item{dose}{a numeric vector of dose values.} 20 | \item{rgr}{a numeric vector of relative growth rates.} 21 | } 22 | } 23 | 24 | \details{ 25 | Dose is \deqn{\mu l^{-1}} and rgr is the relative growth rate of \emph{Lemna}. 26 | } 27 | 28 | \source{ 29 | Cedergreen N. (2004). Unpublished bioassay data. 30 | } 31 | 32 | \examples{ 33 | 34 | ## displaying first 6 rows of the data set 35 | head(terbuthylazin) 36 | 37 | ## Fitting log-logistic model 38 | terbuthylazin.m1 <- drm(rgr~dose, data = terbuthylazin, fct = LL.4()) 39 | summary(terbuthylazin.m1) 40 | 41 | ## Fitting log-logistic model 42 | ## with Box-Cox transformation 43 | terbuthylazin.m2 <- boxcox(terbuthylazin.m1, method = "anova") 44 | summary(terbuthylazin.m2) 45 | 46 | } 47 | \keyword{datasets} 48 | -------------------------------------------------------------------------------- /man/twophase.Rd: -------------------------------------------------------------------------------- 1 | \name{twophase} 2 | 3 | \Rdversion{1.1} 4 | 5 | \alias{twophase} 6 | 7 | \title{ 8 | Two-phase dose-response model 9 | } 10 | 11 | \description{ 12 | The two-phase dose-response model is a combination of log-logistic models that should be useful for describing 13 | more complex dose-response patterns. 14 | } 15 | 16 | \usage{ 17 | twophase(fixed = c(NA, NA, NA, NA, NA, NA, NA), 18 | names = c("b1", "c1", "d1", "e1", "b2", "d2", "e2"), fctName, fctText) 19 | } 20 | 21 | \arguments{ 22 | \item{fixed}{numeric vector specifying which parameters are fixed and at what value they are fixed. 23 | NAs are used for parameters that are not fixed.} 24 | \item{names}{a vector of character strings giving the names of the parameters (should not contain ":"). 25 | The default is reasonable (see under 'Usage').} 26 | \item{fctName}{optional character string used internally by convenience functions.} 27 | \item{fctText}{optional character string used internally by convenience functions.} 28 | } 29 | 30 | \details{ 31 | Following Groot \emph{et al} (1996) the two-phase model function is defined as follows 32 | 33 | \deqn{ f(x) = c + \frac{d1-c}{1+\exp(b1(\log(x)-\log(e1)))} + \frac{d2}{1+\exp(b2(\log(x)-\log(e2)))}} 34 | 35 | For each of the two phases, the parameters have the same interpretation as in the ordinary log-logistic 36 | model. 37 | } 38 | 39 | \value{ 40 | The value returned is a list containing the nonlinear function, the self starter function 41 | and the parameter names. 42 | } 43 | 44 | \references{ 45 | Groot, J. C. J., Cone, J. W., Williams, B. A., Debersaques, F. M. A., Lantinga, E. A. (1996) 46 | Multiphasic analysis of gas production kinetics for in vitro fermentation of ruminant feeds, 47 | \emph{Animal Feed Science Technology}, \bold{64}, 77--89. 48 | } 49 | 50 | \author{ 51 | Christian Ritz 52 | } 53 | 54 | %\note{} 55 | 56 | \seealso{ 57 | The basic component in the two-phase model is the log-logistic model 58 | \code{\link{llogistic}}. 59 | } 60 | 61 | %\examples{} 62 | 63 | \keyword{models} 64 | \keyword{nonlinear} 65 | -------------------------------------------------------------------------------- /man/update.drc.Rd: -------------------------------------------------------------------------------- 1 | \name{update.drc} 2 | 3 | \alias{update.drc} 4 | 5 | \title{Updating and re-fitting a model} 6 | 7 | \description{ 8 | 'update' updates and re-fits a model on the basis of an object of class 'drc'. 9 | } 10 | 11 | \usage{ 12 | 13 | \method{update}{drc}(object, ..., evaluate = TRUE) 14 | 15 | } 16 | 17 | \arguments{ 18 | \item{object}{an object of class 'drc'.} 19 | \item{...}{arguments to alter in object.} 20 | \item{evaluate}{logical. If TRUE model is re-fit; otherwise an unevaluated call is returned.} 21 | } 22 | 23 | \value{ 24 | An object of class 'drc'. 25 | } 26 | 27 | \author{Christian Ritz} 28 | 29 | \examples{ 30 | 31 | ## Fitting a four-parameter Weibull model 32 | model1 <- drm(ryegrass, fct = W1.4()) 33 | 34 | ## Updating 'model1' by fitting a three-parameter Weibull model instead 35 | model2 <- update(model1, fct = W1.3()) 36 | anova(model2, model1) 37 | 38 | 39 | } 40 | \keyword{models} 41 | \keyword{nonlinear} 42 | -------------------------------------------------------------------------------- /man/vcov.drc.Rd: -------------------------------------------------------------------------------- 1 | \name{vcov.drc} 2 | 3 | \alias{vcov.drc} 4 | 5 | \title{Calculating variance-covariance matrix for objects of class 'drc'} 6 | 7 | \description{ 8 | 'vcov' returns the estimated variance-covariance matrix for the parameters in the non-linear function. 9 | } 10 | 11 | \usage{ 12 | \method{vcov}{drc}(object, ..., corr = FALSE, od = FALSE, pool = TRUE, unscaled = FALSE) 13 | } 14 | 15 | \arguments{ 16 | \item{object}{an object of class 'drc'.} 17 | \item{...}{additional arguments.} 18 | \item{corr}{logical. If TRUE a correlation matrix is returned.} 19 | \item{od}{logical. If TRUE adjustment for over-dispersion is used. This argument only makes a difference for 20 | binomial data.} 21 | \item{pool}{logical. If TRUE curves are pooled. Otherwise they are not. This argument only works for models with 22 | independently fitted curves as specified in \code{\link{drm}}.} 23 | \item{unscaled}{logical. If TRUE the unscaled variance-covariance is returned. This argument only makes a difference 24 | for continuous data.} 25 | } 26 | 27 | \value{ 28 | A matrix of estimated variances and covariances. 29 | } 30 | 31 | \author{Christian Ritz} 32 | 33 | \examples{ 34 | 35 | ## Fitting a four-parameter log-logistic model 36 | ryegrass.m1 <- drm(rootl ~ conc, data = ryegrass, fct = LL.4()) 37 | vcov(ryegrass.m1) 38 | vcov(ryegrass.m1, corr = TRUE) 39 | 40 | } 41 | \keyword{models} 42 | \keyword{nonlinear} 43 | -------------------------------------------------------------------------------- /man/vinclozolin.Rd: -------------------------------------------------------------------------------- 1 | \name{vinclozolin} 2 | 3 | \alias{vinclozolin} 4 | 5 | \docType{data} 6 | 7 | \title{Vinclozolin from AR in vitro assay} 8 | 9 | \description{ 10 | Dose-response experiment with vinclozolin in an AR reporter gene assay 11 | } 12 | 13 | \usage{data(vinclozolin)} 14 | 15 | \format{ 16 | A data frame with 53 observations on the following 3 variables. 17 | \describe{ 18 | \item{\code{exper}}{a factor with levels \code{10509} \code{10821} \code{10828} \code{10904} \code{11023} \code{11106}} 19 | \item{\code{conc}}{a numeric vector of concentrations of vinclozolin} 20 | \item{\code{effect}}{a numeric vector of luminescense effects} 21 | } 22 | } 23 | 24 | \details{ 25 | The basic dose-response experiment was repeated 6 times on different days. Chinese Hamster Ovary cells 26 | were exposed to various concentrations of vinclozolin for 22 hours and the resulting luminescense effects 27 | were recorded. 28 | 29 | Data are part of mixture experiment reported in Nellemann \emph{et al} (2003). 30 | } 31 | 32 | \source{ 33 | Nellemann C., Dalgaard M., Lam H.R. and Vinggaard A.M. (2003) 34 | The combined effects of vinclozolin and procymidone do not deviate from expected additivity \emph{in vitro} 35 | and \emph{in vivo}, \emph{Toxicological Sciences}, \bold{71}, 251--262. 36 | } 37 | 38 | %\references{} 39 | 40 | \examples{ 41 | 42 | 43 | vinclozolin.m1 <- drm(effect~conc, exper, data=vinclozolin, fct = LL.3()) 44 | plot(vinclozolin.m1, xlim=c(0,50), ylim=c(0,2800), conLevel=1e-4) 45 | 46 | vinclozolin.m2 <- drm(effect~conc, data=vinclozolin, fct = LL.3()) 47 | plot(vinclozolin.m2, xlim=c(0,50), conLevel=1e-4, add=TRUE, type="none", col="red") 48 | 49 | ## Are the ED50 values indetical across experiments? 50 | vinclozolin.m3 <- update(vinclozolin.m1, pmodels=data.frame(exper, exper, 1)) 51 | anova(vinclozolin.m3, vinclozolin.m1) # No! 52 | 53 | } 54 | \keyword{datasets} 55 | -------------------------------------------------------------------------------- /man/yieldLoss.Rd: -------------------------------------------------------------------------------- 1 | \name{yieldLoss} 2 | 3 | \alias{yieldLoss} 4 | 5 | \title{Calculating yield loss parameters} 6 | 7 | \description{ 8 | Calculation of parameters in the re-parameterization of the Michaelis-Menten model that is commonly 9 | used to assess yield loss (the rectangular hyperbola model) 10 | } 11 | 12 | \usage{ 13 | yieldLoss(object, interval = c("none", "as"), level = 0.95, display = TRUE) 14 | } 15 | 16 | \arguments{ 17 | \item{object}{object of class 'drc} 18 | \item{interval}{character string specifying the type of confidence intervals to be supplied. The default is "none". 19 | Use "as" for asymptotically-based confidence intervals.} 20 | \item{level}{numeric. The level for the confidence intervals. The default is 0.95.} 21 | \item{display}{logical. If TRUE results are displayed. Otherwise they are not (useful in simulations).} 22 | } 23 | 24 | \details{ 25 | The rectangular hyperbola model is a reparameterization of the Michaelis-Menten in terms of parameters 26 | \eqn{A} and \eqn{I} 27 | 28 | \deqn{ Y_L = \frac{Id}{1+Id/A}} 29 | 30 | where \eqn{d} denotes the weed density and \eqn{Y_L} the resulting yield loss. 31 | } 32 | 33 | \value{ 34 | For each of the two parameters, a matrix with two or more columns, containing the estimates 35 | and the corresponding estimated standard errors and possibly lower and upper confidence limits. 36 | } 37 | 38 | \references{ 39 | Cousens, R. (1985). A simple model relating yield loss to weed density, 40 | \emph{Ann. Appl. Biol.}, \bold{107}, 239--252. 41 | } 42 | 43 | \author{Christian Ritz} 44 | 45 | \note{ 46 | This function is only for use with model fits based on Michaelis-Menten models. 47 | } 48 | 49 | %\seealso{} 50 | 51 | \examples{ 52 | 53 | ## Fitting Michaelis-Menten model 54 | met.mm.m1 <- drm(gain~dose, product, data = methionine, fct = MM.3(), 55 | pmodels = list(~1, ~factor(product), ~factor(product))) 56 | 57 | ## Yield loss parameters with standard errrors 58 | yieldLoss(met.mm.m1) 59 | 60 | ## Also showing confidence intervals 61 | yieldLoss(met.mm.m1, "as") 62 | 63 | } 64 | 65 | \keyword{models} 66 | \keyword{nonlinear} 67 | 68 | \concept{rectangular hyperbola model} 69 | -------------------------------------------------------------------------------- /tests/test1.R: -------------------------------------------------------------------------------- 1 | ## Test provided by Eddy Delpierre 2007-01-11 2 | 3 | 4 | #data1 <- read.table("c://stat//projects//R//drcurves//r-part//pkgfolder//drc//tests//test1.data1.txt", header = TRUE) 5 | data1 <- read.table("test1.data1.txt", header = TRUE) 6 | #data2 <- read.table("c://stat//projects//R//drcurves//r-part//pkgfolder//drc//tests//test1.w1.txt", header = TRUE) 7 | data2 <- read.table("test1.w1.txt", header = TRUE) 8 | 9 | library(drc) 10 | 11 | #FIT1 <- drm(y~x, data = data1, fct = LL.4()) 12 | #summary(FIT1) 13 | 14 | FIT2 <- drm(y~x, data = data1, fct = LL.4(method = "3")) 15 | summary(FIT2) 16 | 17 | FIT3 <- drm(y~x, data = data1, fct = LL.4(method = "3"), weights = data2[, 2]) 18 | summary(FIT3) 19 | plot(FIT3) 20 | 21 | FIT4a <- drm(y~x, data=data1, fct=LL.4(fixed=c(6, -5e-9, NA, NA), method = "3")) 22 | summary(FIT4a) 23 | plot(FIT4a) 24 | 25 | FIT4 <- drm(y~x, data=data1, fct=LL.4(fixed=c(6, -5e-9, NA, NA), method = "3"), weights=data2[, 2]) 26 | summary(FIT4) 27 | plot(FIT4) 28 | 29 | FIT5 <- drm(y~x, data=data1, fct=LL.4(fixed=c(NA,1E-9,5E-8,1E+12))) 30 | summary(FIT5) 31 | 32 | FIT6 <- drm(y~x, data=data1, fct=LL.4(fixed=c(NA,1E-9,5E-8,1E+12), method = "2")) 33 | summary(FIT6) 34 | -------------------------------------------------------------------------------- /tests/test1.data1.txt: -------------------------------------------------------------------------------- 1 | no y x 2 | 1 3.641576e-08 1.0e-15 3 | 2 3.790695e-08 1.0e-15 4 | 3 3.414660e-08 1.0e-15 5 | 4 4.092381e-08 2.0e+05 6 | 5 4.475260e-08 2.0e+05 7 | 6 3.321342e-08 2.0e+05 8 | 7 4.550796e-08 7.0e+08 9 | 8 3.455892e-08 7.0e+08 10 | 9 3.951095e-08 7.0e+08 11 | 10 4.137666e-08 3.0e+10 12 | 11 4.596439e-08 3.0e+10 13 | 12 3.619490e-08 3.0e+10 14 | 13 3.558301e-08 6.0e+11 15 | 14 2.790208e-08 6.0e+11 16 | 15 3.526419e-08 6.0e+11 17 | 16 1.991840e-08 8.0e+11 18 | 17 2.311384e-08 8.0e+11 19 | 18 2.268084e-08 8.0e+11 20 | 19 1.586795e-08 8.5e+11 21 | 20 1.725204e-08 8.5e+11 22 | 21 1.721599e-08 8.5e+11 23 | 22 1.353287e-08 9.0e+11 24 | 23 1.511435e-08 9.0e+11 25 | 24 1.242025e-08 9.0e+11 26 | 25 9.421442e-09 9.5e+11 27 | 26 9.228599e-09 9.5e+11 28 | 27 1.103911e-08 9.5e+11 29 | 28 7.549732e-09 1.0e+12 30 | 29 7.359270e-09 1.0e+12 31 | 30 8.346784e-09 1.0e+12 32 | -------------------------------------------------------------------------------- /tests/test1.w1.txt: -------------------------------------------------------------------------------- 1 | no W 2 | 1 5240.290 3 | 2 5136.184 4 | 3 5411.607 5 | 4 4943.243 6 | 5 4727.057 7 | 6 5487.104 8 | 7 4687.662 9 | 8 5379.228 10 | 9 5030.849 11 | 10 4916.118 12 | 11 4664.330 13 | 12 5256.254 14 | 13 5301.255 15 | 14 5986.620 16 | 15 5325.165 17 | 16 7085.537 18 | 17 6577.547 19 | 18 6640.036 20 | 19 7938.521 21 | 20 7613.420 22 | 21 7621.387 23 | 22 8596.171 24 | 23 8134.020 25 | 24 8972.941 26 | 25 10302.469 27 | 26 10409.554 28 | 27 9517.721 29 | 28 11508.911 30 | 29 11656.888 31 | 30 10945.621 32 | -------------------------------------------------------------------------------- /tests/test2.R: -------------------------------------------------------------------------------- 1 | ## Test provided by Pamela Hutchinson 2007-02-05 2 | 3 | #pam <- read.csv("c://stat//projects//R//drcurves//r-part//pkgfolder//drc//tests//test2.redroot_dose.csv") 4 | pam <- read.csv("test2.redroot_dose.csv") 5 | 6 | library(drc) 7 | 8 | ## Initial model: different parameters for the resistant curve 9 | ## and for the susceptible curve 10 | 11 | ## Temporarily taken out (May 23 2009) 12 | 13 | #m1 <- drm(biomass~dose, population, data=pam, fct=LL.4(method = "3")) 14 | #summary(m1) 15 | #plot(m1) 16 | 17 | 18 | ## Reduced model: common slope, lower and upper parameter for both curves, 19 | ## but e/ED50 parameters differ 20 | 21 | #m2 <- drm(biomass~dose, population, data=pam, fct=LL.4(method = "3"), pmodels=data.frame(1,1,1,population)) 22 | #summary(m2) 23 | #plot(m2) 24 | #anova(m2,m1) 25 | 26 | ## Further reduced model: all parameters in common 27 | ## This model is too simple: it is rejected 28 | 29 | #m3 <- drm(biomass~dose, population, data=pam, fct=LL.4(method = "3"), pmodels=data.frame(1,1,1,1)) 30 | #summary(m3) 31 | #plot(m3) 32 | #anova(m3,m2) 33 | 34 | 35 | ## Final model is 'm2' with different ED50 values for resistant and susceptible, 36 | ## but the remaining parameters in common 37 | 38 | -------------------------------------------------------------------------------- /tests/test3.R: -------------------------------------------------------------------------------- 1 | ## Test provided by Nicholas Lewin-Koh 2007-03-01 2 | 3 | library(drc) 4 | 5 | # First dataset 6 | dat1 <- 7 | structure(list(conc = c(500, 250, 125, 62.5, 31.25, 15.625, 7.8125, 8 | 3.90625, 500, 250, 125, 62.5, 31.25, 15.625, 7.8125, 3.90625, 9 | 500, 250, 125, 62.5, 31.25, 15.625, 7.8125, 3.90625), 10 | response = 11 | c(2.756, 2.167, 1.38, 0.873, 0.571, 0.43, 0.361, 0.326, 2.82, 2.174, 1.402, 12 | 0.911, 0.593, 0.458, 0.387, 0.348, 2.732, 2.143, 1.419, 0.874, 13 | 0.582, 0.442, 0.366, 0.331)), 14 | .Names = c("conc", "response"), 15 | row.names = as.integer(c(1, 2, 3, 4, 5, 6, 7, 8, 17, 18, 19, 20, 21, 22, 23, 24, 33, 34, 16 | 35, 36, 37, 38, 39, 40)), 17 | class = "data.frame") 18 | 19 | m1 <- drm(response~conc, data=dat1, fct=LL.4()) 20 | #m2 <- drm(response~conc, data=dat1, fct=LL.4(), adjust="vp") # huge standard errors 21 | 22 | 23 | ## Second dataset 24 | dat2 <- 25 | structure(list(conc = c(500, 250, 125, 62.5, 31.25, 15.625, 7.8125, 26 | 3.90625, 500, 250, 125, 62.5, 31.25, 15.625, 7.8125, 3.90625, 27 | 500, 250, 125, 62.5, 31.25, 15.625, 7.8125, 3.90625), 28 | response = c(2.943, 2.337, 1.521, 0.989, 0.669, 0.481, 0.413, 0.36, 2.952, 2.272, 29 | 1.518, 0.974, 0.648, 0.493, 0.413, 0.36, 2.943, 2.309, 1.505, 30 | 0.979, 0.649, 0.478, 0.387, 0.34)), 31 | .Names = c("conc", "response" ), 32 | row.names = as.integer(c(49, 50, 51, 52, 53, 54, 55, 56, 65, 33 | 66, 67, 68, 69, 70, 71, 72, 81, 82, 83, 84, 85, 86, 87, 88)), 34 | class = "data.frame") 35 | 36 | m3 <- drm(response~conc, data=dat2, fct=LL.4()) 37 | #m4 <- drm(response~conc, data=dat2, fct=LL.4(), adjust="vp") # huge standard errors 38 | --------------------------------------------------------------------------------