PlotDIMoutcomes: Plot diff-in-means estimates

View source: R/plot_itt.R

PlotDIMoutcomesR Documentation

Plot diff-in-means estimates

Description

See Figure 2 for example.

Usage

PlotDIMoutcomes(
  res.fta,
  res.nca,
  res.nvca,
  label.position = c("top", "top", "top"),
  top.margin = 0.01,
  bottom.margin = 0.01,
  y.max = 0.2,
  label.size = 7,
  name.group = c("Overall", "Female", "Male", "Non-white\nMale", "White\nMale")
)

Arguments

res.fta

A data.frame generated with CalDIMsubgroup with Y = FTA.

res.nca

A data.frame generated with CalDIMsubgroup with Y = NCA.

res.nvca

A data.frame generated with CalDIMsubgroup with Y = NVCA.

label.position

The position of labels.

top.margin

Top margin of labels.

bottom.margin

Bottom margin of labels.

y.max

Maximum value of y-axis.

label.size

Size of label.

name.group

A character vector including the labels of five subgroups.

Value

A ggplot.

Examples

data(synth)
subgroup_synth <- list(
  1:nrow(synth), which(synth$Sex == 0), which(synth$Sex == 1),
  which(synth$Sex == 1 & synth$White == 0), which(synth$Sex == 1 & synth$White == 1)
)
synth_fta <- synth_nca <- synth_nvca <- synth
set.seed(123)
synth_fta$Y <- sample(0:1, 1000, replace = TRUE)
synth_nca$Y <- sample(0:1, 1000, replace = TRUE)
synth_nvca$Y <- sample(0:1, 1000, replace = TRUE)
res_fta <- CalDIMsubgroup(synth_fta, subgroup = subgroup_synth)
res_nca <- CalDIMsubgroup(synth_nca, subgroup = subgroup_synth)
res_nvca <- CalDIMsubgroup(synth_nvca, subgroup = subgroup_synth)
PlotDIMoutcomes(res_fta, res_nca, res_nvca)


aihuman documentation built on April 12, 2025, 1:47 a.m.