bar_plot: Get a bar plot for flagging percentage overall and stratified...

View source: R/bar_plot.R

bar_plotR Documentation

Get a bar plot for flagging percentage overall and stratified by provider sizes

Description

Generate a bar plot for flagging percentage.

Usage

bar_plot(
  flag_df,
  group_num = 4,
  bar_colors = c("#66c2a5", "#fc8d62", "#8da0cb"),
  bar_width = 0.7,
  label_color = "black",
  label_size = 4
)

Arguments

flag_df

a data frame from test function containing the flag of each provider.

group_num

number of groups into which providers are divided based on their sample sizes. The default is 4.

bar_colors

a vector of colors used to fill the bars representing the categories. The default is c("#66c2a5", "#fc8d62", "#8da0cb").

bar_width

width of the bars in the bar chart. The default is 0.7.

label_color

color of the text labels inside the bars. The default is "black".

label_size

size of the text labels inside the bars. The default is 4.

Details

This function generates a bar chart to visualize the percentage of flagging results based on provider sizes. The input data frame test_df must be the output from package pprof's test function. Providers are grouped into a specified number of groups (group_num) based on their sample sizes, where the number of providers are approximately equal across groups. An additional "overall" group is included to show the flagging results across all providers.

Value

A ggplot object representing the bar chart of flagging results.

See Also

test.linear_fe, test.linear_re, test.logis_fe

Examples

data(ExampleDataLinear)
outcome <- ExampleDataLinear$Y
covar <- ExampleDataLinear$Z
ID <- ExampleDataLinear$ID
fit_linear <- linear_fe(Y = outcome, Z = covar, ID = ID)
test_linear <- test(fit_linear)
bar_plot(test_linear)

data(ExampleDataBinary)
fit_logis <- logis_fe(Y = ExampleDataBinary$Y,
                      Z = ExampleDataBinary$Z,
                      ID = ExampleDataBinary$ID, message = FALSE)
test_logis <- test(fit_logis)
bar_plot(test_logis)


pprof documentation built on April 12, 2025, 1:33 a.m.