Skip to content

Commit

Permalink
Stopping fitting PS model early when either target or comparator is e…
Browse files Browse the repository at this point in the history
…mpty. Increasing version number
  • Loading branch information
schuemie committed May 18, 2024
1 parent df1d738 commit a512a9e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
4 changes: 2 additions & 2 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: 5.2.1
Date: 2024-02-01
Version: 5.3.0
Date: 2024-05-18
Authors@R: c(
person("Martijn", "Schuemie", , "schuemie@ohdsi.org", role = c("aut", "cre")),
person("Marc", "Suchard", role = c("aut")),
Expand Down
14 changes: 14 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
CohortMethod 5.3.0
==================

Changes:

1. Switching cohort IDs in results model to BIGINT.

Bugfixes:

1. Fix `enforceCellCount()` applied to covariate balance when all balance is NA.

2. Stopping fitting PS model early when either target or comparator is empty. Prevents error when target or comparator is empty, sampling is required, and Cyclops happens to fit a model instead of declaring ILL CONDITIONED.


CohortMethod 5.2.1
==================

Expand Down
6 changes: 5 additions & 1 deletion R/PsFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,14 @@ createPs <- function(cohortMethodData,

start <- Sys.time()
population <- population[order(population$rowId), ]
if (nrow_temp(cohortMethodData$cohorts) == 0) {
if (nrow(population) == 0) {
error <- "No subjects in population, so cannot fit model"
sampled <- FALSE
ref <- NULL
} else if (all(population$treatment == 1) || all(population$treatment == 0)) {
error <- "Target or comparator cohort empty, so cannot fit model"
sampled <- FALSE
ref <- NULL
} else if (nrow_temp(cohortMethodData$covariates) == 0) {
error <- "No covariate data, so cannot fit model"
sampled <- FALSE
Expand Down

0 comments on commit a512a9e

Please sign in to comment.