Get a treatment-specific estimate of the conditional PMF. Essentially this is a wrapper function for fit_trt_spec_reg, which fits the proportion odds model in a given treatment arm.

estimate_pmf(
  out,
  treat,
  covar,
  out_levels,
  out_form = NULL,
  out_model,
  treat_prob_est,
  stratify = FALSE,
  return_models = TRUE,
  ...
)

Arguments

out

A numeric vector containing the outcomes. Missing outcomes are allowed.

treat

A numeric vector containing treatment status. Missing values are not allowed unless the corresponding entry in out is also missing. Only values of 0 or 1 are treated as actual treatment levels. Any other value is assumed to encode a value for which the outcome is missing and the corresponding outcome value is ignored.

covar

A data.frame containing the covariates to include in the working proportional odds model.

out_levels

A numeric vector containing all ordered levels of the outcome.

out_form

The right-hand side of a regression formula for the working proportional odds model. NOTE: THIS FORMULA MUST NOT SUPPRESS THE INTERCEPT.

out_model

Which R function should be used to fit the proportional odds model. Options are "polr" (from the MASS package), "vglm" (from the VGAM package), or "clm" (from the ordinal package).

treat_prob_est

Estimated probability of treatments, output from call to estimate_treat_prob.

stratify

Boolean indicating whether to use nonparametric maximum likelihood (i.e., a stratified estimator). If out_form = "1", then a covariate-unadjusted estimate is computed.

return_models

If TRUE the fitted working proportional odds models and treatment probability models are returned.

...

Other options (not used).

Value

A list with fm the fitted model for treatment 1 and 0 (or, if !return_models then NULL) and pmf the estimated PMF under treatment 1 and 0 evaluated on each observation.