Skip to content

Commit

Permalink
Renaming maxRetry to maxResets. Fixes #75
Browse files Browse the repository at this point in the history
  • Loading branch information
schuemie committed Jul 16, 2024
1 parent fa3433d commit 57f0b61
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ Suggests:
microbenchmark,
cmprsk
NeedsCompilation: yes
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Roxygen: list(markdown = TRUE)
Encoding: UTF-8
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
develop
==============

1. make `maxRety` a function parameter
1. make `maxResets` a function parameter

Cyclops v3.4.1
==============
Expand Down
7 changes: 4 additions & 3 deletions R/ModelFit.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))) {
Expand Down Expand Up @@ -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()
Expand Down
30 changes: 30 additions & 0 deletions man/cyclops.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions man/getCyclopsProfileLogLikelihood.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 57f0b61

Please sign in to comment.