# Get started with smdi

#### Janick Weberpals

    library(smdi)
    library(gt)

# `smdi_diagnose()` - the flagship function

The `smdi` main function is `smdi_diagnose()` which calls all three group diagnostics, all of which are also accessible individually.

`smdi_diagnose()` builds on theoretical concepts developed and validated in a comprehensive simulation study based on the workstream:

Approaches to Handling Partially Observed Confounder Data From Electronic Health Records (EHR) In Non-randomized Studies of Medication Outcomes.

A most minimal example could look like this (if you want to accept all of the default parameters).

    smdi_diagnose(
      data = smdi_data,
      covar = NULL, # NULL includes all covariates with at least one NA
      model = "cox",
      form_lhs = "Surv(eventtime, status)"
      ) %>%
      smdi_style_gt()

Covariate | ASMD (min/max)1 | p Hotelling1 | AUC2 | beta univariate (95% CI)3 | beta (95% CI)3
--- | --- | --- | --- | --- | ---
ecog_cat | 0.030 (0.003, 0.071) | 0.783 | 0.522 | -0.06 (95% CI -0.16, 0.03) | -0.06 (95% CI -0.16, 0.03)
egfr_cat | 0.216 (0.010, 0.485) | <.001 | 0.613 | 0.06 (95% CI -0.03, 0.15) | -0.01 (95% CI -0.10, 0.09)
pdl1_num | 0.056 (0.016, 0.338) | <.001 | 0.517 | 0.12 (95% CI 0.01, 0.23) | 0.11 (95% CI -0.00, 0.22)
p little: <.001, Abbreviations: ASMD = Median absolute standardized mean difference across all covariates, AUC = Area under the curve, beta = beta coefficient, CI = Confidence interval, max = Maximum, min = Minimum
1 Group 1 diagnostic: Differences in patient characteristics between patients with and without covariate
2 Group 2 diagnostic: Ability to predict missingness
3 Group 3 diagnostic: Assessment if missingness is associated with the outcome (univariate, adjusted)