From be7c9b6c601d80a95e130e60cf84dd99986f4f95 Mon Sep 17 00:00:00 2001 From: fanbu1995 Date: Tue, 5 Dec 2023 17:25:12 -0500 Subject: [PATCH] implement compute balance patch --- DESCRIPTION | 6 ++--- NEWS.md | 8 +++++++ man/computeCovariateBalance.Rd | 41 +++++++++++++++++++++++++++++++- man/createFitOutcomeModelArgs.Rd | 4 ++-- man/fitOutcomeModel.Rd | 4 ++-- 5 files changed, 55 insertions(+), 8 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 62386834..72cf7b47 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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: 2023-12-05 Authors@R: c( person("Martijn", "Schuemie", , "schuemie@ohdsi.org", role = c("aut", "cre")), person("Marc", "Suchard", role = c("aut")), @@ -62,6 +62,6 @@ Remotes: ohdsi/Eunomia LinkingTo: Rcpp NeedsCompilation: yes -RoxygenNote: 7.1.2 +RoxygenNote: 7.2.3 Roxygen: list(markdown = TRUE) Encoding: UTF-8 diff --git a/NEWS.md b/NEWS.md index 69e51283..9ed5b265 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,11 @@ +CohortMethod 4.2.3 +================== +Changes: + +1. Fix `sd` computation in `computeCovariateBalance()` and `computeMeansPerGroup()` +2. Retain per group `sd` in `computeCovariateBalance()` results + + CohortMethod 4.2.2 ================== diff --git a/man/computeCovariateBalance.Rd b/man/computeCovariateBalance.Rd index 4a42b840..572ceba3 100644 --- a/man/computeCovariateBalance.Rd +++ b/man/computeCovariateBalance.Rd @@ -27,7 +27,46 @@ will be downsampled before computing covariate balance to save time. Setting this number to 0 means no downsampling will be applied.} } \value{ -Returns a tibble describing the covariate balance before and after matching/trimming. +Returns a tibble describing the covariate balance before and after PS adjustment, +with one row per covariate, with the same data as the \code{covariateRef} table in the \code{CohortMethodData} object, +and the following additional columns: +\itemize{ +\item beforeMatchingMeanTarget: The (weighted) mean value in the target before PS adjustment. +\item beforeMatchingMeanComparator: The (weighted) mean value in the comparator before PS adjustment. +\item beforeMatchingSumTarget: The (weighted) sum value in the target before PS adjustment. +\item beforeMatchingSumComparator: The (weighted) sum value in the comparator before PS adjustment. +\item beforeMatchingSdTarget: The standard deviation of the value in the target before PS adjustment. +\item beforeMatchingSdComparator: The standard deviation of the value in the comparator before PS adjustment. +\item beforeMatchingMean: The mean of the value across target and comparator before PS adjustment. +\item beforeMatchingSd: The standard deviation of the value across target and comparator before PS adjustment. +\item afterMatchingMeanTarget: The (weighted) mean value in the target after PS adjustment. +\item afterMatchingMeanComparator: The (weighted) mean value in the comparator after PS adjustment. +\item afterMatchingSumTarget: The (weighted) sum value in the target after PS adjustment. +\item afterMatchingSumComparator: The (weighted) sum value in the comparator after PS adjustment. +\item afterMatchingSdTarget: The standard deviation of the value in the target after PS adjustment. +\item afterMatchingSdComparator: The standard deviation of the value in the comparator after PS adjustment. +\item afterMatchingMean: The mean of the value across target and comparator after PS adjustment. +\item afterMatchingSd: The standard deviation of the value across target and comparator after PS adjustment. +\item beforeMatchingStdDiff: The standardized difference of means when comparing the target to +the comparator before PS adjustment. +\item afterMatchingStdDiff: The standardized difference of means when comparing the target to +the comparator after PS adjustment. +\item targetStdDiff: The standardized difference of means when comparing the target +before PS adjustment to the target after PS adjustment. +\item comparatorStdDiff: The standardized difference of means when comparing the comparator +before PS adjustment to the comparator after PS adjustment. +-targetComparatorStdDiff: The standardized difference of means when comparing the entire +population before PS adjustment to the entire population after +PS adjustment. +} + +The 'beforeMatchingStdDiff' and 'afterMatchingStdDiff' columns inform on the balance: +are the target and comparator sufficiently similar in terms of baseline covariates to +allow for valid causal estimation? + +The 'targetStdDiff', 'comparatorStdDiff', and 'targetComparatorStdDiff' columns inform on +the generalizability: are the cohorts after PS adjustment sufficiently similar to the cohorts +before adjustment to allow generalizing the findings to the original cohorts? } \description{ For every covariate, prevalence in treatment and comparator groups before and after diff --git a/man/createFitOutcomeModelArgs.Rd b/man/createFitOutcomeModelArgs.Rd index cd093a24..5a488e9f 100644 --- a/man/createFitOutcomeModelArgs.Rd +++ b/man/createFitOutcomeModelArgs.Rd @@ -17,8 +17,8 @@ createFitOutcomeModelArgs( profileGrid = NULL, profileBounds = c(log(0.1), log(10)), prior = createPrior("laplace", useCrossValidation = TRUE), - control = createControl(cvType = "auto", seed = 1, startingVariance = 0.01, tolerance - = 2e-07, cvRepetitions = 10, noiseLevel = "quiet") + control = createControl(cvType = "auto", seed = 1, startingVariance = 0.01, tolerance = + 2e-07, cvRepetitions = 10, noiseLevel = "quiet") ) } \arguments{ diff --git a/man/fitOutcomeModel.Rd b/man/fitOutcomeModel.Rd index fdcb084d..d14c1aa4 100644 --- a/man/fitOutcomeModel.Rd +++ b/man/fitOutcomeModel.Rd @@ -19,8 +19,8 @@ fitOutcomeModel( profileGrid = NULL, profileBounds = c(log(0.1), log(10)), prior = createPrior("laplace", useCrossValidation = TRUE), - control = createControl(cvType = "auto", seed = 1, startingVariance = 0.01, tolerance - = 2e-07, cvRepetitions = 10, noiseLevel = "quiet") + control = createControl(cvType = "auto", seed = 1, startingVariance = 0.01, tolerance = + 2e-07, cvRepetitions = 10, noiseLevel = "quiet") ) } \arguments{