calculate_group_frequency: Calculate group frequency for all unique combinations

Description Usage Arguments Value Examples

View source: R/calculate_group_frequency.R

Description

Generate an ordered data.frame of different disease combinations on the basis of the most frequent or most strongly associated with outcomes.

Usage

1
2
3
4
5
6
7
8
calculate_group_frequency(
  unique_combinations,
  all_diseases,
  outcome_positions,
  min_freq = 0,
  tots,
  use_outcome = FALSE
)

Arguments

unique_combinations

List of unique combinations of disease positions for a given number of combinations, generated using unique_combos.

all_diseases

List of positions associated with each disease, generated using get_disease_counts().

outcome_positions

Numeric vector where each element refers to a record that suffered a particular outcome.

min_freq

Number between 0 and 1; minimum proportion of code combinations to be included in the stem. If outcome_column is passed, min_freq is the minimum event rate per combination to be considered.

tots

Numeric, total length of comorbid_column initially profiled to calculate frequency proportions to compare against min_freq.

use_outcome

Logical if to use outcome variable for stem generation.

Value

data.frame ordered from lowest to highest proportion of those suffering outcomes (if outcome_positions entered) or number of records associated with that combination (if no outcome_positions entered).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
disease_counts = list(c(1), c(1,4), c(1,2,3,4), c(1))
unique_pos = structure(c(1, 1, 1, 2, 2, 3, 2, 3, 4, 3, 4, 4), .Dim = c(6L, 2L))

calculate_group_frequency(unique_combinations = unique_pos,
all_diseases = disease_counts,
outcome_positions = 0, tots = 4)

calculate_group_frequency(unique_combinations = unique_pos,
all_diseases = disease_counts,
outcome_positions = c(0,1,1,0), tots = 4)

AJFOWLER/comorbidgroupr documentation built on April 8, 2021, 3:51 a.m.