From d6c4ee394a4b09a1658c06e06139633f9be10c74 Mon Sep 17 00:00:00 2001 From: Fersoil Date: Mon, 27 Jan 2025 12:48:09 +0100 Subject: [PATCH 1/3] updated the documentation according to CRAN guidelines --- R/helpers.R | 9 +++--- man/convertToProp.Rd | 8 +++--- man/getEstimates.Rd | 39 +++++++++++++------------- man/nplr.Rd | 66 +++++++++++++++++++++++--------------------- 4 files changed, 64 insertions(+), 58 deletions(-) diff --git a/R/helpers.R b/R/helpers.R index 2eccd9f..d5e44fc 100755 --- a/R/helpers.R +++ b/R/helpers.R @@ -142,10 +142,11 @@ test4 <- try(nlm(f=.sce, p=.initPars(x, y, 4), x=x, yobs=y, .weight, LPweight, .nPL4), silent=TRUE) test5 <- try(nlm(f=.sce, p=.initPars(x, y, 5), x=x, yobs=y, .weight, LPweight, .nPL5), silent=TRUE) scores <- sapply(list(test2, test3, test4, test5), function(t){ - if(class(t)!="try-error") + if (inherits(t, "try-error")) { + return(Inf) + } else { return(t$minimum) - else - return(Inf) + } }) return(scores) }) @@ -155,7 +156,7 @@ n <- length(y) S2y <- var(y, na.rm = TRUE) SSres <- sum((yfit - y)^2, na.rm = TRUE) - wSSres <- sum(w*(yfit - y)^2, na.rm = TRUE) + wSSres <- sum(w*(yfit - y)^2, na.rm = TRUE) SStot <- sum((y - mean(y, na.rm = TRUE))^2, na.rm = TRUE) return(list(gof = 1 - SSres/SStot, wgof = 1 - wSSres/SStot)) diff --git a/man/convertToProp.Rd b/man/convertToProp.Rd index 9d8c2d0..65345e3 100755 --- a/man/convertToProp.Rd +++ b/man/convertToProp.Rd @@ -49,7 +49,7 @@ except for multicell.tsv which are simulated data. require(nplr) path <- system.file("extdata", "mdan.txt", package = "nplr") mdan <- read.delim(path) - + # fit a model on the original responses (proportions of control): conc <- mdan$CONC y0 <- mdan$GIPROP @@ -58,11 +58,11 @@ except for multicell.tsv which are simulated data. # Adjust the data between 0 to 1, then fit a new model: y1 <- convertToProp(y0) model1 <- nplr(conc, y1) - + par(mfrow=c(1, 2)) plot(model0, ylim = range(0, 1), main = "Original y values") plot(model1, ylim = range(0, 1), main = "Rescaled y values") par(op) } -\keyword{ ~kwd1 } -\keyword{ ~kwd2 } +\keyword{proportions} +\keyword{normalization} diff --git a/man/getEstimates.Rd b/man/getEstimates.Rd index 8a5c776..7070269 100755 --- a/man/getEstimates.Rd +++ b/man/getEstimates.Rd @@ -6,43 +6,43 @@ Function to Estimate x Given y. } \description{ - This function takes as its first argument a model returned by \code{nplr()}. By inverting the logistic model, it estimates the x values corresponding to one (or a vector of) y target(s) provided. The standard error of the model, defined as the mean squared error on the fitted values, is used to estimate a confidence interval on the predicted x values, according to the specified \code{conf.level}. see \code{Details}. + This function takes as its first argument a model returned by \code{nplr()}. By inverting the logistic model, it estimates the x values corresponding to one (or a vector of) y target(s) provided. The standard error of the model, defined as the mean squared error on the fitted values, is used to estimate a confidence interval on the predicted x values, according to the specified \code{conf.level}. See \code{Details}. } \usage{ \S4method{getEstimates}{nplr}(object, targets = seq(.9, .1, by = -.1), B = 1e4, conf.level = .95) } \arguments{ - \item{object}{ : an object of class \code{nplr}.} - \item{targets}{ : one, of a vector of, numerical value(s) for which the corresponding x has to be estimated. Default are target values from .9 to .1.} - \item{B}{ : the length of the y distribution from which the x confidence interval is estimated.} - \item{conf.level}{ : the estimated x confidence interval, bounded by (1-conf.level)/2 and 1 - (1-conf.level)/2 (by default .95, which gives x.025 and x.975).} + \item{object}{an object of class \code{nplr}.} + \item{targets}{one, or a vector of, numerical value(s) for which the corresponding x has to be estimated. Default are target values from .9 to .1.} + \item{B}{the length of the y distribution from which the x confidence interval is estimated.} + \item{conf.level}{the estimated x confidence interval, bounded by (1-conf.level)/2 and 1 - (1-conf.level)/2 (by default .95, which gives x.025 and x.975).} } \details{ In n-parameter logistic regressions, none of the parameters follow any particular distribution from which confidence intervals can be estimated. To overcome this issue, the standard error is used to generate a normal distribution of the target(s) passed to the function. The quantiles of that distribution are used in order to provide estimated bounds for the corresponding x value, with respect to \code{conf.level}. -See also \code{Warning}. + See also \code{Warning}. } \value{ A data set containing: - \item{y}{ : the target value.} - \item{x.05}{ : the lower bound of the estimated 95\% confidence interval (default). If another value is passed to conf.level, x will be labelled as x.(1-conf.level)/2.} - \item{x}{ : the estimated value.} - \item{x.95}{ : the upper bound of the estimated 95\% confidence interval (default). If another value is passed to conf.level, x will be labelled as x.1-(1-conf.level)/2.} - + \describe{ + \item{y}{the target value.} + \item{x.05}{the lower bound of the estimated 95\% confidence interval (default). If another value is passed to conf.level, x will be labelled as x.(1-conf.level)/2.} + \item{x}{the estimated value.} + \item{x.95}{the upper bound of the estimated 95\% confidence interval (default). If another value is passed to conf.level, x will be labelled as x.1-(1-conf.level)/2.} + } } \author{ -Frederic Commo, Brian M. Bot + Frederic Commo, Brian M. Bot } \section{Warning}{ - Notice that, if any \eqn{target<=B} or \eqn{target>=T}, in other words outside the 2 asymptotes, the maximal (or minimal) possible value the model can estimates is returned. + Notice that, if any \eqn{target \leq B} or \eqn{target \geq T}, in other words outside the 2 asymptotes, the maximal (or minimal) possible value the model can estimate is returned. } \seealso{ - \code{\link{nplr}}, \code{\link{plot.nplr}}, , \code{\link{nplrAccessors}} + \code{\link{nplr}}, \code{\link{plot.nplr}}, \code{\link{nplrAccessors}} } \note{ -The data used in the examples are samples from the NCI-60 Growth Inhibition Data: \url{https://wiki.nci.nih.gov/display/NCIDTPdata/NCI-60+Growth+Inhibition+Data}, -except for multicell.tsv which are simulated data. + The data used in the examples are samples from the NCI-60 Growth Inhibition Data: \url{https://wiki.nci.nih.gov/display/NCIDTPdata/NCI-60+Growth+Inhibition+Data}, + except for multicell.tsv which are simulated data. } - \examples{ # Using the PC-3 data require(nplr) @@ -52,5 +52,6 @@ except for multicell.tsv which are simulated data. getEstimates(model) getEstimates(model, c(.3, .6), conf.level = .9) } -\keyword{ ~kwd1 } -\keyword{ ~kwd2 } +\keyword{logistic} +\keyword{regression} +\keyword{confidence-interval} diff --git a/man/nplr.Rd b/man/nplr.Rd index fa7ad05..69b6278 100755 --- a/man/nplr.Rd +++ b/man/nplr.Rd @@ -16,13 +16,13 @@ nplr(x, y, useLog = TRUE, LPweight = 0.25, npars = "all", } \arguments{ - \item{x}{ : a vector of numeric values, e.g. a vector of drug concentrations.} - \item{y}{ : a vector of numeric values, e.g. a vector of responses, typicaly provided as proportions of control.} - \item{useLog}{ : Logical. Should x-values be Log10-transformed. Default to \code{TRUE}, set to \code{FALSE} if x is already in Log10.} - \item{LPweight}{ : a coefficient to adjust the weights. \eqn{LPweight = 0} will compute a non-weighted np-logistic regression.} - \item{npars}{ : a numeric value (or \code{"all"}) to specify the number of parameters to use in the model. If \code{"all"} the logistic model will be tested with 2 to 5 parameters, and the best option will be returned. See \code{Details}} - \item{method}{ : a character string to specify what weight method to use. Options are \code{"res"(Default), "sdw", "gw"}. See \code{Details}} - \item{silent}{ : Logical. Specify whether \code{warnings} ad/or \code{messages} has to be silenced. Default to \code{FALSE}.} + \item{x}{a vector of numeric values, e.g., a vector of drug concentrations.} + \item{y}{a vector of numeric values, e.g., a vector of responses, typically provided as proportions of control.} + \item{useLog}{Logical. Should x-values be Log10-transformed? Default is \code{TRUE}; set to \code{FALSE} if x is already in Log10.} + \item{LPweight}{a coefficient to adjust the weights. \eqn{LPweight = 0} will compute a non-weighted np-logistic regression.} + \item{npars}{a numeric value (or \code{"all"}) to specify the number of parameters to use in the model. If \code{"all"}, the logistic model will be tested with 2 to 5 parameters, and the best option will be returned. See \code{Details}.} + \item{method}{a character string to specify which weight method to use. Options are \code{"res" (Default), "sdw", "gw"}. See \code{Details}.} + \item{silent}{Logical. Specify whether \code{warnings} and/or \code{messages} should be silenced. Default is \code{FALSE}.} } \details{ @@ -30,35 +30,35 @@ The 5-parameter logistic regression is of the form: \deqn{ y = B + (T - B)/[1 + 10^(b*(xmid - x))]^s } -where \code{B} and \code{T} are the bottom and top asymptotes, respectively, \code{b} and \code{xmid} are the Hill slope and the x-coordinate at the inflexion point, respectively, and s is an asymetric coefficient. This equation is sometimes refered to as the Richards' equation [1,2]. +where \code{B} and \code{T} are the bottom and top asymptotes, respectively, \code{b} and \code{xmid} are the Hill slope and the x-coordinate at the inflection point, respectively, and \code{s} is an asymmetric coefficient. This equation is sometimes referred to as the Richards' equation [1,2]. -When specifying \code{npars = 4}, the \code{s} parameter is forced to be \code{1}, and the corresponding model is a 4-parameter logistic regression, symetrical around its inflexion point. When specifying \code{npars = 3 or npars = 2}, add 2 more constraints and force \code{B} and \code{T} to be \code{0} and \code{1}, respectively. +When specifying \code{npars = 4}, the \code{s} parameter is forced to be \code{1}, and the corresponding model is a 4-parameter logistic regression, symmetrical around its inflection point. When specifying \code{npars = 3} or \code{npars = 2}, two more constraints are added, forcing \code{B} and \code{T} to be \code{0} and \code{1}, respectively. Weight methods: -The model parameters are optimized, simultaneously, using \href{http://stat.ethz.ch/R-manual/R-devel/library/stats/html/nlm.html}{nlm}, given a sum of squared errors function, sse(Y), to minimize: +The model parameters are optimized, simultaneously, using \href{http://stat.ethz.ch/R-manual/R-devel/library/stats/html/nlm.html}{nlm}, given a sum of squared errors function, \eqn{sse(Y)}, to minimize: \deqn{ sse(Y) = \Sigma [W.(Yobs - Yfit)^2 ] } -where Yobs, Yfit and W are the vectors of observed values, fitted values and weights, respectively. +where \code{Yobs}, \code{Yfit}, and \code{W} are the vectors of observed values, fitted values, and weights, respectively. In order to reduce the effect of possible outliers, the weights can be computed in different ways, specified in \code{nplr}: -\itemize{ +\describe{ \item{residual weights, \code{"res"}:}{ \deqn{ W = (1/residuals)^LPweight } where \code{residuals} and \code{LPweight} are the squared error between the observed and fitted values, and a tuning parameter, respectively. Best results are generally obtained by setting \eqn{LPweight = 0.25} (default value), while setting \eqn{LPweight = 0} results in computing a non-weighted sum of squared errors. - } + } \item{standard weights, \code{"sdw"}:}{ \deqn{ W = 1/Var(Yobs_r) } where \code{Var(Yobs_r)} is the vector of the within-replicates variances. - } + } \item{general weights, \code{"gw"}:}{ \deqn{ W = 1/Yfit^LPweight } where \code{Yfit} are the fitted values. As for the residuals-weights method, setting \eqn{LPweight = 0} results in computing a non-weighted sum of squared errors. - } } - The \code{standard weights} and \code{general weights} methods are describes in [3]. +} +The \code{standard weights} and \code{general weights} methods are described in [3]. } \value{ @@ -66,21 +66,21 @@ An object of class \code{nplr}. } \section{slots}{ - \itemize{ - \item{x}{ : the x values as they are used in the model. It can be \code{Log10(x)} if \code{useLog} was set to \code{TRUE}.} - \item{y}{ : the y values.} - \item{useLog}{ : logical.} - \item{npars}{ : the best number of parameters if \code{npars="all", the specified number of parameters, otherwise.}} - \item{LPweight}{ : the weights tuning parameter.} - \item{yFit}{ : the y fitted values.} - \item{xCurve}{ : the x values generated to draw the curve. 200 points between the \code{min} and \code{max} of x.} - \item{yCurve}{ : the fitted values used to draw the curve. the fitted values corresponding to \code{xCurve}.} - \item{inflPoint}{ : the inflexion point x and y coordinates.} - \item{goodness}{ : the goodness-of-fit. The correlation between the fitted and the observed y values} - \item{stdErr}{ : the mean squared error between the fitted and the observed y values} - \item{pars}{ : the model parameters.} - \item{AUC}{ : the area under the curve estimated using both the trapezoid method and the Simpson's rule.} - } + \describe{ + \item{x}{the x values as they are used in the model. It can be \code{Log10(x)} if \code{useLog} was set to \code{TRUE}.} + \item{y}{the y values.} + \item{useLog}{logical.} + \item{npars}{the best number of parameters if \code{npars="all"}, or the specified number of parameters otherwise.} + \item{LPweight}{the weights tuning parameter.} + \item{yFit}{the y fitted values.} + \item{xCurve}{the x values generated to draw the curve. 200 points between the \code{min} and \code{max} of x.} + \item{yCurve}{the fitted values used to draw the curve. These correspond to \code{xCurve}.} + \item{inflPoint}{the inflection point x and y coordinates.} + \item{goodness}{the goodness-of-fit. The correlation between the fitted and the observed y values.} + \item{stdErr}{the mean squared error between the fitted and the observed y values.} + \item{pars}{the model parameters.} + \item{AUC}{the area under the curve estimated using both the trapezoid method and Simpson's rule.} + } } \references{ @@ -90,16 +90,20 @@ An object of class \code{nplr}. 3- Motulsky HJ, Brown RE. Detecting outliers when fitting data with nonlinear regression - a new method based on robust nonlinear regression and the false discovery rate. BMC Bioinformatics. 2006 Mar 9;7:123. } + \author{ Frederic Commo, Brian M. Bot } + \seealso{ \code{\link{convertToProp}}, \code{\link{getEstimates}}, \code{\link{plot.nplr}}, \code{\link{nplrAccessors}} } + \note{ The data used in the examples are samples from the NCI-60 Growth Inhibition Data: \url{https://wiki.nci.nih.gov/display/NCIDTPdata/NCI-60+Growth+Inhibition+Data}, except for multicell.tsv which are simulated data. } + \examples{ # Using the PC-3 data require(nplr) From 36c306fdfa7c98980d5a8c427d47e6159233e303 Mon Sep 17 00:00:00 2001 From: Fersoil Date: Fri, 14 Feb 2025 10:45:15 +0100 Subject: [PATCH 2/3] update of the package maintainer --- DESCRIPTION | 14 ++++++++------ NEWS | 11 ++++++++++- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 194adf7..2486fcf 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,19 +1,21 @@ Package: nplr Type: Package Title: N-Parameter Logistic Regression -Version: 0.1-7 +Version: 0.1-8 Date: 2016-12-25 Authors@R: c(person(given="Frederic", family="Commo", role=c("aut", "cre"), email="fredcommo@gmail.com"), - person(given="Brian M.", family="Bot", role="aut")) -Maintainer: Frederic Commo + person(given="Brian M.", family="Bot", role="aut"), + person(given="Tymoteusz", family="Kwiecinski", email = "tymoteuszkwiecinski@gmail.com", role = c("aut"), + comment = c(ORCID = "0009-0006-7362-9821"))) +Maintainer: Tymoteusz Kwiecinski Depends: methods Imports: stats,graphics,utils Suggests: RUnit,knitr VignetteBuilder: knitr Description: Performing drug response analyses and IC50 estimations using n-Parameter logistic regression. Can also be applied to proliferation analyses. License: GPL -URL: https://github.com/fredcommo/nplr +URL: https://github.com/mini-pw/nplr NeedsCompilation: no -Packaged: 2015-07-25 06:25:19 UTC; fredcommo Author: Frederic Commo [aut, cre], - Brian M. Bot [aut] + Brian M. Bot [aut], + Tymoteusz Kwiecinski [aut] diff --git a/NEWS b/NEWS index 7df707a..30dabc3 100755 --- a/NEWS +++ b/NEWS @@ -1,9 +1,18 @@ R News +nplr package 0.1-8 +----------------------- +SIGNIFICANT USER-VISIBLE CHANGES + * The maintainer of the package has changed. + +BUG FIXES + * The package documentation was updated and now passes R CMD check + without warnings or errors. + nplr package 0.1-7 ----------------------- SIGNIFICANT USER-VISIBLE CHANGES - * Both GOF and weighted GOF are computed. They are returned in the model summary + * Both GOF and weighted GOF are computed. They are returned in the model summary and can be displayed in the plot. See vignette for details. nplr package 0.1-6 From 4407822281ec6c99ab41e50112743982a8a2864b Mon Sep 17 00:00:00 2001 From: Fersoil Date: Tue, 18 Feb 2025 01:05:46 +0100 Subject: [PATCH 3/3] update the DESCRIPTION file --- DESCRIPTION | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 2486fcf..c210612 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,10 +2,9 @@ Package: nplr Type: Package Title: N-Parameter Logistic Regression Version: 0.1-8 -Date: 2016-12-25 -Authors@R: c(person(given="Frederic", family="Commo", role=c("aut", "cre"), email="fredcommo@gmail.com"), +Authors@R: c(person(given="Frederic", family="Commo", role=c("aut"), email="fredcommo@gmail.com"), person(given="Brian M.", family="Bot", role="aut"), - person(given="Tymoteusz", family="Kwiecinski", email = "tymoteuszkwiecinski@gmail.com", role = c("aut"), + person(given="Tymoteusz", family="Kwiecinski", email = "tymoteuszkwiecinski@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0009-0006-7362-9821"))) Maintainer: Tymoteusz Kwiecinski Depends: methods @@ -16,6 +15,3 @@ Description: Performing drug response analyses and IC50 estimations using n-Para License: GPL URL: https://github.com/mini-pw/nplr NeedsCompilation: no -Author: Frederic Commo [aut, cre], - Brian M. Bot [aut], - Tymoteusz Kwiecinski [aut]