From 57f0b610ef11de8fafb63a929301aa98cde05cc3 Mon Sep 17 00:00:00 2001 From: schuemie Date: Tue, 16 Jul 2024 16:28:53 +0200 Subject: [PATCH] Renaming maxRetry to maxResets. Fixes #75 --- DESCRIPTION | 2 +- NEWS.md | 2 +- R/ModelFit.R | 7 ++++--- man/cyclops.Rd | 30 +++++++++++++++++++++++++++ man/getCyclopsProfileLogLikelihood.Rd | 5 +++-- 5 files changed, 39 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 1fca0135..cc0d6734 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -52,6 +52,6 @@ Suggests: microbenchmark, cmprsk NeedsCompilation: yes -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 Roxygen: list(markdown = TRUE) Encoding: UTF-8 diff --git a/NEWS.md b/NEWS.md index bcae97c3..819da7fb 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,7 +1,7 @@ develop ============== -1. make `maxRety` a function parameter +1. make `maxResets` a function parameter Cyclops v3.4.1 ============== diff --git a/R/ModelFit.R b/R/ModelFit.R index 5ad842d5..a7da0db0 100644 --- a/R/ModelFit.R +++ b/R/ModelFit.R @@ -902,7 +902,8 @@ confint.cyclopsFit <- function(object, parm, level = 0.95, #control, #' @param bounds Pair of values to bound adaptive profiling #' @param tolerance Absolute tolerance allowed for adaptive profiling #' @param initialGridSize Initial grid size for adaptive profiling -#' @param maxRetry Maximum number of attempts to profile likelihood +#' @param maxResets Maximum allowed number of recomputing the likelihood when coefficient drift is +#' detected. #' @param includePenalty Logical: Include regularized covariate penalty in profile #' #' @return @@ -916,7 +917,7 @@ getCyclopsProfileLogLikelihood <- function(object, bounds = NULL, tolerance = 1E-3, initialGridSize = 10, - maxRetry = 10, + maxResets = 10, includePenalty = TRUE) { if (!xor(is.null(x), is.null(bounds))) { @@ -965,7 +966,7 @@ getCyclopsProfileLogLikelihood <- function(object, deltaY <- profile$value[2:nrow(profile)] - profile$value[1:(nrow(profile) - 1)] slopes <- deltaY / deltaX - if (resetsPerformed < maxRetry && !all(slopes[2:length(slopes)] < slopes[1:(length(slopes)-1)])) { + if (resetsPerformed < maxResets && !all(slopes[2:length(slopes)] < slopes[1:(length(slopes)-1)])) { warning("Coefficient drift detected. Resetting Cyclops object and recomputing all likelihood values computed so far.") grid <- profile$point profile <- tibble() diff --git a/man/cyclops.Rd b/man/cyclops.Rd index 91673aa5..2936c6f2 100644 --- a/man/cyclops.Rd +++ b/man/cyclops.Rd @@ -11,3 +11,33 @@ found in large-scale observational healthcare data. Implementations focus on computational optimization and fine-scale parallelization to yield efficient inference in massive datasets. } +\seealso{ +Useful links: +\itemize{ + \item \url{https://github.com/ohdsi/cyclops} + \item Report bugs at \url{https://github.com/ohdsi/cyclops/issues} +} + +} +\author{ +\strong{Maintainer}: Marc A. Suchard \email{msuchard@ucla.edu} + +Authors: +\itemize{ + \item Martijn J. Schuemie + \item Trevor R. Shaddox + \item Yuxi Tian + \item Jianxiao Yang + \item Eric Kawaguchi +} + +Other contributors: +\itemize{ + \item Sushil Mittal [contributor] + \item Observational Health Data Sciences and Informatics [copyright holder] + \item Marcus Geelnard (provided the TinyThread library) [copyright holder, contributor] + \item Rutgers University (provided the HParSearch routine) [copyright holder, contributor] + \item R Development Core Team (provided the ZeroIn routine) [copyright holder, contributor] +} + +} diff --git a/man/getCyclopsProfileLogLikelihood.Rd b/man/getCyclopsProfileLogLikelihood.Rd index f5b8e15b..e8ab4056 100644 --- a/man/getCyclopsProfileLogLikelihood.Rd +++ b/man/getCyclopsProfileLogLikelihood.Rd @@ -11,7 +11,7 @@ getCyclopsProfileLogLikelihood( bounds = NULL, tolerance = 0.001, initialGridSize = 10, - maxRetry = 10, + maxResets = 10, includePenalty = TRUE ) } @@ -29,7 +29,8 @@ either a vector of numbers of covariateId names} \item{initialGridSize}{Initial grid size for adaptive profiling} -\item{maxRetry}{Maximum number of attempts to profile likelihood} +\item{maxResets}{Maximum allowed number of recomputing the likelihood when coefficient drift is +detected.} \item{includePenalty}{Logical: Include regularized covariate penalty in profile} }