Generate long format hazards data for conditional density estimation

format_long_hazards(
  A,
  W,
  wts = rep(1, length(A)),
  type = c("equal_range", "equal_mass"),
  n_bins = NULL,
  breaks = NULL
)

Arguments

A

The numeric vector or similar of the observed values of an intervention for a group of observational units of interest.

W

A data.frame, matrix, or similar giving the values of baseline covariates (potential confounders) for the observed units whose observed intervention values are provided in the previous argument.

wts

A numeric vector of observation-level weights. The default is to weight all observations equally.

type

A character indicating the strategy to be used in creating bins along the observed support of the intervention A. For bins of equal range, use "equal_range" and consider consulting the documentation of ggplot2::cut_interval for more information. To ensure each bins has the same number of points, use "equal_mass" and consult the documentation of ggplot2::cut_number for details.

n_bins

Only used if type is set to "equal_range" or "equal_mass". This numeric value indicates the number of bins that the support of the intervention A is to be divided into.

breaks

A numeric vector of break points to be used in dividing up the support of A. This is passed as a ... argument to base::cut.default by either cut_interval or cut_number.