Compare principal and any-slot diagnosis matches
Source:R/dx-sensitivity.R
nis_audit_dx_position.RdCompare principal, secondary-only, and any-position diagnosis definitions.
Arguments
- .data
A data frame or lazy DuckDB query.
- code
Non-missing character vector of diagnosis prefixes.
- system
Code system of the diagnosis slots:
"icd10"(default) or"icd9"(experimental, NIS 2012 to Q3 2015).- weight_var
Name of the discharge weight column. Defaults to
DISCWT.- outcomes
<tidy-select> Outcome columns to summarize. By default, selects
DIEDandELECTIVEwhen present. UseNULLto omit rates orall_of()to select a character vector of names. Use name-based selectors on DuckDB queries.
Value
A collected tibble with one row per presentation and unweighted and weighted counts, shares of all prefix-positive presentations, and rates for requested outcomes. The principal presentation is a strict subset of any-position cases, so Cohen's kappa is not meaningful here. Existing input groups are ignored: summaries describe the full input. Empty inputs return zero counts and missing shares and rates. Missing weights are omitted from weighted sums; missing outcomes are excluded from that outcome's denominator. Rates with zero denominators are missing.
Details
The result describes how the diagnosis position changes counts
and selected outcome rates. Use nis_design() to estimate standard
errors. Review disclosure before sharing the results.
See also
Other cohort-definition:
nis_attrition(),
nis_audit_code_transition(),
nis_audit_prday(),
nis_ccsr_codes(),
nis_flag_dx(),
nis_flag_pr(),
nis_flag_pr_timing(),
nis_write_cohort()
Examples
nis <- nis_open(nis_example(years = 2019))
nis_audit_dx_position(nis, "I50")
#> # A tibble: 3 × 9
#> presentation n_unweighted n_weighted pct_of_any_unweighted pct_of_any_weighted
#> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 principal 54 62.4 100 100
#> 2 secondary_o… 0 0 0 0
#> 3 any 54 62.4 100 100
#> # ℹ 4 more variables: DIED_rate_unweighted <dbl>, DIED_rate_weighted <dbl>,
#> # ELECTIVE_rate_unweighted <dbl>, ELECTIVE_rate_weighted <dbl>
outcome_names <- c("ELECTIVE", "DIED")
nis_audit_dx_position(nis, "I50", outcomes = tidyselect::all_of(outcome_names))
#> # A tibble: 3 × 9
#> presentation n_unweighted n_weighted pct_of_any_unweighted pct_of_any_weighted
#> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 principal 54 62.4 100 100
#> 2 secondary_o… 0 0 0 0
#> 3 any 54 62.4 100 100
#> # ℹ 4 more variables: ELECTIVE_rate_unweighted <dbl>,
#> # ELECTIVE_rate_weighted <dbl>, DIED_rate_unweighted <dbl>,
#> # DIED_rate_weighted <dbl>