Skip to content

Commit

Permalink
Fixed error when failing model fitting caused by new Cyclops versio…
Browse files Browse the repository at this point in the history
…n. Dropping RISCA dependency
  • Loading branch information
Schuemie authored and Schuemie committed Aug 14, 2022
1 parent e4e36a2 commit 57eb8df
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 17 deletions.
7 changes: 3 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: CohortMethod
Type: Package
Title: New-User Cohort Method with Large Scale Propensity and Outcome Models
Version: 4.2.2
Date: 2022-01-21
Version: 4.2.3
Date: 2022-08-12
Authors@R: c(
person("Martijn", "Schuemie", , "[email protected]", role = c("aut", "cre")),
person("Marc", "Suchard", role = c("aut")),
Expand Down Expand Up @@ -55,8 +55,7 @@ Suggests:
EmpiricalCalibration,
Eunomia,
withr,
R.utils,
RISCA
R.utils
Remotes:
ohdsi/FeatureExtraction,
ohdsi/Eunomia
Expand Down
12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
CohortMethod 4.2.3
==================

Changes:

1. Removed `RISCA` from the Suggests list. This package was used for a single unit test, but has a large amount of difficult-to-install dependencies.

Bug fixes:

1. Fixed error when failing model fitting caused by new `Cyclops` version.


CohortMethod 4.2.2
==================

Expand Down
6 changes: 2 additions & 4 deletions R/OutcomeModels.R
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,8 @@ fitOutcomeModel <- function(population,
logLikelihoodProfile <- logLikelihoodProfile$value
}
}
if (fit$return_flag == "ILLCONDITIONED") {
status <- "ILL CONDITIONED, CANNOT FIT"
} else if (fit$return_flag == "MAX_ITERATIONS") {
status <- "REACHED MAXIMUM NUMBER OF ITERATIONS, CANNOT FIT"
if (fit$return_flag != "SUCCESS") {
status <- fit$return_flag
} else {
status <- "OK"
coefficients <- coef(fit)
Expand Down
Binary file modified extras/balanceScatterplot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified extras/ps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 9 additions & 9 deletions tests/testthat/test-kmFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ test_that("Weighted Kaplan-Meier", {

expect_equal(sum(weightedKm$s == unweightedKm$s), 0) # None of the values are equal

if (require("RISCA")) {
risca <- RISCA::ipw.survival(lung$time, lung$status - 1, variable = rep(1, length(lung$status)), weights = weight)
risca <- risca$table.surv

matched <- inner_join(risca, data.frame(times = weightedKm$time, survival = weightedKm$s),
by = "times")

expect_equal(matched$survival.x, matched$survival.y)
}
# if (require("RISCA")) {
# risca <- RISCA::ipw.survival(lung$time, lung$status - 1, variable = rep(1, length(lung$status)), weights = weight)
# risca <- risca$table.surv
#
# matched <- inner_join(risca, data.frame(times = weightedKm$time, survival = weightedKm$s),
# by = "times")
#
# expect_equal(matched$survival.x, matched$survival.y)
# }
})


0 comments on commit 57eb8df

Please sign in to comment.