Multi-Site Analysis for Independent Data Sources
Source:vignettes/multisite_independent.Rmd
multisite_independent.RmdThe multi-site analyses included in this suite are intended to be executed against data that are all stored in the same place. However, there may be some instances where the data associated with each site is stored in independent locations. This vignette outlines how the multi-site analysis can be executed in these instances.
After following the instructions to reproduce the analysis, you will
also need to change the output_function column to tell the
csd_output function which check you executed. Reference the
table below for the labels that are associated with each check:
| Check Type | output_function |
|---|---|
| Multi Site, Exploratory, Cross-Sectional | csd_ms_exp_cs |
| Multi Site, Exploratory, Longitudinal | csd_ms_exp_la |
| Multi Site, Anomaly Detection, Cross-Sectional | csd_ms_anom_cs |
| Multi Site, Anomaly Detection, Longitudinal | csd_ms_anom_la |
Multi-Site Exploratory Analysis
The process for the exploratory analysis is the same for both the cross-sectional and longitudinal configurations.
First, execute either of the Single Site, Exploratory analyses, configured appropriately for your study, against each data source.
library(conceptsetdistribution)
my_table <- csd_process(cohort = my_cohort,
multi_or_single_site = 'single',
anomaly_or_exploratory = 'exploratory',
time = T / F,
...)Then, combine these results into a single table with the different
sites delineated in the site column.
Multi-Site Anomaly Detection Analysis
For anomaly detection analysis, start by executing the same steps as the exploratory analysis. Then, you will execute the relevant anomaly detection algorithm against the resulting table. See below for the different processes for cross-sectional and longitudinal analysis.
Cross-Sectional
For a cross-sectional analysis, the
compute_dist_anomalies and detect_outliers
functions, both available through the squba.gen package,
should be executed against your results. Copy the code below, inputting
the table you generated.
If using the OMOP CDM, concept_id should be input as the
concept column. For the PCORnet CDM, concept_code should be
input as the concept column. The p_value can be selected by
the user.
# First execute the compute_dist_anomalies function
df_start <- compute_dist_anomalies(df_tbl = my_table,
grp_vars = c('variable', concept_column),
var_col = 'prop_concept',
denom_cols = c('variable', 'ct_denom'))
# Then, use that output as input for the detect_outliers function
df_final <- detect_outliers(df_tbl = df_start,
tail_input = 'both',
p_input = p_value,
column_analysis = 'prop_concept',
column_variable = concept_column) %>%
dplyr::mutate(output_function = '{see table above}')Longitudinal
For a longitudinal analysis, the ms_anom_euclidean
function, available through the squba.gen package, should
be executed against your results. Copy the code below, inputting the
data you generated.
If using the OMOP CDM, concept_id should be input as the
concept column. For the PCORnet CDM, concept_code should be
input as the concept column.
df <- ms_anom_euclidean(fot_input_tbl = csd_tbl,
grp_vars = c('site', 'variable',
concept_column),
var_col = 'prop_concept') %>%
dplyr::mutate(output_function = '{see table above}')