diff --git a/CohortMethod.Rproj b/CohortMethod.Rproj index ac857c97..c0f72a6e 100644 --- a/CohortMethod.Rproj +++ b/CohortMethod.Rproj @@ -16,6 +16,7 @@ AutoAppendNewline: Yes StripTrailingWhitespace: Yes BuildType: Package +PackageCleanBeforeInstall: No PackageInstallArgs: --no-multiarch --with-keep.source PackageBuildArgs: --resave-data PackageRoxygenize: rd,collate,namespace diff --git a/DESCRIPTION b/DESCRIPTION index ac1b9f44..31159720 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: CohortMethod Type: Package Title: New-User Cohort Method with Large Scale Propensity and Outcome Models Version: 5.0.0 -Date: 2022-06-21 +Date: 2023-04-17 Authors@R: c( person("Martijn", "Schuemie", , "schuemie@ohdsi.org", role = c("aut", "cre")), person("Marc", "Suchard", role = c("aut")), diff --git a/R/Export.R b/R/Export.R index b96745b8..0f3fd1b3 100644 --- a/R/Export.R +++ b/R/Export.R @@ -59,6 +59,13 @@ createCmDiagnosticThresholds <- function(mdrrThreshold = 10, sdmThreshold = 0.1, equipoiseThreshold = 0.2, attritionFractionThreshold = 1) { + errorMessages <- checkmate::makeAssertCollection() + checkmate::assertNumeric(mdrrThreshold, len = 1, lower = 0, add = errorMessages) + checkmate::assertNumeric(easeThreshold, len = 1, lower = 0, add = errorMessages) + checkmate::assertNumeric(sdmThreshold, len = 1, lower = 0, add = errorMessages) + checkmate::assertNumeric(equipoiseThreshold, len = 1, lower = 0, add = errorMessages) + checkmate::assertNumeric(attritionFractionThreshold, len = 1, lower = 0, add = errorMessages) + checkmate::reportAssertions(collection = errorMessages) thresholds <- list() for (name in names(formals(createCmDiagnosticThresholds))) { thresholds[[name]] <- get(name) diff --git a/R/KaplanMeier.R b/R/KaplanMeier.R index 4f1898a8..c0b36a4d 100644 --- a/R/KaplanMeier.R +++ b/R/KaplanMeier.R @@ -16,7 +16,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - #' Plot the Kaplan-Meier curve #' #' @description diff --git a/R/RunAnalyses.R b/R/RunAnalyses.R index e71fd01c..9ea648f0 100644 --- a/R/RunAnalyses.R +++ b/R/RunAnalyses.R @@ -215,11 +215,7 @@ runCmAnalyses <- function(connectionDetails, refitPsForEveryStudyPopulation = TRUE, multiThreadingSettings = createMultiThreadingSettings()) { errorMessages <- checkmate::makeAssertCollection() - if (is(connectionDetails, "connectionDetails")) { - checkmate::assertClass(connectionDetails, "connectionDetails", add = errorMessages) - } else { - checkmate::assertClass(connectionDetails, "ConnectionDetails", add = errorMessages) - } + checkmate::assertClass(connectionDetails, "ConnectionDetails", add = errorMessages) checkmate::assertCharacter(cdmDatabaseSchema, len = 1, add = errorMessages) checkmate::assertCharacter(tempEmulationSchema, len = 1, null.ok = TRUE, add = errorMessages) checkmate::assertCharacter(exposureDatabaseSchema, len = 1, add = errorMessages) @@ -1623,7 +1619,7 @@ createReferenceTable <- function(cmAnalysisList, #' @param outputFolder Name of the folder where all the outputs have been written to. #' #' @return -#' A tibble containing file nams of artifacts generated for each target-comparator-outcome-analysis combination. +#' A tibble containing file names of artifacts generated for each target-comparator-outcome-analysis combination. #' #' @export getFileReference <- function(outputFolder) { diff --git a/R/Simulation.R b/R/Simulation.R index aef977ac..403a4f23 100644 --- a/R/Simulation.R +++ b/R/Simulation.R @@ -62,9 +62,6 @@ createCohortMethodDataSimulationProfile <- function(cohortMethodData) { select("covariateId", "prevalence") %>% collect() - # covariatePrevalence <- sums$prevalence - # names(covariatePrevalence) <- sums$covariateId - message("Computing propensity model") propensityScore <- createPs(cohortMethodData, maxCohortSizeForFitting = 25000, @@ -84,7 +81,6 @@ createCohortMethodDataSimulationProfile <- function(cohortMethodData) { removeSubjectsWithPriorOutcome = FALSE, outcomeId = outcomeId ) - # studyPop <- trimByPsToEquipoise(studyPop) studyPop <- matchOnPs(studyPop, caliper = 0.25, caliperScale = "standardized", maxRatio = 1) outcomeModel <- fitOutcomeModel( population = studyPop, @@ -172,7 +168,6 @@ simulateCohortMethodData <- function(profile, n = 10000) { checkmate::assertInt(n, lower = 1, add = errorMessages) checkmate::reportAssertions(collection = errorMessages) - message("Generating covariates") # Treatment variable is generated elsewhere: covariatePrevalence <- profile$covariatePrevalence[names(profile$covariatePrevalence) != "1"] diff --git a/R/Viewer.R b/R/Viewer.R index 7a96e996..ed774c44 100644 --- a/R/Viewer.R +++ b/R/Viewer.R @@ -13,6 +13,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + # exportFolder = file.path(folder, "export") # library(dplyr) @@ -31,6 +32,13 @@ #' #' @export insertExportedResultsInSqlite <- function(sqliteFileName, exportFolder, cohorts) { + errorMessages <- checkmate::makeAssertCollection() + checkmate::assertCharacter(sqliteFileName, len = 1, add = errorMessages) + checkmate::assertCharacter(exportFolder, len = 1, add = errorMessages) + checkmate::assertDataFrame(cohorts, add = errorMessages) + checkmate::assertNames(colnames(cohorts), must.include = c("cohortId", "cohortName"), add = errorMessages) + checkmate::reportAssertions(collection = errorMessages) + ensureInstalled("RSQLite") connectionDetails <- DatabaseConnector::createConnectionDetails( dbms = "sqlite", @@ -62,7 +70,6 @@ insertExportedResultsInSqlite <- function(sqliteFileName, exportFolder, cohorts) #' using the [exportToCsv()] function. #' @template Cohorts #' -#' #' @return #' Does not return anything. Is called for the side-effect of having the results uploaded #' to the server. @@ -73,7 +80,15 @@ uploadExportedResults <- function(connectionDetails, append = FALSE, exportFolder, cohorts) { - # ensureInstalled("CohortGenerator") + errorMessages <- checkmate::makeAssertCollection() + checkmate::assertClass(connectionDetails, "ConnectionDetails", add = errorMessages) + checkmate::assertCharacter(databaseSchema, len = 1, add = errorMessages) + checkmate::assertLogical(append, len = 1, add = errorMessages) + checkmate::assertCharacter(exportFolder, len = 1, add = errorMessages) + checkmate::assertDataFrame(cohorts, add = errorMessages) + checkmate::assertNames(colnames(cohorts), must.include = c("cohortId", "cohortName"), add = errorMessages) + checkmate::reportAssertions(collection = errorMessages) + ensureInstalled("ResultModelManager") connection <- DatabaseConnector::connect(connectionDetails) on.exit(DatabaseConnector::disconnect(connection)) @@ -81,7 +96,6 @@ uploadExportedResults <- function(connectionDetails, if (!append) { # Create tables rdmsFile <- system.file("csv", "resultsDataModelSpecification.csv", package = "CohortMethod") - # specification <- CohortGenerator::readCsv(file = rdmsFile) specification <- readr::read_csv(file = rdmsFile, show_col_types = FALSE) %>% SqlRender::snakeCaseToCamelCaseNames() sql <- ResultModelManager::generateSqlSchema(csvFilepath = rdmsFile) @@ -147,6 +161,10 @@ uploadExportedResults <- function(connectionDetails, #' #' @export launchResultsViewerUsingSqlite <- function(sqliteFileName) { + errorMessages <- checkmate::makeAssertCollection() + checkmate::assertCharacter(sqliteFileName, len = 1, add = errorMessages) + checkmate::reportAssertions(collection = errorMessages) + ensureInstalled("RSQLite") connectionDetails <- DatabaseConnector::createConnectionDetails( dbms = "sqlite", @@ -171,6 +189,11 @@ launchResultsViewerUsingSqlite <- function(sqliteFileName) { #' #' @export launchResultsViewer <- function(connectionDetails, databaseSchema) { + errorMessages <- checkmate::makeAssertCollection() + checkmate::assertClass(connectionDetails, "ConnectionDetails", add = errorMessages) + checkmate::assertCharacter(databaseSchema, len = 1, add = errorMessages) + checkmate::reportAssertions(collection = errorMessages) + ensureInstalled("ShinyAppBuilder") ensureInstalled("markdown") aboutModule <- ShinyAppBuilder::createDefaultAboutConfig( diff --git a/README.md b/README.md index df80795d..9c2eee59 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ User Documentation Documentation can be found on the [package website](https://ohdsi.github.io/CohortMethod). PDF versions of the documentation are also available: + * Vignette: [Single studies using the CohortMethod package](https://raw.githubusercontent.com/OHDSI/CohortMethod/main/inst/doc/SingleStudies.pdf) * Vignette: [Running multiple analyses at once using the CohortMethod package](https://raw.githubusercontent.com/OHDSI/CohortMethod/main/inst/doc/MultipleAnalyses.pdf) * Package manual: [CohortMethod.pdf](https://raw.githubusercontent.com/OHDSI/CohortMethod/main/extras/CohortMethod.pdf) diff --git a/_pkgdown.yml b/_pkgdown.yml index e7fcd75a..407e84fd 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -74,11 +74,20 @@ reference: - createMultiThreadingSettings - createDefaultMultiThreadingSettings - runCmAnalyses + - title: "Results of multiple analyses" + desc: > + Functions for viewing results of multiple analyses. + contents: - getFileReference - getResultsSummary - getInteractionResultsSummary - createCmDiagnosticThresholds - exportToCsv + - getResultsDataModel + - insertExportedResultsInSqlite + - launchResultsViewerUsingSqlite + - uploadExportedResults + - launchResultsViewer - title: "Simulation" desc: > Functions for simulating cohort method data objects. diff --git a/docs/articles/MultipleAnalyses.html b/docs/articles/MultipleAnalyses.html index f71f0329..acf4fd72 100644 --- a/docs/articles/MultipleAnalyses.html +++ b/docs/articles/MultipleAnalyses.html @@ -89,7 +89,7 @@

Running multiple analyses at once using the

Martijn J. Schuemie, Marc A. Suchard and Patrick Ryan

-

2023-02-28

+

2023-04-17

Source: vignettes/MultipleAnalyses.Rmd @@ -220,24 +220,23 @@

Preparation for the example
/***********************************
 File VignetteOutcomes.sql
 ***********************************/
-IF OBJECT_ID('@resultsDatabaseSchema.outcomes', 'U') IS NOT NULL
-  DROP TABLE @resultsDatabaseSchema.outcomes;
-
-SELECT ancestor_concept_id AS cohort_definition_id,
-    condition_start_date AS cohort_start_date,
-    condition_end_date AS cohort_end_date,
-    condition_occurrence.person_id AS subject_id
-INTO @resultsDatabaseSchema.outcomes
-FROM @cdmDatabaseSchema.condition_occurrence
-INNER JOIN @cdmDatabaseSchema.visit_occurrence
-    ON condition_occurrence.visit_occurrence_id = visit_occurrence.visit_occurrence_id
-INNER JOIN @cdmDatabaseSchema.concept_ancestor
-    ON condition_concept_id = descendant_concept_id
-WHERE ancestor_concept_id IN (192671, 24609, 29735, 73754, 80004, 134718, 139099,
-141932, 192367, 193739, 194997, 197236, 199074, 255573, 257007, 313459, 314658,
-316084, 319843, 321596, 374366, 375292, 380094, 433753, 433811, 436665, 436676,
-436940, 437784, 438134, 440358, 440374, 443617, 443800, 4084966, 4288310)
-    AND visit_occurrence.visit_concept_id IN (9201, 9203);
+DROP TABLE IF EXISTS @resultsDatabaseSchema.outcomes; + +SELECT ancestor_concept_id AS cohort_definition_id, + condition_start_date AS cohort_start_date, + condition_end_date AS cohort_end_date, + condition_occurrence.person_id AS subject_id +INTO @resultsDatabaseSchema.outcomes +FROM @cdmDatabaseSchema.condition_occurrence +INNER JOIN @cdmDatabaseSchema.visit_occurrence + ON condition_occurrence.visit_occurrence_id = visit_occurrence.visit_occurrence_id +INNER JOIN @cdmDatabaseSchema.concept_ancestor + ON condition_concept_id = descendant_concept_id +WHERE ancestor_concept_id IN (192671, 24609, 29735, 73754, 80004, 134718, 139099, +141932, 192367, 193739, 194997, 197236, 199074, 255573, 257007, 313459, 314658, +316084, 319843, 321596, 374366, 375292, 380094, 433753, 433811, 436665, 436676, +436940, 437784, 438134, 440358, 440374, 443617, 443800, 4084966, 4288310) + AND visit_occurrence.visit_concept_id IN (9201, 9203);

This is parameterized SQL which can be used by the SqlRender package. We use parameterized SQL so we do not have to pre-specify the names of the CDM and result schemas. That way, @@ -488,7 +487,7 @@

Covariate balanceRetrieving the resultsresultsSum <- getResultsSummary(outputFolder) head(resultsSum)
## # A tibble: 6 x 27
-##   analysisId targetId comparat~1 outco~2 trueE~3 targe~4 compa~5 targe~6 compa~7
-##        <int>    <int>      <int>   <int>   <dbl>   <int>   <int>   <dbl>   <dbl>
-## 1          1  1118084    1124300   29735       1   86294   99497  1.15e7 7116045
-## 2          1  1118084    1124300  140673       1   86718   99941  1.15e7 7152671
-## 3          1  1118084    1124300  192671      NA   84447   97429  1.12e7 6952965
-## 4          1  1118084    1124300  197494       1   86718   99941  1.15e7 7152671
-## 5          1  1118084    1124300  198185       1   86718   99941  1.15e7 7152671
-## 6          1  1118084    1124300  198199       1   86718   99941  1.15e7 7152671
-## # ... with 18 more variables: targetOutcomes <dbl>, comparatorOutcomes <dbl>,
+##   analysisId targetId comparatorId outcomeId trueEffectSize targetSubjects
+##        <int>    <int>        <int>     <int>          <dbl>          <int>
+## 1          1  1118084      1124300     29735              1          86294
+## 2          1  1118084      1124300    140673              1          86718
+## 3          1  1118084      1124300    192671             NA          84447
+## 4          1  1118084      1124300    197494              1          86718
+## 5          1  1118084      1124300    198185              1          86718
+## 6          1  1118084      1124300    198199              1          86718
+## # i 21 more variables: comparatorSubjects <int>, targetDays <dbl>,
+## #   comparatorDays <dbl>, targetOutcomes <dbl>, comparatorOutcomes <dbl>,
 ## #   rr <dbl>, ci95Lb <dbl>, ci95Ub <dbl>, p <dbl>, logRr <dbl>, seLogRr <dbl>,
 ## #   llr <dbl>, mdrr <dbl>, attritionFraction <dbl>, calibratedRr <dbl>,
 ## #   calibratedCi95Lb <dbl>, calibratedCi95Ub <dbl>, calibratedP <dbl>,
-## #   calibratedLogRr <dbl>, calibratedSeLogRr <dbl>, ease <dbl>, and abbreviated
-## #   variable names 1: comparatorId, 2: outcomeId, 3: trueEffectSize,
-## #   4: targetSubjects, 5: comparatorSubjects, 6: targetDays, ...
+## # calibratedLogRr <dbl>, calibratedSeLogRr <dbl>, ease <dbl>

This tells us, per target-comparator-outcome-analysis combination, the estimated relative risk and 95% confidence interval, as well as the number of people in the treated and comparator group (after trimming and @@ -670,16 +668,102 @@

Empirical calib
+

Exporting to CSV +

+

The results generated so far all reside in binary object on your +local file system, mixing aggregate statistics such as hazard ratios +with patient-level data including propensity scores per person. How +could we share our results with others, possibly outside our +organization? This is where the exportToCsv() function +comes in. This function exports all results, including diagnostics to +CSV (comma-separated values) files. These files only contain aggregate +statistics, not patient-level data. The format is CSV files to enable +human review.

+
+exportToCsv(
+  outputFolder,
+  exportFolder = file.path(folder, "export"),
+  databaseId = "My CDM",
+  minCellCount = 5,
+  maxCores = parallel::detectCores()
+)
+

Any person counts in the results that are smaller than the +minCellCount argument will be blinded, by replacing the +count with the negative minCellCount. For example, if the +number of people with the outcome is 3, and +minCellCount = 5, the count will be reported to be -5, +which in the Shiny app will be displayed as ‘<5’.

+

Information on the data model used to generate the CSV files can be +retrieved using getResultsDataModel():

+ +
## # A tibble: 171 x 7
+##    table_name       column_name data_type is_required primary_key min_cell_count
+##    <chr>            <chr>       <chr>     <chr>       <chr>       <chr>         
+##  1 cm_attrition     sequence_n~ int       Yes         Yes         No            
+##  2 cm_attrition     description varchar   Yes         No          No            
+##  3 cm_attrition     subjects    int       Yes         No          Yes           
+##  4 cm_attrition     exposure_id int       Yes         Yes         No            
+##  5 cm_attrition     target_id   int       Yes         Yes         No            
+##  6 cm_attrition     comparator~ int       Yes         Yes         No            
+##  7 cm_attrition     analysis_id int       Yes         Yes         No            
+##  8 cm_attrition     outcome_id  int       Yes         Yes         No            
+##  9 cm_attrition     database_id varchar   Yes         Yes         No            
+## 10 cm_follow_up_di~ target_id   int       Yes         Yes         No            
+## # i 161 more rows
+## # i 1 more variable: description <chr>
+
+
+

View results in a Shiny app +

+

Finally, we can view the results in a Shiny app. For this we must +first load the CSV files produced by exportToCsv() into a +database. We could use the uploadExportedResults() function +for this. However, if we just want to view the results ourselves we can +create a small SQLite database ourselves without having to set up a +database server. In any case we need to specify the names of the +exposure and outcome cohorts we used in our study. We can create the +SQLite database using:

+
+cohorts <- data.frame(
+  cohortId = c(
+    1118084,
+    1124300,
+    192671),
+  cohortName = c(
+    "Celecoxib",
+    "Diclofenac",
+    "GI Bleed"
+  )
+)
+
+insertExportedResultsInSqlite(
+  sqliteFileName = file.path(folder, "myResults.sqlite"), 
+  exportFolder = file.path(folder, "export"), 
+  cohorts = cohorts
+)
+

Next we launch the Shiny app using:

+
+launchResultsViewerUsingSqlite(
+  sqliteFileName = file.path(folder, "myResults.sqlite")
+)
+
+CohortMethod Shiny app

+CohortMethod Shiny app +

+
+
+

Acknowledgments

Considerable work has been dedicated to provide the CohortMethod package.

-
+
 citation("CohortMethod")
## 
 ## To cite package 'CohortMethod' in publications use:
 ## 
-##   Schuemie M, Suchard M, Ryan P (2022). _CohortMethod: New-User Cohort
+##   Schuemie M, Suchard M, Ryan P (2023). _CohortMethod: New-User Cohort
 ##   Method with Large Scale Propensity and Outcome Models_.
 ##   https://ohdsi.github.io/CohortMethod,
 ##   https://github.com/OHDSI/CohortMethod.
@@ -690,13 +774,13 @@ 

Acknowledgments## title = {CohortMethod: New-User Cohort Method with Large Scale Propensity and Outcome ## Models}, ## author = {Martijn Schuemie and Marc Suchard and Patrick Ryan}, -## year = {2022}, +## year = {2023}, ## note = {https://ohdsi.github.io/CohortMethod, ## https://github.com/OHDSI/CohortMethod}, ## }

Further, CohortMethod makes extensive use of the Cyclops package.

-
+
 citation("Cyclops")
## 
 ## To cite Cyclops in publications use:
diff --git a/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-11-1.png b/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-11-1.png
index 9af08299..c0e9ef43 100644
Binary files a/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-11-1.png and b/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-11-1.png differ
diff --git a/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-16-1.png b/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-16-1.png
index 64a45f26..fdc81535 100644
Binary files a/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-16-1.png and b/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-16-1.png differ
diff --git a/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-18-1.png b/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-18-1.png
index e21b5efc..5bbda4de 100644
Binary files a/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-18-1.png and b/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-18-1.png differ
diff --git a/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-20-1.png b/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-20-1.png
index ea9a588e..3fac1787 100644
Binary files a/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-20-1.png and b/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-20-1.png differ
diff --git a/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-22-1.png b/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-22-1.png
index c8e24bdc..076a61a3 100644
Binary files a/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-22-1.png and b/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-22-1.png differ
diff --git a/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-24-1.png b/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-24-1.png
index 44100932..03794db6 100644
Binary files a/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-24-1.png and b/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-24-1.png differ
diff --git a/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-26-1.png b/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-26-1.png
index 97fec1f5..e63c3a49 100644
Binary files a/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-26-1.png and b/docs/articles/MultipleAnalyses_files/figure-html/unnamed-chunk-26-1.png differ
diff --git a/docs/articles/SingleStudies.html b/docs/articles/SingleStudies.html
index 03cd3ffa..7c2e6d54 100644
--- a/docs/articles/SingleStudies.html
+++ b/docs/articles/SingleStudies.html
@@ -89,7 +89,7 @@ 

Single studies using the CohortMethod

Martijn J. Schuemie, Marc A. Suchard and Patrick Ryan

-

2023-02-28

+

2023-04-17

Source: vignettes/SingleStudies.Rmd @@ -175,61 +175,60 @@

Preparing the exposures and outcom File coxibVsNonselVsGiBleed.sql ***********************************/ -IF OBJECT_ID('@resultsDatabaseSchema.coxibVsNonselVsGiBleed', 'U') IS NOT NULL - DROP TABLE @resultsDatabaseSchema.coxibVsNonselVsGiBleed; - -CREATE TABLE @resultsDatabaseSchema.coxibVsNonselVsGiBleed ( - cohort_definition_id INT, - cohort_start_date DATE, - cohort_end_date DATE, - subject_id BIGINT - ); - -INSERT INTO @resultsDatabaseSchema.coxibVsNonselVsGiBleed ( - cohort_definition_id, - cohort_start_date, - cohort_end_date, - subject_id - ) -SELECT 1, -- Exposure - drug_era_start_date, - drug_era_end_date, - person_id -FROM @cdmDatabaseSchema.drug_era -WHERE drug_concept_id = 1118084;-- celecoxib - -INSERT INTO @resultsDatabaseSchema.coxibVsNonselVsGiBleed ( - cohort_definition_id, - cohort_start_date, - cohort_end_date, - subject_id - ) -SELECT 2, -- Comparator - drug_era_start_date, - drug_era_end_date, - person_id -FROM @cdmDatabaseSchema.drug_era -WHERE drug_concept_id = 1124300; --diclofenac - -INSERT INTO @resultsDatabaseSchema.coxibVsNonselVsGiBleed ( - cohort_definition_id, - cohort_start_date, - cohort_end_date, - subject_id - ) -SELECT 3, -- Outcome - condition_start_date, - condition_end_date, - condition_occurrence.person_id -FROM @cdmDatabaseSchema.condition_occurrence -INNER JOIN @cdmDatabaseSchema.visit_occurrence - ON condition_occurrence.visit_occurrence_id = visit_occurrence.visit_occurrence_id -WHERE condition_concept_id IN ( - SELECT descendant_concept_id - FROM @cdmDatabaseSchema.concept_ancestor - WHERE ancestor_concept_id = 192671 -- GI - Gastrointestinal haemorrhage - ) - AND visit_occurrence.visit_concept_id IN (9201, 9203);

+DROP TABLE IF EXISTS @resultsDatabaseSchema.coxibVsNonselVsGiBleed; + +CREATE TABLE @resultsDatabaseSchema.coxibVsNonselVsGiBleed ( + cohort_definition_id INT, + cohort_start_date DATE, + cohort_end_date DATE, + subject_id BIGINT + ); + +INSERT INTO @resultsDatabaseSchema.coxibVsNonselVsGiBleed ( + cohort_definition_id, + cohort_start_date, + cohort_end_date, + subject_id + ) +SELECT 1, -- Exposure + drug_era_start_date, + drug_era_end_date, + person_id +FROM @cdmDatabaseSchema.drug_era +WHERE drug_concept_id = 1118084;-- celecoxib + +INSERT INTO @resultsDatabaseSchema.coxibVsNonselVsGiBleed ( + cohort_definition_id, + cohort_start_date, + cohort_end_date, + subject_id + ) +SELECT 2, -- Comparator + drug_era_start_date, + drug_era_end_date, + person_id +FROM @cdmDatabaseSchema.drug_era +WHERE drug_concept_id = 1124300; --diclofenac + +INSERT INTO @resultsDatabaseSchema.coxibVsNonselVsGiBleed ( + cohort_definition_id, + cohort_start_date, + cohort_end_date, + subject_id + ) +SELECT 3, -- Outcome + condition_start_date, + condition_end_date, + condition_occurrence.person_id +FROM @cdmDatabaseSchema.condition_occurrence +INNER JOIN @cdmDatabaseSchema.visit_occurrence + ON condition_occurrence.visit_occurrence_id = visit_occurrence.visit_occurrence_id +WHERE condition_concept_id IN ( + SELECT descendant_concept_id + FROM @cdmDatabaseSchema.concept_ancestor + WHERE ancestor_concept_id = 192671 -- GI - Gastrointestinal haemorrhage + ) + AND visit_occurrence.visit_concept_id IN (9201, 9203);

This is parameterized SQL which can be used by the SqlRender package. We use parameterized SQL so we do not have to pre-specify the names of the CDM and result schemas. That way, @@ -322,7 +321,7 @@

Extracting the data from the server ## ## Inherits from Andromeda: ## # Andromeda object -## # Physical location: C:\Users\admin_mschuemi\AppData\Local\Temp\2\RtmpsT7JCN\file286c53952d5d.sqlite +## # Physical location: C:\Users\admin_mschuemi\AppData\Local\Temp\2\RtmpQZKV1W\file312c37fb2b73.sqlite ## ## Tables: ## $analysisRef (analysisId, analysisName, domainId, startDay, endDay, isBinary, missingMeansZero) @@ -361,11 +360,11 @@

Extracting the data from the server ## ## Outcome counts: ## Event count Person count -## 3 11689 4943 +## 3 36380 7447 ## ## Covariates: -## Number of covariates: 67456 -## Number of non-zero covariate values: 46799035 +## Number of covariates: 62004 +## Number of non-zero covariate values: 41097434 @@ -521,12 +520,12 @@

Propensity score diagnostics## # A tibble: 6 x 3 ## coefficient covariateId covariateName ## <dbl> <dbl> <chr> -## 1 -2.09 1150871413 ...gh 0 days relative to index: misoprostol -## 2 1.13 2007006 index year: 2007 -## 3 -1.09 44967547602 ...ative to index: LIPOPEN ULTRA CREAM BASE -## 4 -0.946 45001512604 ...ive to index: PCCA CUSTOM LIPO-MAX CREAM -## 5 -0.921 3003 age group: 15 - 19 -## 6 0.915 4048191212 ... index: Enlargement of tonsil or adenoid +## 1 -3.47 1150871413 ...gh 0 days relative to index: misoprostol +## 2 -2.45 2016006 index year: 2016 +## 3 -2.43 2017006 index year: 2017 +## 4 -2.39 2018006 index year: 2018 +## 5 -2.37 2015006 index year: 2015 +## 6 -2.30 2014006 index year: 2014

One advantage of using the regularization when fitting the propensity model is that most coefficients will shrink to zero and fall out of the model. It is a good idea to inspect the remaining variables for anything @@ -566,12 +565,12 @@

Using the propensity score## # A tibble: 6 x 5 ## description targetPersons comparatorPersons targetExposures comparatorExposures ## <chr> <dbl> <dbl> <dbl> <dbl> -## 1 Original cohorts 190395 1006837 333945 1827883 -## 2 First exp. only & removed s ... 87178 734982 87178 734982 +## 1 Original cohorts 856973 915830 1946114 1786318 +## 2 First exp. only & removed s ... 373874 541386 373874 541386 ## 3 Random sample 50000 50000 50000 50000 -## 4 No prior outcome 48681 48712 48681 48712 -## 5 Have at least 1 days at ris ... 48641 48683 48641 48683 -## 6 Matched on propensity score 25399 25399 25399 25399 +## 4 No prior outcome 48700 48715 48700 48715 +## 5 Have at least 1 days at ris ... 48667 48688 48667 48688 +## 6 Matched on propensity score 22339 22339 22339 22339

Or, if we like, we can plot an attrition diagram:

@@ -587,7 +586,7 @@

Evaluating covariate balancebalance <- computeCovariateBalance(matchedPop, cohortMethodData)

 plotCovariateBalanceScatterPlot(balance, showCovariateCountLabel = TRUE, showMaxLabel = TRUE)
-
## Warning: Removed 25390 rows containing missing values (`geom_point()`).
+
## Warning: Removed 23590 rows containing missing values (`geom_point()`).

 plotCovariateBalanceOfTopVariables(balance)
@@ -610,97 +609,86 @@

Inspecting select populati Target Comparator Target Comparator Characteristic % % Std. diff % % Std. diff Age group - 0 - 4 0.4 0.0 0.08 0.1 0.1 0.02 - 5 - 9 0.7 0.1 0.09 0.2 0.2 0.01 - 10 - 14 1.2 1.8 -0.05 1.2 1.2 0.00 - 15 - 19 3.5 8.5 -0.21 4.8 4.1 0.03 - 20 - 24 2.6 6.0 -0.17 3.7 3.3 0.02 - 25 - 29 4.5 8.6 -0.17 6.1 5.6 0.02 - 30 - 34 6.8 10.6 -0.14 8.6 8.3 0.01 - 35 - 39 8.1 11.0 -0.10 10.2 9.9 0.01 - 40 - 44 9.3 10.0 -0.02 10.4 10.4 0.00 - 45 - 49 10.3 9.7 0.02 10.5 11.0 -0.01 - 50 - 54 12.5 10.3 0.07 12.0 12.5 -0.02 - 55 - 59 13.1 9.9 0.10 12.3 12.7 -0.01 - 60 - 64 12.6 7.6 0.17 10.2 10.7 -0.02 - 65 - 69 4.8 2.2 0.14 3.2 3.5 -0.01 - 70 - 74 3.2 1.3 0.13 2.1 2.1 0.00 - 75 - 79 2.6 1.0 0.12 1.8 1.7 0.01 - 80 - 84 2.1 0.8 0.11 1.2 1.3 -0.01 - 85 - 89 1.5 0.7 0.08 1.2 1.1 0.00 - 90 - 94 0.1 0.1 0.00 0.1 0.2 -0.01 - Gender: female 67.9 70.4 -0.06 69.2 68.9 0.01 - Race - race = Black or African American 18.4 27.6 -0.22 21.9 21.1 0.02 - race = White 63.4 54.4 0.18 58.6 59.3 -0.02 - Ethnicity - ethnicity = Hispanic or Latino 3.3 3.9 -0.03 4.0 4.0 0.00 + 25 - 29 0.0 0.0 + 30 - 34 0.0 0.0 + 40 - 44 0.0 0.0 0.00 0.0 0.0 -0.01 + 45 - 49 0.1 0.1 0.00 0.0 0.1 -0.01 + 50 - 54 0.2 0.2 0.00 0.2 0.2 0.00 + 55 - 59 0.5 0.5 -0.01 0.5 0.6 -0.01 + 60 - 64 0.8 1.2 -0.04 1.1 1.1 -0.01 + 65 - 69 25.8 29.0 -0.07 29.6 29.2 0.01 + 70 - 74 25.0 25.0 0.00 25.1 24.9 0.01 + 75 - 79 20.6 18.9 0.04 18.8 19.0 -0.01 + 80 - 84 15.2 13.2 0.06 13.4 13.7 -0.01 + 85 - 89 8.3 8.0 0.01 7.8 7.8 0.00 + 90 - 94 3.0 3.2 -0.01 2.9 2.8 0.01 + 95 - 99 0.6 0.7 -0.02 0.6 0.6 0.00 + 100 - 104 0.1 0.1 0.00 0.1 0.0 0.02 + Gender: female 59.5 61.8 -0.05 60.0 60.3 0.00 Medical history: General - Acute respiratory disease 32.0 36.1 -0.09 32.9 32.5 0.01 - Attention deficit hyperactivity disorder 3.6 4.4 -0.04 3.7 3.9 -0.01 - Chronic liver disease 4.0 3.4 0.03 3.5 3.6 -0.01 - Chronic obstructive lung disease 16.0 11.0 0.15 13.1 13.7 -0.02 - Crohn's disease 0.7 0.4 0.04 0.5 0.4 0.02 - Dementia 2.1 1.4 0.06 1.6 1.7 -0.01 - Depressive disorder 33.4 29.8 0.08 31.6 32.0 -0.01 - Diabetes mellitus 21.7 18.0 0.09 20.1 20.3 -0.01 - Gastroesophageal reflux disease 24.5 19.9 0.11 21.9 22.3 -0.01 - Gastrointestinal hemorrhage 4.0 3.3 0.04 2.4 2.5 -0.01 - Human immunodeficiency virus infection 0.7 0.8 -0.01 0.7 0.7 0.00 - Hyperlipidemia 31.8 25.4 0.14 29.4 30.1 -0.02 - Hypertensive disorder 46.2 38.7 0.15 42.6 43.7 -0.02 - Lesion of liver 1.8 1.4 0.03 1.4 1.5 0.00 - Obesity 20.2 19.5 0.02 19.6 19.7 0.00 - Osteoarthritis 47.1 33.2 0.29 40.9 42.3 -0.03 - Pneumonia 5.7 4.4 0.06 4.6 4.7 0.00 - Psoriasis 1.5 0.9 0.05 1.3 1.2 0.00 - Renal impairment 5.7 5.3 0.01 5.4 5.5 -0.01 - Rheumatoid arthritis 4.0 2.1 0.11 3.1 3.2 0.00 - Schizophrenia 2.8 2.3 0.03 2.3 2.4 -0.01 - Ulcerative colitis 0.4 0.3 0.03 0.3 0.3 0.00 - Urinary tract infectious disease 12.1 13.9 -0.05 12.1 11.8 0.01 - Viral hepatitis C 3.3 2.9 0.02 3.0 3.1 -0.01 - Visual system disorder 33.1 32.6 0.01 32.3 32.1 0.00 + Acute respiratory disease 18.4 22.2 -0.10 20.2 20.4 0.00 + Attention deficit hyperactivity disorder 0.1 0.2 -0.03 0.2 0.2 0.00 + Chronic liver disease 0.8 1.4 -0.05 1.0 1.1 -0.01 + Chronic obstructive lung disease 10.2 10.4 -0.01 9.4 9.6 -0.01 + Crohn's disease 0.3 0.4 -0.02 0.3 0.3 0.00 + Dementia 2.9 3.3 -0.03 2.8 2.9 -0.01 + Depressive disorder 6.2 9.3 -0.12 8.0 7.8 0.01 + Diabetes mellitus 18.6 25.3 -0.16 21.7 21.5 0.00 + Gastroesophageal reflux disease 10.0 15.1 -0.16 13.3 13.0 0.01 + Gastrointestinal hemorrhage 3.6 3.3 0.02 2.3 2.2 0.01 + Human immunodeficiency virus infection 0.0 0.1 -0.02 0.0 0.1 -0.01 + Hyperlipidemia 31.5 49.0 -0.36 42.7 41.8 0.02 + Hypertensive disorder 50.2 61.3 -0.22 56.8 56.5 0.01 + Lesion of liver 0.6 0.8 -0.02 0.6 0.6 0.00 + Obesity 3.8 7.3 -0.15 5.6 5.3 0.01 + Osteoarthritis 47.0 49.3 -0.05 50.6 50.0 0.01 + Pneumonia 4.7 4.7 0.00 4.0 4.2 -0.01 + Psoriasis 1.0 1.4 -0.03 1.3 1.2 0.01 + Renal impairment 4.7 10.5 -0.22 6.3 6.1 0.01 + Rheumatoid arthritis 2.4 3.0 -0.04 2.9 2.9 0.00 + Schizophrenia 0.1 0.1 -0.01 0.1 0.1 -0.01 + Ulcerative colitis 0.4 0.5 -0.02 0.4 0.4 0.00 + Urinary tract infectious disease 8.9 10.8 -0.06 9.7 9.6 0.00 + Viral hepatitis C 0.1 0.3 -0.04 0.2 0.2 0.00 Medical history: Cardiovascular disease - Atrial fibrillation 2.6 1.9 0.05 2.2 2.2 0.00 - Cerebrovascular disease 4.5 3.1 0.07 3.5 3.6 -0.01 - Coronary arteriosclerosis 8.1 5.5 0.10 6.5 6.7 0.00 - Heart disease 22.4 16.6 0.15 18.5 19.0 -0.01 - Heart failure 5.8 4.5 0.06 4.9 5.0 0.00 - Ischemic heart disease 5.6 4.1 0.07 4.6 4.8 -0.01 - Peripheral vascular disease 5.2 4.0 0.06 4.5 4.7 -0.01 - Pulmonary embolism 1.2 0.8 0.04 0.9 0.9 0.00 - Venous thrombosis 2.2 1.5 0.05 1.6 1.7 -0.01 + Atrial fibrillation 8.7 9.6 -0.03 8.2 8.4 -0.01 + Cerebrovascular disease 10.3 10.5 -0.01 9.5 9.6 0.00 + Coronary arteriosclerosis 17.2 18.4 -0.03 16.4 16.7 -0.01 + Heart disease 38.5 38.7 0.00 35.8 36.1 -0.01 + Heart failure 7.8 8.2 -0.01 6.3 6.4 0.00 + Ischemic heart disease 8.7 8.6 0.00 7.1 7.3 -0.01 + Peripheral vascular disease 7.3 10.1 -0.10 7.9 8.0 0.00 + Pulmonary embolism 0.7 0.8 -0.02 0.6 0.7 -0.01 + Venous thrombosis 1.9 2.5 -0.04 2.2 2.2 0.00 Medical history: Neoplasms - Hematologic neoplasm 1.4 0.7 0.07 0.8 0.9 -0.01 - Malignant lymphoma 0.4 0.2 0.03 0.3 0.3 -0.01 - Malignant neoplasm of anorectum 0.3 0.1 0.03 0.1 0.2 -0.01 - Malignant neoplastic disease 6.8 3.8 0.13 4.7 5.0 -0.02 - Malignant tumor of breast 1.6 0.9 0.06 1.2 1.2 0.00 - Malignant tumor of colon 0.4 0.2 0.04 0.2 0.3 -0.01 - Malignant tumor of lung 0.6 0.3 0.05 0.4 0.4 -0.01 - Malignant tumor of urinary bladder 0.2 0.1 0.03 0.1 0.1 0.00 - Primary malignant neoplasm of prostate 0.4 0.2 0.04 0.3 0.3 0.00 + Malignant lymphoma 0.8 0.9 -0.01 0.8 0.8 0.00 + Malignant neoplasm of anorectum 0.5 0.3 0.03 0.4 0.3 0.00 + Malignant neoplastic disease 17.3 17.8 -0.01 17.4 17.5 0.00 + Malignant tumor of breast 3.0 3.2 -0.01 3.1 3.1 0.00 + Malignant tumor of colon 0.9 0.7 0.02 0.8 0.7 0.00 + Malignant tumor of lung 0.7 0.5 0.02 0.6 0.6 0.01 + Malignant tumor of urinary bladder 0.8 0.8 0.00 0.8 0.8 0.00 + Primary malignant neoplasm of prostate 3.9 3.4 0.02 3.6 3.6 0.00 Medication use - Agents acting on the renin-angiotensin system 30.5 23.5 0.16 27.2 28.2 -0.02 - Antibacterials for systemic use 65.4 68.3 -0.06 65.5 64.8 0.02 - Antidepressants 50.7 43.1 0.15 47.5 48.8 -0.03 - Antiepileptics 40.7 33.5 0.15 37.5 38.6 -0.02 - Antiinflammatory and antirheumatic products 57.5 60.7 -0.06 58.3 58.0 0.01 - Antineoplastic agents 4.1 2.4 0.10 2.9 3.0 -0.01 - Antipsoriatics 1.4 1.9 -0.04 1.6 1.6 0.00 - Antithrombotic agents 19.2 12.4 0.19 14.3 14.9 -0.02 - Beta blocking agents 22.3 17.0 0.13 19.6 20.2 -0.02 - Calcium channel blockers 16.4 13.2 0.09 14.8 15.3 -0.02 - Diuretics 27.8 21.8 0.14 24.8 25.6 -0.02 - Drugs for acid related disorders 49.2 37.9 0.23 42.3 43.4 -0.02 - Drugs for obstructive airway diseases 51.4 47.2 0.08 49.4 49.9 -0.01 - Drugs used in diabetes 18.6 15.2 0.09 17.3 17.6 -0.01 - Immunosuppressants 3.9 2.2 0.10 3.1 3.1 0.00 - Lipid modifying agents 29.6 21.6 0.18 26.2 26.9 -0.02 - Opioids 55.4 50.2 0.10 50.8 51.4 -0.01 - Psycholeptics 49.4 41.3 0.16 44.7 45.7 -0.02 - Psychostimulants, agents used for adhd and nootropics 6.8 8.0 -0.05 7.4 7.5 0.00 + Agents acting on the renin-angiotensin system 44.2 49.6 -0.11 47.9 48.2 -0.01 + Antibacterials for systemic use 60.9 65.6 -0.10 61.8 62.4 -0.01 + Antidepressants 25.7 26.7 -0.02 26.2 26.5 -0.01 + Antiepileptics 14.7 17.8 -0.08 16.8 16.8 0.00 + Antiinflammatory and antirheumatic products 25.0 28.6 -0.08 28.9 28.8 0.00 + Antineoplastic agents 4.1 5.1 -0.05 4.8 4.7 0.00 + Antipsoriatics 0.7 1.1 -0.04 0.8 0.9 -0.01 + Antithrombotic agents 22.1 19.7 0.06 19.0 19.4 -0.01 + Beta blocking agents 34.4 38.1 -0.08 35.3 35.6 -0.01 + Calcium channel blockers 26.6 28.7 -0.05 26.9 27.2 -0.01 + Diuretics 42.4 41.2 0.02 40.5 41.3 -0.02 + Drugs for acid related disorders 37.1 38.9 -0.04 35.6 36.0 -0.01 + Drugs for obstructive airway diseases 38.2 44.7 -0.13 42.5 42.4 0.00 + Drugs used in diabetes 17.3 21.1 -0.10 18.5 18.6 0.00 + Immunosuppressants 3.0 4.9 -0.10 4.2 4.2 0.00 + Lipid modifying agents 49.1 56.0 -0.14 54.5 54.3 0.00 + Opioids 36.4 34.2 0.05 34.9 35.4 -0.01 + Psycholeptics 30.2 29.8 0.01 30.0 30.5 -0.01 + Psychostimulants, agents used for adhd and nootropics 1.5 1.8 -0.02 1.9 1.9 -0.01

Inserting the population cohort in the database @@ -745,8 +733,8 @@

Follow-up and power= 0.8, twoSided = TRUE )

-
##   targetPersons comparatorPersons targetExposures comparatorExposures targetDays comparatorDays totalOutcomes     mdrr        se
-## 1         48641             48683           48641               48683    6440255        3434785           270 1.406351 0.1217161
+
##   targetPersons comparatorPersons targetExposures comparatorExposures targetDays comparatorDays totalOutcomes    mdrr         se
+## 1         48667             48688           48667               48688    7421404        3693928           554 1.26878 0.08497186

In this example we used the studyPop object, so the population before any matching or trimming. If we want to know the MDRR after matching, we use the matchedPop object we created @@ -759,8 +747,8 @@

Follow-up and power= 0.8, twoSided = TRUE ) -
##   targetPersons comparatorPersons targetExposures comparatorExposures targetDays comparatorDays totalOutcomes     mdrr        se
-## 1         25399             25399           25399               25399    3142203        1979636           141 1.602992 0.1684304
+
##   targetPersons comparatorPersons targetExposures comparatorExposures targetDays comparatorDays totalOutcomes     mdrr       se
+## 1         22339             22339           22339               22339    3118703        1801997           226 1.451674 0.133038

Even thought the MDRR in the matched population is higher, meaning we have less power, we should of course not be fooled: matching most likely eliminates confounding, and is therefore preferred to not matching.

@@ -772,8 +760,8 @@

Follow-up and power
 getFollowUpDistribution(population = matchedPop)
##   100% 75% 50% 25%   0% Treatment
-## 1    2  60  60 119 5006         1
-## 2    2  43  60  62 2771         0
+## 1 2 60 60 126 4184 1 +## 2 2 45 60 67 2996 0

The output is telling us number of days of follow-up each quantile of the study population has. We can also plot the distribution:

@@ -801,8 +789,8 @@ 

Fitting a simple outcome model## Use inverse probability of treatment weighting: FALSE ## Status: OK ## -## Estimate lower .95 upper .95 logRr seLogRr -## treatment 0.82576 0.63952 1.06949 -0.19146 0.1312

+## Estimate lower .95 upper .95 logRr seLogRr +## treatment 1.25115 1.03524 1.51802 0.22406 0.0976

But of course we want to make use of the matching done on the propensity score:

Adding interaction terms @@ -861,11 +849,11 @@

Adding interaction terms## Use inverse probability of treatment weighting: FALSE ## Status: OK ## -## Estimate lower .95 upper .95 logRr seLogRr -## treatment 0.810179 0.506866 1.308308 -0.210500 0.2419 -## treatment * drug_era group during day 0 through 0 days relative to index: ANTITHROMBOTIC AGENTS 0.959870 0.486300 1.962772 -0.040957 0.3559 -## treatment * gender = FEMALE 1.010449 0.606663 1.674606 0.010395 0.2590 -## treatment * condition_era group during day -365 through 0 days relative to index: Type 2 diabetes mellitus 0.640379 0.370855 1.110151 -0.445694 0.2797 +## Estimate lower .95 upper .95 logRr seLogRr +## treatment 1.24991 0.87272 1.80961 0.22307 0.1860 +## treatment * condition_era group during day -365 through 0 days relative to index: Type 2 diabetes mellitus 1.05089 0.68593 1.62105 0.04964 0.2194 +## treatment * drug_era group during day 0 through 0 days relative to index: ANTITHROMBOTIC AGENTS 0.63846 0.42639 0.96305 -0.44870 0.2078 +## treatment * gender = FEMALE 0.78988 0.54227 1.14572 -0.23587 0.1908

Note that you can use the grepCovariateNames to find covariate IDs.

It is prudent to verify that covariate balance has also been achieved @@ -899,10 +887,10 @@

Adding covariates to the outcome ## Use covariates: TRUE ## Use inverse probability of treatment weighting: FALSE ## Status: OK -## Prior variance: 0.0693783423974274 +## Prior variance: 0.0374185437128226 ## -## Estimate lower .95 upper .95 logRr seLogRr -## treatment 0.79671 0.46421 1.34651 -0.22726 0.2717 +## Estimate lower .95 upper .95 logRr seLogRr +## treatment 0.9985318 0.6870719 1.4438456 -0.0014693 0.1894

Inspecting the outcome model @@ -911,16 +899,16 @@

Inspecting the outcome model
 exp(coef(outcomeModel))

## 900000010805 
-##    0.7967149
+## 0.9985318
 exp(confint(outcomeModel))
-
## [1] 0.4642065 1.3465141
+
## [1] 0.6870719 1.4438456

We can also see the covariates that ended up in the outcome model:

 getOutcomeModel(outcomeModel, cohortMethodData)
-
##   coefficient    id      name
-## 1  -0.2272584 9e+11 Treatment
+
##    coefficient    id      name
+## 1 -0.001469294 9e+11 Treatment

Kaplan-Meier plot @@ -944,7 +932,7 @@

Time-to-event plot= 3, firstExposureOnly = FALSE, washoutPeriod = 0, - removeDuplicateSubjects = FALSE, + removeDuplicateSubjects = "keep all", minDaysAtRisk = 1, riskWindowStart = 0, startAnchor = "cohort start", @@ -965,7 +953,7 @@

Acknowledgments## ## To cite package 'CohortMethod' in publications use: ## -## Schuemie M, Suchard M, Ryan P (2022). _CohortMethod: New-User Cohort Method with Large Scale Propensity and Outcome Models_. https://ohdsi.github.io/CohortMethod, +## Schuemie M, Suchard M, Ryan P (2023). _CohortMethod: New-User Cohort Method with Large Scale Propensity and Outcome Models_. https://ohdsi.github.io/CohortMethod, ## https://github.com/OHDSI/CohortMethod. ## ## A BibTeX entry for LaTeX users is @@ -974,7 +962,7 @@

Acknowledgments## title = {CohortMethod: New-User Cohort Method with Large Scale Propensity and Outcome ## Models}, ## author = {Martijn Schuemie and Marc Suchard and Patrick Ryan}, -## year = {2022}, +## year = {2023}, ## note = {https://ohdsi.github.io/CohortMethod, ## https://github.com/OHDSI/CohortMethod}, ## } diff --git a/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-21-1.png b/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-21-1.png index bd891ffa..8eac343a 100644 Binary files a/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-21-1.png and b/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-21-1.png differ diff --git a/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-25-1.png b/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-25-1.png index 4dfda65d..64152d8e 100644 Binary files a/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-25-1.png and b/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-25-1.png differ diff --git a/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-27-1.png b/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-27-1.png index 4ee452c0..4900e013 100644 Binary files a/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-27-1.png and b/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-27-1.png differ diff --git a/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-29-1.png b/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-29-1.png index 16e35ec9..b57065b8 100644 Binary files a/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-29-1.png and b/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-29-1.png differ diff --git a/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-33-1.png b/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-33-1.png index 35761354..14ff8bbc 100644 Binary files a/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-33-1.png and b/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-33-1.png differ diff --git a/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-37-1.png b/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-37-1.png index ec6acfd7..00c43feb 100644 Binary files a/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-37-1.png and b/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-37-1.png differ diff --git a/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-39-1.png b/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-39-1.png index 1a244902..7a43a30f 100644 Binary files a/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-39-1.png and b/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-39-1.png differ diff --git a/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-50-1.png b/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-50-1.png index 58fad45b..eaf0d183 100644 Binary files a/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-50-1.png and b/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-50-1.png differ diff --git a/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-60-1.png b/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-60-1.png index 471adc95..cf409532 100644 Binary files a/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-60-1.png and b/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-60-1.png differ diff --git a/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-70-1.png b/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-70-1.png index 51cd3990..f9b7ffa1 100644 Binary files a/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-70-1.png and b/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-70-1.png differ diff --git a/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-72-1.png b/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-72-1.png index 3b297634..80ab6608 100644 Binary files a/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-72-1.png and b/docs/articles/SingleStudies_files/figure-html/unnamed-chunk-72-1.png differ diff --git a/docs/articles/shinyApp.png b/docs/articles/shinyApp.png new file mode 100644 index 00000000..672f7c6f Binary files /dev/null and b/docs/articles/shinyApp.png differ diff --git a/docs/index.html b/docs/index.html index fed59d44..c1cc2dbf 100644 --- a/docs/index.html +++ b/docs/index.html @@ -179,7 +179,15 @@

InstallationUser Documentation

Documentation can be found on the package website.

-

PDF versions of the documentation are also available: * Vignette: Single studies using the CohortMethod package * Vignette: Running multiple analyses at once using the CohortMethod package * Package manual: CohortMethod.pdf

+

PDF versions of the documentation are also available:

+

Support diff --git a/docs/news/index.html b/docs/news/index.html index ebc979e5..8e11d25d 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -71,6 +71,7 @@

diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index fbd5f88d..e93b719b 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -4,5 +4,5 @@ pkgdown_sha: ~ articles: MultipleAnalyses: MultipleAnalyses.html SingleStudies: SingleStudies.html -last_built: 2023-02-28T16:16Z +last_built: 2023-04-17T06:36Z diff --git a/docs/reference/computePsAuc.html b/docs/reference/computePsAuc.html index 62329bb0..0c9fc23f 100644 --- a/docs/reference/computePsAuc.html +++ b/docs/reference/computePsAuc.html @@ -108,7 +108,7 @@

Examples

data <- data.frame(treatment = treatment, propensityScore = propensityScore) data <- data[data$propensityScore > 0 & data$propensityScore < 1, ] computePsAuc(data) -#> [1] 0.7183164 +#> [1] 0.7107288 diff --git a/docs/reference/createGetDbCohortMethodDataArgs.html b/docs/reference/createGetDbCohortMethodDataArgs.html index cdd1b43c..21ad273a 100644 --- a/docs/reference/createGetDbCohortMethodDataArgs.html +++ b/docs/reference/createGetDbCohortMethodDataArgs.html @@ -73,7 +73,7 @@

Create a parameter object for the function getDbCohortMethodData

studyStartDate = "", studyEndDate = "", firstExposureOnly = FALSE, - removeDuplicateSubjects = FALSE, + removeDuplicateSubjects = "keep all", restrictToCommonPeriod = FALSE, washoutPeriod = 0, maxCohortSize = 0, diff --git a/docs/reference/createPs.html b/docs/reference/createPs.html index 4e370b0a..604f60a8 100644 --- a/docs/reference/createPs.html +++ b/docs/reference/createPs.html @@ -172,9 +172,9 @@

Examples

#> Removing 0 redundant covariates #> Removing 0 infrequent covariates #> Normalizing covariates -#> Tidying covariates took 1.23 secs +#> Tidying covariates took 1.26 secs #> Warning: All coefficients (except maybe the intercept) are zero. Either the covariates are completely uninformative or completely predictive of the treatment. Did you remember to exclude the treatment variables from the covariates? -#> Creating propensity scores took 4.96 secs +#> Creating propensity scores took 4.62 secs diff --git a/docs/reference/exportToCsv.html b/docs/reference/exportToCsv.html index 1e0e8b77..fc0a929d 100644 --- a/docs/reference/exportToCsv.html +++ b/docs/reference/exportToCsv.html @@ -72,7 +72,7 @@

Export cohort method results to CSV files

exportToCsv(
   outputFolder,
   exportFolder = file.path(outputFolder, "export"),
-  databaseId = 1,
+  databaseId,
   minCellCount = 5,
   maxCores = 1,
   cmDiagnosticThresholds = createCmDiagnosticThresholds()
diff --git a/docs/reference/getDbCohortMethodData.html b/docs/reference/getDbCohortMethodData.html
index e03ded1d..4d74ab8f 100644
--- a/docs/reference/getDbCohortMethodData.html
+++ b/docs/reference/getDbCohortMethodData.html
@@ -86,7 +86,7 @@ 

Get the cohort data from the server

outcomeTable = "condition_occurrence", cdmVersion = "5", firstExposureOnly = FALSE, - removeDuplicateSubjects = FALSE, + removeDuplicateSubjects = "keep all", restrictToCommonPeriod = FALSE, washoutPeriod = 0, maxCohortSize = 0, diff --git a/docs/reference/getFileReference.html b/docs/reference/getFileReference.html index e19c4af1..6898d041 100644 --- a/docs/reference/getFileReference.html +++ b/docs/reference/getFileReference.html @@ -82,7 +82,7 @@

Arguments

Value

-

A tibble containing file nams of artifacts generated for each target-comparator-outcome-analysis combination.

+

A tibble containing file names of artifacts generated for each target-comparator-outcome-analysis combination.

diff --git a/docs/reference/getResultsDataModel.html b/docs/reference/getResultsDataModel.html new file mode 100644 index 00000000..6e17b562 --- /dev/null +++ b/docs/reference/getResultsDataModel.html @@ -0,0 +1,105 @@ + +Get results data model — getResultsDataModel • CohortMethod + + +
+
+ + + +
+
+ + +
+

Get results data model

+
+ +
+
getResultsDataModel()
+
+ +
+

Value

+ + +

A tibble specifying the tables and columns generated by the exportToCsv() function.

+
+ +
+ +
+ + +
+ + + + + + + + diff --git a/docs/reference/index.html b/docs/reference/index.html index 6e26b48b..13c8d5d3 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -314,7 +314,11 @@

Running multiple analyses runCmAnalyses()

Run a list of analyses

- + +

Results of multiple analyses

+

Functions for viewing results of multiple analyses.

+ +

getFileReference()

Get file reference

@@ -334,6 +338,26 @@

Running multiple analyses exportToCsv()

Export cohort method results to CSV files

+ +

getResultsDataModel()

+ +

Get results data model

+ +

insertExportedResultsInSqlite()

+ +

Insert exported results into a SQLite database

+ +

launchResultsViewerUsingSqlite()

+ +

Launch Shiny app using a SQLite database

+ +

uploadExportedResults()

+ +

Upload exported results to a database

+ +

launchResultsViewer()

+ +

Launch Shiny app using

Simulation

Functions for simulating cohort method data objects.

diff --git a/docs/reference/insertExportedResultsInSqlite.html b/docs/reference/insertExportedResultsInSqlite.html new file mode 100644 index 00000000..1e8ffec6 --- /dev/null +++ b/docs/reference/insertExportedResultsInSqlite.html @@ -0,0 +1,125 @@ + +Insert exported results into a SQLite database — insertExportedResultsInSqlite • CohortMethod + + +
+
+ + + +
+
+ + +
+

Insert exported results into a SQLite database

+
+ +
+
insertExportedResultsInSqlite(sqliteFileName, exportFolder, cohorts)
+
+ +
+

Arguments

+
sqliteFileName
+

The name of the SQLite file to store the results in. If the +file does not exist it will be created.

+ + +
exportFolder
+

The folder containing the CSV files to upload, as generated +using the exportToCsv() function.

+ + +
cohorts
+

A data frame describing the cohorts used in the study. Should +include the target, comparator, and outcome of interest cohorts. +The data frame should at least have a cohortId and cohortName +columns.

+ +
+
+

Value

+ + +

Does not return anything. Called for the side effect of inserting data into the +SQLite database.

+
+ +
+ +
+ + +
+ + + + + + + + diff --git a/docs/reference/launchResultsViewer.html b/docs/reference/launchResultsViewer.html new file mode 100644 index 00000000..2ece2e9d --- /dev/null +++ b/docs/reference/launchResultsViewer.html @@ -0,0 +1,118 @@ + +Launch Shiny app using — launchResultsViewer • CohortMethod + + +
+
+ + + +
+
+ + +
+

Launch Shiny app using

+
+ +
+
launchResultsViewer(connectionDetails, databaseSchema)
+
+ +
+

Arguments

+
connectionDetails
+

An R object of type connectionDetails created using the +DatabaseConnector::createConnectionDetails() function.

+ + +
databaseSchema
+

The name of the database schema where the results were +written using uploadExportedResults().

+ +
+
+

Value

+ + +

Does not return anything. Is called for the side-effect of launching the Shiny +app.

+
+ +
+ +
+ + +
+ + + + + + + + diff --git a/docs/reference/launchResultsViewerUsingSqlite.html b/docs/reference/launchResultsViewerUsingSqlite.html new file mode 100644 index 00000000..448c4813 --- /dev/null +++ b/docs/reference/launchResultsViewerUsingSqlite.html @@ -0,0 +1,113 @@ + +Launch Shiny app using a SQLite database — launchResultsViewerUsingSqlite • CohortMethod + + +
+
+ + + +
+
+ + +
+

Launch Shiny app using a SQLite database

+
+ +
+
launchResultsViewerUsingSqlite(sqliteFileName)
+
+ +
+

Arguments

+
sqliteFileName
+

The name of the SQLite file where the results were stored +using the insertExportedResultsInSqlite() function.

+ +
+
+

Value

+ + +

Does not return anything. Is called for the side-effect of launching the Shiny +app.

+
+ +
+ +
+ + +
+ + + + + + + + diff --git a/docs/reference/uploadExportedResults.html b/docs/reference/uploadExportedResults.html new file mode 100644 index 00000000..ae32e4bb --- /dev/null +++ b/docs/reference/uploadExportedResults.html @@ -0,0 +1,142 @@ + +Upload exported results to a database — uploadExportedResults • CohortMethod + + +
+
+ + + +
+
+ + +
+

Upload exported results to a database

+
+ +
+
uploadExportedResults(
+  connectionDetails,
+  databaseSchema,
+  append = FALSE,
+  exportFolder,
+  cohorts
+)
+
+ +
+

Arguments

+
connectionDetails
+

An R object of type connectionDetails created using the +DatabaseConnector::createConnectionDetails() function.

+ + +
databaseSchema
+

The name of the database schema where the results will be +written.

+ + +
append
+

Append the results to existing tables? Can be used for +uploading results from multiple databases into a single +results schema.

+ + +
exportFolder
+

The folder containing the CSV files to upload, as generated +using the exportToCsv() function.

+ + +
cohorts
+

A data frame describing the cohorts used in the study. Should +include the target, comparator, and outcome of interest cohorts. +The data frame should at least have a cohortId and cohortName +columns.

+ +
+
+

Value

+ + +

Does not return anything. Is called for the side-effect of having the results uploaded +to the server.

+
+ +
+ +
+ + +
+ + + + + + + + diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 9d3907ad..f39910c6 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -159,6 +159,9 @@ /reference/getPsModel.html + + /reference/getResultsDataModel.html + /reference/getResultsSummary.html @@ -171,9 +174,18 @@ /reference/insertDbPopulation.html + + /reference/insertExportedResultsInSqlite.html + /reference/isCohortMethodData.html + + /reference/launchResultsViewer.html + + + /reference/launchResultsViewerUsingSqlite.html + /reference/loadCmAnalysisList.html @@ -246,4 +258,7 @@ /reference/truncateIptw.html + + /reference/uploadExportedResults.html + diff --git a/extras/CohortMethod.pdf b/extras/CohortMethod.pdf index 92d3d65a..29c7b2ec 100644 Binary files a/extras/CohortMethod.pdf and b/extras/CohortMethod.pdf differ diff --git a/extras/MultiAnalysesVignetteDataFetch.R b/extras/MultiAnalysesVignetteDataFetch.R index 8da94a0c..cd37c297 100644 --- a/extras/MultiAnalysesVignetteDataFetch.R +++ b/extras/MultiAnalysesVignetteDataFetch.R @@ -26,23 +26,15 @@ folder <- "d:/temp/cohortMethodVignette2" # Set connection details ------------------------------------------------------- -# MDCD on RedShift +# MDCR on RedShift connectionDetails <- DatabaseConnector::createConnectionDetails(dbms = "redshift", - connectionString = keyring::key_get("redShiftConnectionStringMdcd"), + connectionString = keyring::key_get("redShiftConnectionStringOhdaMdcr"), user = keyring::key_get("redShiftUserName"), password = keyring::key_get("redShiftPassword")) -cdmDatabaseSchema <- "cdm" -resultsDatabaseSchema <- "scratch_mschuemi2" +cdmDatabaseSchema <- "cdm_truven_mdcr_v2322" +resultsDatabaseSchema <- "scratch_mschuemi" cdmVersion <- "5" -# Eunomia -cdmDatabaseSchema <- "main" -resultsDatabaseSchema <- "main" -cdmVersion <- "5" - -connectionDetails <- Eunomia::getEunomiaConnectionDetails() - - # Create cohorts --------------------------------------------------------------- connection <- DatabaseConnector::connect(connectionDetails) diff --git a/extras/SingleStudyVignetteDataFetch.R b/extras/SingleStudyVignetteDataFetch.R index 29375a01..cdf9ba38 100644 --- a/extras/SingleStudyVignetteDataFetch.R +++ b/extras/SingleStudyVignetteDataFetch.R @@ -23,21 +23,15 @@ folder <- "d:/temp/cohortMethodVignette" # dir.create(folder) # Set connection details ------------------------------------------------------- -# MDCD on RedShift +# MDCR on RedShift connectionDetails <- DatabaseConnector::createConnectionDetails( dbms = "redshift", - connectionString = keyring::key_get("redShiftConnectionStringMdcd"), + connectionString = keyring::key_get("redShiftConnectionStringOhdaMdcr"), user = keyring::key_get("redShiftUserName"), password = keyring::key_get("redShiftPassword") ) -cdmDatabaseSchema <- "cdm" -resultsDatabaseSchema <- "scratch_mschuemi2" -cdmVersion <- "5" - -# Eunomia -connectionDetails <- Eunomia::getEunomiaConnectionDetails() -cdmDatabaseSchema <- "main" -resultsDatabaseSchema <- "main" +cdmDatabaseSchema <- "cdm_truven_mdcr_v2322" +resultsDatabaseSchema <- "scratch_mschuemi" cdmVersion <- "5" # Create cohorts --------------------------------------------------------------- diff --git a/extras/balanceScatterplot.png b/extras/balanceScatterplot.png index b1b2be19..41e58257 100644 Binary files a/extras/balanceScatterplot.png and b/extras/balanceScatterplot.png differ diff --git a/extras/ps.png b/extras/ps.png index 79509e4d..dcf0daaa 100644 Binary files a/extras/ps.png and b/extras/ps.png differ diff --git a/inst/doc/MultipleAnalyses.pdf b/inst/doc/MultipleAnalyses.pdf index 17f83420..1859ed50 100644 Binary files a/inst/doc/MultipleAnalyses.pdf and b/inst/doc/MultipleAnalyses.pdf differ diff --git a/inst/doc/SingleStudies.pdf b/inst/doc/SingleStudies.pdf index a3da415b..4eb2c3e1 100644 Binary files a/inst/doc/SingleStudies.pdf and b/inst/doc/SingleStudies.pdf differ diff --git a/inst/sql/sql_server/coxibVsNonselVsGiBleed.sql b/inst/sql/sql_server/coxibVsNonselVsGiBleed.sql index 12f597eb..807676d8 100644 --- a/inst/sql/sql_server/coxibVsNonselVsGiBleed.sql +++ b/inst/sql/sql_server/coxibVsNonselVsGiBleed.sql @@ -2,7 +2,7 @@ File coxibVsNonselVsGiBleed.sql ***********************************/ -DROP TABLE IF EXIST @resultsDatabaseSchema.coxibVsNonselVsGiBleed; +DROP TABLE IF EXISTS @resultsDatabaseSchema.coxibVsNonselVsGiBleed; CREATE TABLE @resultsDatabaseSchema.coxibVsNonselVsGiBleed ( cohort_definition_id INT, diff --git a/man/getFileReference.Rd b/man/getFileReference.Rd index 75a6e30d..4d66d566 100644 --- a/man/getFileReference.Rd +++ b/man/getFileReference.Rd @@ -10,7 +10,7 @@ getFileReference(outputFolder) \item{outputFolder}{Name of the folder where all the outputs have been written to.} } \value{ -A tibble containing file nams of artifacts generated for each target-comparator-outcome-analysis combination. +A tibble containing file names of artifacts generated for each target-comparator-outcome-analysis combination. } \description{ Get file reference diff --git a/tests/testthat/test-eunomia.R b/tests/testthat/test-eunomia.R index 560936ae..4eeb3765 100644 --- a/tests/testthat/test-eunomia.R +++ b/tests/testthat/test-eunomia.R @@ -216,6 +216,16 @@ test_that("Multiple analyses", { targetComparatorOutcome <- readr::read_csv(file.path(outputFolder, "export", "cm_target_comparator_outcome.csv"), show_col_types = FALSE) expect_true(is.numeric(targetComparatorOutcome$outcome_of_interest)) + cohorts <- data.frame( + cohortId = c(1, 2, 998, 999, 3, 4), + cohortName = c("e1", "e2", "e3", "e4", "o1", "o2") + ) + insertExportedResultsInSqlite(sqliteFileName = file.path(outputFolder, "export", "results.sqlite"), + exportFolder = file.path(outputFolder, "export"), + cohorts = cohorts) + expect_true(file.exists(file.path(outputFolder, "export", "results.sqlite"))) + + # Make all people one gender for cmAnalysis4 so that interaction terms don't throw a warning connection <- DatabaseConnector::connect(connectionDetails) diff --git a/vignettes/MultipleAnalyses.Rmd b/vignettes/MultipleAnalyses.Rmd index 970f6463..1a362a82 100644 --- a/vignettes/MultipleAnalyses.Rmd +++ b/vignettes/MultipleAnalyses.Rmd @@ -309,7 +309,7 @@ A convenient way to save `cmAnalysisList` to file is by using the `saveCmAnalysi ## Covariate balance -In our code, we specified that covariate balance must be computed for some of our analysis. For computational reasons, covariate balance has been split into two: We can compute covariate balance for each target-comparator-outcome-analysis combination, and we can compute covariate balance for each target-comparator-analysis, so across all outcomes. The latter is referred to as 'shared covariate balance'. Since there can be many outcomes, it is often not feasible to recompute (or store) balance for all covariates for each outcome. Moreover, the differences between study populations for the various outcomes are likely very small; the only differences will arise from removing those having the outcome prior, which will exlude different people from the study population depending on the outcome. We therefore typically compute the balance for all covariates across all outcomes (shared balance), and only for a small subset of covariates for each outcome. In the code above, we use all covariates for the shared balance computation, which we typically use to evaluate whether our analysis achieved covariate balance. We limit the covariates for the per-outcome balance computations to only those used for the standard 'table 1' definition used in the `getDefaultCmTable1Specifications()` function, which we can use to create a 'table 1' for each outcome. +In our code, we specified that covariate balance must be computed for some of our analysis. For computational reasons, covariate balance has been split into two: We can compute covariate balance for each target-comparator-outcome-analysis combination, and we can compute covariate balance for each target-comparator-analysis, so across all outcomes. The latter is referred to as 'shared covariate balance'. Since there can be many outcomes, it is often not feasible to recompute (or store) balance for all covariates for each outcome. Moreover, the differences between study populations for the various outcomes are likely very small; the only differences will arise from removing those having the outcome prior, which will exclude different people from the study population depending on the outcome. We therefore typically compute the balance for all covariates across all outcomes (shared balance), and only for a small subset of covariates for each outcome. In the code above, we use all covariates for the shared balance computation, which we typically use to evaluate whether our analysis achieved covariate balance. We limit the covariates for the per-outcome balance computations to only those used for the standard 'table 1' definition used in the `getDefaultCmTable1Specifications()` function, which we can use to create a 'table 1' for each outcome. # Executing multiple analyses @@ -557,6 +557,9 @@ launchResultsViewerUsingSqlite( ) ``` +```{r echo=FALSE, fig.cap="CohortMethod Shiny app", out.width = '80%'} +knitr::include_graphics("shinyApp.png") +``` # Acknowledgments diff --git a/vignettes/shinyApp.png b/vignettes/shinyApp.png new file mode 100644 index 00000000..672f7c6f Binary files /dev/null and b/vignettes/shinyApp.png differ