Skip to content

Commit

Permalink
Refering to latest released version of Cyclops. Regenerating document…
Browse files Browse the repository at this point in the history
…ation.
  • Loading branch information
schuemie committed Jun 17, 2021
1 parent 4ff55e0 commit 59b30ad
Show file tree
Hide file tree
Showing 78 changed files with 670 additions and 173 deletions.
9 changes: 4 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: CohortMethod
Type: Package
Title: New-User Cohort Method with Large Scale Propensity and Outcome Models
Version: 4.2.0
Date: 2021-06-16
Date: 2021-06-17
Authors@R: c(
person("Martijn", "Schuemie", , "[email protected]", role = c("aut", "cre")),
person("Marc", "Suchard", role = c("aut")),
Expand All @@ -28,9 +28,9 @@ BugReports: https://github.com/OHDSI/CohortMethod/issues
Depends:
R (>= 3.5.0),
DatabaseConnector (>= 4.0.0),
Cyclops (>= 3.1.1),
Cyclops (>= 3.1.2),
FeatureExtraction (>= 3.0.0),
Andromeda (>= 0.3.0)
Andromeda (>= 0.4.0)
Imports:
methods,
ggplot2,
Expand All @@ -55,8 +55,7 @@ Suggests:
EmpiricalCalibration,
Eunomia
Remotes:
ohdsi/FeatureExtraction,
ohdsi/Cyclops
ohdsi/FeatureExtraction
LinkingTo: Rcpp
NeedsCompilation: yes
RoxygenNote: 7.1.1
Expand Down
4 changes: 2 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Changes:

1. Adding the `trimByIptw()` function.

2. Adding the `estimator` argument to the `fitOutcomeModel()` function to select 'ate' (average treatment effect) or 'att' (average treatement effect in the treated) when performing IPTW.
2. Adding the `estimator` argument to the `fitOutcomeModel()` function to select 'ate' (average treatment effect) or 'att' (average treatment effect in the treated) when performing IPTW.

3. Added the `maxWeight` argument to the `fitOutcomeModel()` function. Weights greater than this value will be set to this value.

Expand All @@ -26,7 +26,7 @@ CohortMethod 4.1.0

Changes:

1. Dropped `insertDbPopulation()` function. This didn't seem to be used by anyone, and would have required carying the person ID throughout the pipeline.
1. Dropped `insertDbPopulation()` function. This didn't seem to be used by anyone, and would have required carrying the person ID throughout the pipeline.

2. Introducing new unique person identified called `personSeqId`, generated during data extraction. Person ID is now downloaded as string to avoid issues with 64-bit integers. Person ID is not used by CohortMethod, and is provided for reference only.

Expand Down
2 changes: 1 addition & 1 deletion R/Analyses.R
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ loadCmAnalysisList <- function(file) {
#' provided instead. In the analysis, the name of the number to be
#' used can be specified using the #' \code{comparatorType}
#' parameter in the [createCmAnalysis()] function.
#' @param outcomeIds A vector of concept IDs indentifying the outcome(s) in the
#' @param outcomeIds A vector of concept IDs identifying the outcome(s) in the
#' outcome table.
#' @param excludedCovariateConceptIds A list of concept IDs that cannot be used to construct
#' covariates. This argument is to be used only for exclusion
Expand Down
4 changes: 2 additions & 2 deletions R/CreateArgFunctions.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file has been autogenerated. Do not change by hand.
# This file has been autogenerated. Do not change by hand.

#' Create a parameter object for the function getDbCohortMethodData
#'
Expand Down Expand Up @@ -129,7 +129,7 @@ createCreateStudyPopulationArgs <- function(firstExposureOnly = FALSE,
#' the treatment assignment. If any covariate has an unusually high
#' correlation (either positive or negative), this will throw and
#' error.
#' @param stopOnError If an error occurr, should the function stop? Else, the two cohorts
#' @param stopOnError If an error occur, should the function stop? Else, the two cohorts
#' will be assumed to be perfectly separable.
#' @param prior The prior used to fit the model. See Cyclops::createPrior() for
#' details.
Expand Down
2 changes: 1 addition & 1 deletion R/PsFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#' the treatment assignment. If any covariate has an unusually high
#' correlation (either positive or negative), this will throw and
#' error.
#' @param stopOnError If an error occurr, should the function stop? Else, the two cohorts
#' @param stopOnError If an error occur, should the function stop? Else, the two cohorts
#' will be assumed to be perfectly separable.
#' @param prior The prior used to fit the model. See
#' [Cyclops::createPrior()] for details.
Expand Down
70 changes: 36 additions & 34 deletions R/StudyPopulation.R
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,11 @@ createStudyPopulation <- function(cohortMethodData,
idx <- population$riskEnd > population$daysToObsEnd
population$riskEnd[idx] <- population$daysToObsEnd[idx]

idx <- population$riskEnd > population$riskStart + maxDaysAtRisk
if (any(idx)) {
population$riskEnd[idx] <- population$riskStart[idx] + maxDaysAtRisk
if (!missing(maxDaysAtRisk) && !is.null(maxDaysAtRisk)) {
idx <- population$riskEnd > population$riskStart + maxDaysAtRisk
if (any(idx)) {
population$riskEnd[idx] <- population$riskStart[idx] + maxDaysAtRisk
}
}
if (censorAtNewRiskWindow) {
ParallelLogger::logInfo("Censoring time at risk of recurrent subjects at start of new time at risk")
Expand Down Expand Up @@ -338,10 +340,10 @@ getCounts <- function(population, description = "") {
targetExposures <- length(population$personSeqId[population$treatment == 1])
comparatorExposures <- length(population$personSeqId[population$treatment == 0])
counts <- dplyr::tibble(description = description,
targetPersons = targetPersons,
comparatorPersons = comparatorPersons,
targetExposures = targetExposures,
comparatorExposures = comparatorExposures)
targetPersons = targetPersons,
comparatorPersons = comparatorPersons,
targetExposures = targetExposures,
comparatorExposures = comparatorExposures)
return(counts)
}

Expand Down Expand Up @@ -468,17 +470,17 @@ plotTimeToEvent <- function(cohortMethodData,
idxInPeriod <- outcomes$daysToEvent >= start & outcomes$daysToEvent < end
idxPopInPeriod <- -population$daysFromObsStart <= start & population$daysToObsEnd >= end
dplyr::tibble(number = number,
start = start,
end = end,
eventsExposed = 0,
eventsUnexposed = 0,
observed = 0,
eventsExposedTarget = sum(idxInPeriod & idxExposed & idxTarget),
eventsExposedComparator = sum(idxInPeriod & idxExposed & !idxTarget),
eventsUnexposedTarget = sum(idxInPeriod & !idxExposed & idxTarget),
eventsUnexposedComparator = sum(idxInPeriod & !idxExposed & !idxTarget),
observedTarget = sum(idxPopInPeriod & population$treatment),
observedComparator = sum(idxPopInPeriod & !population$treatment))
start = start,
end = end,
eventsExposed = 0,
eventsUnexposed = 0,
observed = 0,
eventsExposedTarget = sum(idxInPeriod & idxExposed & idxTarget),
eventsExposedComparator = sum(idxInPeriod & idxExposed & !idxTarget),
eventsUnexposedTarget = sum(idxInPeriod & !idxExposed & idxTarget),
eventsUnexposedComparator = sum(idxInPeriod & !idxExposed & !idxTarget),
observedTarget = sum(idxPopInPeriod & population$treatment),
observedComparator = sum(idxPopInPeriod & !population$treatment))
}
periods <- lapply(-floor(numberOfPeriods/2):ceiling(numberOfPeriods/2), createPeriod)
periods <- do.call("rbind", periods)
Expand All @@ -489,25 +491,25 @@ plotTimeToEvent <- function(cohortMethodData,
periods$rateTarget <- (periods$eventsExposedTarget + periods$eventsUnexposedTarget) / periods$observedTarget
periods$rateComparator <- (periods$eventsExposedComparator + periods$eventsUnexposedComparator) / periods$observedComparator
vizData <- rbind(dplyr::tibble(start = periods$start,
end = periods$end,
rate = periods$rateExposedTarget,
status = "Exposed events",
type = targetLabel),
end = periods$end,
rate = periods$rateExposedTarget,
status = "Exposed events",
type = targetLabel),
dplyr::tibble(start = periods$start,
end = periods$end,
rate = periods$rateUnexposedTarget,
status = "Unexposed events",
type = targetLabel),
end = periods$end,
rate = periods$rateUnexposedTarget,
status = "Unexposed events",
type = targetLabel),
dplyr::tibble(start = periods$start,
end = periods$end,
rate = periods$rateExposedComparator,
status = "Exposed events",
type = comparatorLabel),
end = periods$end,
rate = periods$rateExposedComparator,
status = "Exposed events",
type = comparatorLabel),
dplyr::tibble(start = periods$start,
end = periods$end,
rate = periods$rateUnexposedComparator,
status = "Unexposed events",
type = comparatorLabel))
end = periods$end,
rate = periods$rateUnexposedComparator,
status = "Unexposed events",
type = comparatorLabel))
vizData$type <- factor(vizData$type, levels = c(targetLabel, comparatorLabel))

plot <- ggplot2::ggplot(vizData, ggplot2::aes(x = .data$start + periodLength / 2,
Expand Down
1 change: 1 addition & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ reference:
- matchOnPsAndCovariates
- trimByPs
- trimByPsToEquipoise
- trimByIptw
- stratifyByPs
- stratifyByPsAndCovariates
- title: "Outcome models"
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html

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

12 changes: 6 additions & 6 deletions docs/articles/MultipleAnalyses.html

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

10 changes: 5 additions & 5 deletions docs/articles/SingleStudies.html

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

2 changes: 1 addition & 1 deletion docs/articles/index.html

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

2 changes: 1 addition & 1 deletion docs/authors.html

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

Loading

0 comments on commit 59b30ad

Please sign in to comment.