stem_funnel_plot: Funnel plot of combinations at a given stem level.

Description Usage Arguments Value Examples

View source: R/stem_funnel_plot.R

Description

Create a funnel plot for a binary outcome for each combination of diseases. Uses functionality provided by the fundata and funscore functions in the funnelR package.

Usage

1
2
3
4
5
6
7
8
9
stem_funnel_plot(
  comorbid_column,
  outcome_column,
  cut_level = 2,
  use_outcome = FALSE,
  maximal = TRUE,
  max_x = NULL,
  dis_names = NULL
)

Arguments

comorbid_column

A vector of character strings made up of 0s and 1s, or of factors coercible to character, all should be identical lengths.

outcome_column

A numeric vector one if outcome occurred and zero if outcome did not occur. Should be the same length as comorbid_column with each element relating to the same record as the comorbid_column. If outcome_column is passed, then the stem will be generated based on combinations with the highest event rate.

cut_level

A number indicating the level at which stems should be cut (i.e. the number of diagnoses).

use_outcome

A logical indicating if stem derivation should be based on outcome rates or on frequency, defaults to FALSE.

maximal

A logical that true if the 'maximal' stem is to be considered for each record, or if it is to be limited to only records with the same number of diagnoses as cut_level, default of TRUE.

max_x

A number indicating the maximum frequency on the x axis, if left NULL then the maximum in the observed data will be used.

dis_names

A list of disease names associated with each position of the comorbid string. If null, then the simple string is returned.

Value

A list, first element is a ggplot object; a funnel plot with associated 95% and 99% control limits, second element is the underlying data.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
comorbid_column <- c('1110', '0010', '0010', '0110')

outcome_column <- c(1,0,0,1)

stem_funnel_plot(comorbid_column = comorbid_column,
outcome_column = outcome_column,
use_outcome = FALSE,
maximal = TRUE,
max_x = NULL,
dis_names = c('heart disease', 'hypertension', 'chronic kidney disease', 'cancer')
)

AJFOWLER/comorbidgroupr documentation built on May 11, 2021, 6:01 a.m.