Run a list of analyses

runCmAnalyses(
connectionDetails,
cdmDatabaseSchema,
oracleTempSchema = cdmDatabaseSchema,
exposureDatabaseSchema = cdmDatabaseSchema,
exposureTable = "drug_era",
outcomeDatabaseSchema = cdmDatabaseSchema,
outcomeTable = "condition_occurrence",
cdmVersion = 5,
outputFolder = "./CohortMethodOutput",
cmAnalysisList,
targetComparatorOutcomesList,
refitPsForEveryOutcome = FALSE,
refitPsForEveryStudyPopulation = TRUE,
prefilterCovariates = TRUE,
outcomeIdsOfInterest
)

## Arguments

connectionDetails An R object of type connectionDetails created using the function createConnectionDetails in the DatabaseConnector package. The name of the database schema that contains the OMOP CDM instance. Requires read permissions to this database. On SQL Server, this should specify both the database and the schema, so for example 'cdm_instance.dbo'. For Oracle only: the name of the database schema where you want all temporary tables to be managed. Requires create/insert permissions to this database. The name of the database schema that is the location where the exposure data used to define the exposure cohorts is available. If exposureTable = DRUG_ERA, exposureDatabaseSchema is not used by assumed to be cdmSchema. Requires read permissions to this database. The tablename that contains the exposure cohorts. If exposureTable <> DRUG_ERA, then expectation is exposureTable has format of COHORT table: COHORT_DEFINITION_ID, SUBJECT_ID, COHORT_START_DATE, COHORT_END_DATE. The name of the database schema that is the location where the data used to define the outcome cohorts is available. If exposureTable = CONDITION_ERA, exposureDatabaseSchema is not used by assumed to be cdmSchema. Requires read permissions to this database. The tablename that contains the outcome cohorts. If outcomeTable <> CONDITION_OCCURRENCE, then expectation is outcomeTable has format of COHORT table: COHORT_DEFINITION_ID, SUBJECT_ID, COHORT_START_DATE, COHORT_END_DATE. Define the OMOP CDM version used: currently support "4" and "5". Name of the folder where all the outputs will written to. A list of objects of type cmAnalysis as created using the createCmAnalysis function. A list of objects of type targetComparatorOutcomes as created using the createTargetComparatorOutcomes function. Should the propensity model be fitted for every outcome (i.e. after people who already had the outcome are removed)? If false, a single propensity model will be fitted, and people who had the outcome previously will be removed afterwards. Should the propensity model be fitted for every study population definition? If false, a single propensity model will be fitted, and the study population criteria will be applied afterwards. If TRUE, and some outcome models require filtering covariates by concept ID (e.g. because includeCovariateIds or interactionCovariateIds is specified), this filtering will be done once for all outcome models that need it. This can greatly speed up the analyses if multiple outcome models require the same filtering. The number of parallel threads to use for building the cohortMethod data objects. The number of parallel threads to use for fitting the propensity models. The number of parallel threads to use for the cross- validation when estimating the hyperparameter for the propensity model. Note that the total number of CV threads at one time could be createPsThreads * psCvThreads. The number of parallel threads to use for creating the study population. The number of parallel threads to use for trimming, matching and stratifying. The number of parallel threads to use for prefiltering covariates. The number of parallel threads to use for fitting the outcome models. The number of parallel threads to use for the cross- validation when estimating the hyperparameter for the outcome model. Note that the total number of CV threads at one time could be fitOutcomeModelThreads * outcomeCvThreads. If provided, creation of non-essential files will be skipped for all other outcome IDs. This could be helpful to speed up analyses with many controls.

## Value

A tibble describing for each target-comparator-outcome-analysisId combination where the intermediary and outcome model files can be found, relative to the outputFolder.

## Details

Run a list of analyses for the target-comparator-outcomes of interest. This function will run all specified analyses against all hypotheses of interest, meaning that the total number of outcome models is length(cmAnalysisList) * length(targetComparatorOutcomesList)` (if all analyses specify an outcome model should be fitted). When you provide several analyses it will determine whether any of the analyses have anything in common, and will take advantage of this fact. For example, if we specify several analyses that only differ in the way the outcome model is fitted, then this function will extract the data and fit the propensity model only once, and re-use this in all the analysis.