Package 'drord'

Title: Doubly-Robust Estimators for Ordinal Outcomes
Description: Efficient covariate-adjusted estimators of quantities that are useful for establishing the effects of treatments on ordinal outcomes (Benkeser, Diaz, Luedtke 2020 <doi:10.1111/biom.13377>)
Authors: David Benkeser [aut, cre, cph]
Maintainer: David Benkeser <[email protected]>
License: MIT + file LICENSE
Version: 1.0.1.9000
Built: 2025-03-01 03:21:00 UTC
Source: https://github.com/benkeser/drord

Help Index


Compute a BCa confidence interval

Description

Compute a BCa confidence interval

Usage

bca_interval(pt_est, boot_samples, jack_samples, alpha = 0.05)

Arguments

pt_est

The point estimate of the parameter of interest

boot_samples

A collection of bootstrap realizations of the estimator of the parameter of interest

jack_samples

A vector of jackknife estimates of the parameter of interest.

alpha

Confidence intervals have nominal level 1-alpha.

Value

2-length vector containing BCa confidence interval limits.


Compute a BCa bootstrap confidence interval for the weighted mean. The code is based on the slides found here: http://users.stat.umn.edu/~helwig/notes/bootci-Notes.pdf

Description

Compute a BCa bootstrap confidence interval for the weighted mean. The code is based on the slides found here: http://users.stat.umn.edu/~helwig/notes/bootci-Notes.pdf

Usage

bca_logodds(
  treat,
  covar,
  out,
  nboot,
  treat_form,
  out_levels,
  out_form,
  out_model,
  logodds_est,
  alpha = 0.05
)

Arguments

treat

A numeric vector containing treatment status. Should only assume a value 0 or 1.

covar

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

out

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

nboot

Number of bootstrap replicates used to compute bootstrap confidence intervals.

treat_form

The right-hand side of a regression formula for the working model of treatment probability as a function of covariates

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).

logodds_est

The estimated log-odds.

alpha

Level of confidence interval.

Value

matrix with treatment-specific log-odds CIs and CI for difference.


Compute a BCa bootstrap confidence interval for the Mann-Whitney parameter. The code is based on the slides found here: http://users.stat.umn.edu/~helwig/notes/bootci-Notes.pdf

Description

Compute a BCa bootstrap confidence interval for the Mann-Whitney parameter. The code is based on the slides found here: http://users.stat.umn.edu/~helwig/notes/bootci-Notes.pdf

Usage

bca_mannwhitney(
  treat,
  covar,
  out,
  nboot,
  treat_form,
  out_levels,
  out_form,
  mannwhitney_est,
  out_model,
  alpha = 0.05
)

Arguments

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

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

nboot

Number of bootstrap replicates used to compute bootstrap confidence intervals.

treat_form

The right-hand side of a regression formula for the working model of treatment probability as a function of covariates

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.

mannwhitney_est

The point estimate of the Mann-Whitney parameter.

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).

alpha

Level of confidence interval.

Value

Confidence interval for the Mann-Whitney parameter


Compute a BCa bootstrap confidence interval for the weighted mean. The code is based on the slides found here: http://users.stat.umn.edu/~helwig/notes/bootci-Notes.pdf

Description

Compute a BCa bootstrap confidence interval for the weighted mean. The code is based on the slides found here: http://users.stat.umn.edu/~helwig/notes/bootci-Notes.pdf

Usage

bca_marg_dist(
  treat,
  covar,
  out,
  nboot,
  treat_form,
  out_levels,
  out_form,
  out_model,
  marg_cdf_est,
  marg_pmf_est,
  alpha = 0.05
)

Arguments

treat

A numeric vector containing treatment status. Should only assume a value 0 or 1.

covar

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

out

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

nboot

Number of bootstrap replicates used to compute bootstrap confidence intervals.

treat_form

The right-hand side of a regression formula for the working model of treatment probability as a function of covariates

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).

marg_cdf_est

Point estimate of treatment-specific CDF.

marg_pmf_est

Point estimate of treatment-specific PMF.

alpha

Level of confidence interval.

Value

List (cdf, pmf) of lists (treat=1, treat=0) of confidence intervals for distributions.


Compute a BCa bootstrap confidence interval for the weighted mean. The code is based on the slides found here: http://users.stat.umn.edu/~helwig/notes/bootci-Notes.pdf

Description

Compute a BCa bootstrap confidence interval for the weighted mean. The code is based on the slides found here: http://users.stat.umn.edu/~helwig/notes/bootci-Notes.pdf

Usage

bca_wmean(
  treat,
  covar,
  out,
  nboot,
  treat_form,
  out_levels,
  out_form,
  out_weights,
  out_model,
  wmean_est,
  alpha = 0.05
)

Arguments

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

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

nboot

Number of bootstrap replicates used to compute bootstrap confidence intervals.

treat_form

The right-hand side of a regression formula for the working model of treatment probability as a function of covariates

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_weights

A vector of numeric weights with length equal to the length of out_levels.

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).

wmean_est

The estimated weighted means + estimated covariance matrix.

alpha

Level of confidence interval.

Value

matrix with treatment-specific weighted mean CIs and CI for difference.


Used to compute treatment-specific BCa intervals for the CDF and PMF

Description

Used to compute treatment-specific BCa intervals for the CDF and PMF

Usage

compute_trt_spec_bca_intervals(
  dist = c("cdf", "pmf"),
  trt = c(1, 0),
  marg_est,
  boot_samples,
  jack_samples,
  alpha
)

Arguments

dist

Which one? CDF or PMF?

trt

Which treatment?

marg_est

The point estimate

boot_samples

A collection of bootstrap realizations of the estimator of the parameter of interest

jack_samples

A vector of jackknife estimates of the parameter of interest.

alpha

Confidence intervals have nominal level 1-alpha.

Value

List of pointwise and simultaneous confidence intervals for dist.


Compute simultaneous confidence interval for treatment-specific marginal distribution

Description

Compute simultaneous confidence interval for treatment-specific marginal distribution

Usage

compute_trt_spec_marg_dist_ptwise_ci(pt_est, cov_est, alpha, cdf = TRUE)

Arguments

pt_est

The point estimate of the treatment-specific marginal CDF/PMF

cov_est

Covariance matrix estimates.

alpha

Confidence intervals have nominal level 1-alpha.

cdf

Is this for CDF or PMF?

Value

Confidence interval


Compute simultaneous confidence interval for treatment-specific marginal distribution

Description

Compute simultaneous confidence interval for treatment-specific marginal distribution

Usage

compute_trt_spec_marg_dist_simul_ci(
  pt_est,
  trt_spec_marg_dist_eif,
  remove_last = TRUE,
  alpha
)

Arguments

pt_est

The point estimate of the treatment-specific marginal CDF/PMF

trt_spec_marg_dist_eif

The EIF estimates for the treatment-specific marginal CDF/PMF estimates

remove_last

Should the last level be removed? Should be set equal to TRUE for CDF computations and FALSE for PMF computations.

alpha

Confidence intervals have nominal level 1-alpha.

Value

Confidence interval


Simulated COVID-19 outcomes for hospitalized patients.

Description

A simulated dataset containing outcomes, (hypothetical) treatment, and age group

Usage

covid19

Format

A data frame with 500 rows and 3 variables:

out

study outcome, here 1 represents death, 2 intubation, 3 no adverse outcome

age_grp

age category with 1 the youngest and 7 the oldest

treat

hypothetical treatment, here 1 represents an (effective) active treatment and 0 a control


Doubly robust estimates of for evaluating effects of treatments on ordinal outcomes.

Description

The available parameters for evaluating treatment efficacy are:

  • Difference in (weighted) means: The outcome levels are treated numerically, with each level possibly assigned a weight. The difference in average outcomes is computed.

  • Log odds ratio: The comparison describes the average log-odds (treatment level 1 versus 0) of the cumulative probability for each level of the outcome.

  • Mann-Whitney: The probability that a randomly-selected individual receiving treatment 1 will have a larger outcome value than a randomly selected individual receiving treatment 0 (with ties assigned weight 1/2).

Usage

drord(
  out,
  treat,
  covar,
  out_levels = sort(unique(out)),
  out_form = paste0(colnames(covar), collapse = "+"),
  out_weights = rep(1, length(out_levels)),
  out_model = "pooled-logistic",
  treat_form = "1",
  param = c("weighted_mean", "log_odds", "mann_whitney"),
  ci = "wald",
  alpha = 0.05,
  nboot = 1000,
  return_models = TRUE,
  est_dist = TRUE,
  stratify = FALSE,
  ...
)

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_weights

A vector of numeric weights with length equal to the length of out_levels.

out_model

Which R function should be used to fit the proportional odds model. The recommended option is "pooled-logistic". Other options available include "polr" (from the MASS package), "vglm" (from the VGAM package), or "clm" (from the ordinal package).

treat_form

The right-hand side of a regression formula for the working model of treatment probability as a function of covariates

param

A vector of characters indicating which of the three treatment effect parameters should be estimated ("weighted_mean", "log_odds", and/or "mann_whitney").

ci

A vector of characters indicating which confidence intervals should be computed ("bca" and/or "wald")

alpha

Confidence intervals have nominal level 1-alpha.

nboot

Number of bootstrap replicates used to compute bootstrap confidence intervals.

return_models

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

est_dist

A boolean indicating whether estimates of the CDF and PMF should be computed and returned. For real data analysis, we generally recommend leaving as TRUE; however, when studying performance in simulations, it can save time to set to FALSE.

stratify

If TRUE, then a fully stratified estimator is computed, i.e., the empirical CDF of each treatment arm is estimated stratifying by levels of covar. For now, this option is limited to univariate covariates.

...

Other options (not currently used).

Details

In each case, estimates are constructed by obtaining a doubly robust estimate of the cumulative distribution function (CDF) for each treatment group. This is achieved by fitting a (working) proportional odds model that includes inverse probability of treatment weights. The inclusion of these weights ensures that, so long as the working model includes intercept terms, the resultant estimate of the CDF is an augmented inverse probability of treatment weighted estimate. This implies that the estimate is nonparametric efficient if the working model contains the truth; however, even if the working model does not contain the truth, the CDF estimates are consistent and asymptotically normal with variance expected to dominate that of an unadjusted estimate of the same treatment effect.

The CDF estimates are subsequently mapped into estimates of each requested parameter for evaluating treatment effects. The double robustness and efficiency properties of the CDF estimates extend to these quantities as well. Confidence intervals and hypothesis tests can be carried out in closed form using Wald-style intervals and tests or using a nonparametric corrected and accelerated bootstrap (BCa). Inference for the CDF and probability mass function is also returned and can be used for subsequent visualizations (see plot.drord).

Value

An object of class drord. In addition to information related to how drord was called, the output contains the following:

log_odds

inference pertaining to the log-odds parameter. NULL if this parameter not requested in call to drord.

mann_whitney

inference pertaining to the Mann-Whitney parameter. NULL if this parameter not requested in call to drord.

weighted_mean

inference pertaining to weighted mean parameter. NULL if this parameter not requested in call to drord.

cdf

inference pertaining to the treatment-specific CDFs. See the plot method for a convenient way of visualizing this information. NULL if est_dist = FALSE in call to drord.

pmf

inference pertaining to the treatment-specific PMFs. See the plot method for a convenient way of visualizing this information. NULL if est_dist = FALSE in call to drord.

treat_mod

the fitted model for the probability of treatment as a function of covariates. NULL if return_models = FALSE

out_mod

the proportional odds model fit in each treatment arm. named entries in list indicate the corresponding treatment arm. NULL if return_models = FALSE or stratify = TRUE.

Examples

data(covid19)

# get estimates of all parameters based on main-effects 
# proportional odds model and intercept-only propensity model
fit <- drord(out = covid19$out, treat = covid19$treat, 
             covar = covid19[, "age_grp", drop = FALSE])

# get estimates of all parameters based on proportional odds and
# propensity model that treats age_grp as categorical
fit2 <- drord(out = covid19$out, treat = covid19$treat, 
              covar = covid19[, "age_grp", drop = FALSE],
				 out_form = "factor(age_grp)",
				 treat_form = "factor(age_grp)")

# obtain estimator stratified by age group 
fit3 <- drord(out = covid19$out, treat = covid19$treat, 
              covar = covid19[, "age_grp", drop = FALSE],
				 stratify = TRUE)

# demonstration with missing outcome data
covid19$out[1:5] <- NA

# propensity model should now adjust for covariates to address
# the potential for informative missingness
fit4 <- drord(out = covid19$out, treat = covid19$treat, 
              covar = covid19[, "age_grp", drop = FALSE],
				 treat_form = "age_grp")

Get EIF estimates for treatment-specific PMF at a particular level of the outcome

Description

Get EIF estimates for treatment-specific PMF at a particular level of the outcome

Usage

eif_pmf_k(k, out, treat, trt_level, trt_spec_prob_est, trt_k_spec_pmf_est)

Arguments

k

The level of the outcome.

out

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

treat

A numeric vector containing treatment status. Should only assume a value 0 or 1.

trt_level

Treatment level

trt_spec_prob_est

Estimated propensity for trt_level.

trt_k_spec_pmf_est

Estimated conditional PMF for trt_level at k.


Get EIF estimates for treatment-specific CDF at a particular level of the outcome

Description

Get EIF estimates for treatment-specific CDF at a particular level of the outcome

Usage

eif_theta_k(k, out, treat, trt_level, trt_spec_prob_est, trt_k_spec_cdf_est)

Arguments

k

The level of the outcome.

out

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

treat

A numeric vector containing treatment status. Should only assume a value 0 or 1.

trt_level

Treatment level

trt_spec_prob_est

Estimated propensity for trt_level.

trt_k_spec_cdf_est

Estimated conditional CDF for trt_level at k.


Map an estimate of the conditional PMF into an estimate of the conditional CDF

Description

Map an estimate of the conditional PMF into an estimate of the conditional CDF

Usage

estimate_cdf(pmf_est)

Arguments

pmf_est

A list of the treatment-specific PMF estimates

Value

A list of treatment-specific CDF estimates


Compute confidence interval/s for the log-odds parameters

Description

Compute confidence interval/s for the log-odds parameters

Usage

estimate_ci_logodds(
  logodds_est,
  cdf_est,
  out_form,
  covar,
  treat_prob_est,
  treat,
  treat_form,
  out,
  ci,
  alpha = 0.05,
  nboot,
  out_levels,
  out_model,
  ...
)

Arguments

logodds_est

The point estimates for log-odds.

cdf_est

A list of treatment-specific CDF estimates.

out_form

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

covar

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

treat_prob_est

Estimated probability of treatments, output from call to estimate_treat_prob.

treat

A numeric vector containing treatment status. Should only assume a value 0 or 1.

treat_form

The right-hand side of a regression formula for the working model of treatment probability as a function of covariates

out

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

ci

A vector of characters indicating which confidence intervals should be computed ("bca" and/or "wald")

alpha

Confidence intervals have nominal level 1-alpha.

nboot

Number of bootstrap replicates used to compute bootstrap confidence intervals.

out_levels

A numeric vector containing all ordered levels of the outcome.

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).

...

Other options (not currently used).

Value

List with wald and bca-estimated confidence intervals for the weighted mean parameters.


Compute confidence interval/s for the Mann-Whitney parameter

Description

Compute confidence interval/s for the Mann-Whitney parameter

Usage

estimate_ci_mannwhitney(
  mannwhitney_est,
  cdf_est,
  pmf_est,
  treat_prob_est,
  treat_form,
  out_form,
  treat,
  ci,
  out,
  alpha,
  nboot,
  out_levels,
  covar,
  out_model
)

Arguments

mannwhitney_est

The point estimates for log-odds.

cdf_est

The estimated conditional CDF.

pmf_est

The estimated conditional PMF.

treat_prob_est

Estimated probability of treatments, output from call to estimate_treat_prob.

treat_form

The right-hand side of a regression formula for the working model of treatment probability as a function of covariates

out_form

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

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.

ci

A vector of characters indicating which confidence intervals should be computed ("bca" and/or "wald")

out

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

alpha

Confidence intervals have nominal level 1-alpha.

nboot

Number of bootstrap replicates used to compute bootstrap confidence intervals.

out_levels

A numeric vector containing all ordered levels of the outcome.

covar

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

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).

Value

List with wald and bca-estimated confidence intervals for the Mann-Whitney parameter.


Compute confidence interval/s for the treatment specific PMF and CDF.

Description

Compute confidence interval/s for the treatment specific PMF and CDF.

Usage

estimate_ci_marg_dist(
  marg_cdf_est,
  marg_pmf_est,
  cdf_est,
  pmf_est,
  covar,
  treat_prob_est,
  treat_form,
  out_form,
  treat,
  ci,
  out_levels,
  out_model,
  out,
  alpha,
  nboot
)

Arguments

marg_cdf_est

Point estimate of treatment-specific CDF.

marg_pmf_est

Point estimate of treatment-specific PMF.

cdf_est

Estimates of treatment-specific conditional CDF.

pmf_est

Estimates of treatment-specific conditional PMF.

covar

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

treat_prob_est

Estimated probability of treatments, output from call to estimate_treat_prob.

treat_form

The right-hand side of a regression formula for the working model of treatment probability as a function of covariates

out_form

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

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.

ci

A vector of characters indicating which confidence intervals should be computed ("bca" and/or "wald")

out_levels

A numeric vector containing all ordered levels of the outcome.

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).

out

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

alpha

Confidence intervals have nominal level 1-alpha.

nboot

Number of bootstrap replicates used to compute bootstrap confidence intervals.

Value

List of lists (cdf and pmf) with wald and bca-estimated confidence intervals for the marginal treatment-specific distribution functions.


Compute confidence interval/s for the weight mean parameters

Description

Compute confidence interval/s for the weight mean parameters

Usage

estimate_ci_wmean(
  out,
  treat,
  covar,
  wmean_est,
  alpha = 0.05,
  out_levels = order(unique(out)),
  out_form = NULL,
  out_weights = rep(1, length(out_levels)),
  out_model,
  treat_form = "1",
  ci = c("bca", "wald"),
  nboot = 10000
)

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.

wmean_est

The point estimates for weighted means

alpha

Confidence intervals have nominal level 1-alpha.

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_weights

A vector of numeric weights with length equal to the length of out_levels.

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_form

The right-hand side of a regression formula for the working model of treatment probability as a function of covariates

ci

A vector of characters indicating which confidence intervals should be computed ("bca" and/or "wald")

nboot

Number of bootstrap replicates used to compute bootstrap confidence intervals.

Value

List with wald and bca-estimated confidence intervals for the weighted mean parameters.


Map an estimate of treatment-specific PMF into an estimate of treatment specific conditional mean for each observation.

Description

Map an estimate of treatment-specific PMF into an estimate of treatment specific conditional mean for each observation.

Usage

estimate_cond_mean(trt_spec_pmf_est, ordered_out_levels, ordered_out_weights)

Arguments

trt_spec_pmf_est

The treatment-specific PMF estimates

ordered_out_levels

Self explanatory

ordered_out_weights

Self explanatory

Value

Vector of estimated conditional means


Obtain an estimate of the efficient influence function for the treatment-specific weighted mean parameter

Description

Obtain an estimate of the efficient influence function for the treatment-specific weighted mean parameter

Usage

estimate_eif_wmean(
  trt_spec_cond_mean_est,
  trt_spec_prob_est,
  trt_level,
  out,
  treat
)

Arguments

trt_spec_cond_mean_est

Conditional mean for trt_level

trt_spec_prob_est

Propensity for trt_level

trt_level

Treatment level

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.


implements a plug-in estimator of equation (2) in Diaz et al

Description

implements a plug-in estimator of equation (2) in Diaz et al

Usage

estimate_logodds(cdf_est)

Arguments

cdf_est

A list of treatment-specific CDF estimates

Value

Log odds of treatment = 1, = 0, and the difference.


Compute the estimate of Mann-Whitney based on conditional CDF and PMF

Description

Compute the estimate of Mann-Whitney based on conditional CDF and PMF

Usage

estimate_mannwhitney(cdf_est, pmf_est)

Arguments

cdf_est

Conditional CDF estimates

pmf_est

Conditional PMF estimates

Value

Mann-Whitney point estimate


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.

Description

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.

Usage

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.


Estimate probability of receiving each level of treatment

Description

Estimate probability of receiving each level of treatment

Usage

estimate_treat_prob(treat, covar, treat_form, return_models)

Arguments

treat

A numeric vector containing treatment status. 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.

covar

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

treat_form

The right-hand side of a regression formula for the working model of treatment probability as a function of covariates

return_models

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

Value

A list where the first element is estimate of Pr(treat = 1 | covar) for covar equal to inputted values of covar and second element is estimate of Pr(treat = 0 | covar) for covar equal to inputted values of covar


Compute the estimate of the weighted mean parameter based on estimated PMF in each treatment arm.

Description

Compute the estimate of the weighted mean parameter based on estimated PMF in each treatment arm.

Usage

estimate_wmean(
  pmf_est,
  treat,
  out,
  out_levels,
  out_weights,
  treat_prob_est,
  return_cov = TRUE
)

Arguments

pmf_est

List of treatment-specific PMF estimates.

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.

out

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

out_levels

A numeric vector containing all ordered levels of the outcome.

out_weights

A vector of numeric weights with length equal to the length of out_levels.

treat_prob_est

Estimated probability of treatments, output from call to estimate_treat_prob.

return_cov

If TRUE the estimated covariance matrix is returned.

Value

List with estimates of treatment-specific means and difference in means. If return_cov = TRUE, also includes covariance matrix estimates.


Get the covariance matrix for beta

Description

Get the covariance matrix for beta

Usage

evaluate_beta_cov(cdf_est, theta_cov)

Arguments

cdf_est

Estimated CDFs

theta_cov

Covariance matrix for CDF estimates

Value

Estimated covariance matrix for log-odds ratio parameters


Compute the estimated gradient of the Mann-Whitney parameter. Needed to derive standard error for Wald confidence intervals.

Description

Compute the estimated gradient of the Mann-Whitney parameter. Needed to derive standard error for Wald confidence intervals.

Usage

evaluate_mannwhitney_gradient(cdf_est, pmf_est)

Arguments

cdf_est

Conditional CDF estimates

pmf_est

Conditional PMF estimates

Value

3-length vector for delta method calculus


Get eif estimates for treatment-specific CDF

Description

Get eif estimates for treatment-specific CDF

Usage

evaluate_marg_cdf_eif(cdf_est, treat_prob_est, treat, out, out_levels)

Arguments

cdf_est

Estimated conditional CDF for trt_level.

treat_prob_est

Estimated propensity for trt_level.

treat

A numeric vector containing treatment status. Should only assume a value 0 or 1.

out

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

out_levels

A numeric vector containing all ordered levels of the outcome.

Value

a list of eif estimates


Evaluate pointwise confidence interval for marginal CDF.

Description

Evaluate pointwise confidence interval for marginal CDF.

Usage

evaluate_marg_cdf_ptwise_ci(marg_cdf_est, marg_cdf_eif, alpha)

Arguments

marg_cdf_est

The point estimate of the marginal CDF distribution

marg_cdf_eif

The EIF estimates for the marginal CDF estimates

alpha

Confidence intervals have nominal level 1-alpha.

Value

List by treatment of simultaneous confidence intervals


Evaluate simultaneous confidence interval for marginal PMF or CDF.

Description

Evaluate simultaneous confidence interval for marginal PMF or CDF.

Usage

evaluate_marg_dist_simul_ci(
  marg_dist_est,
  marg_dist_eif,
  alpha,
  remove_last = FALSE
)

Arguments

marg_dist_est

The point estimate of the marginal CDF/PMF distribution

marg_dist_eif

The EIF estimates for the marginal CDF/PMF estimates

alpha

Confidence intervals have nominal level 1-alpha.

remove_last

Should the last level be removed? Should be set equal to TRUE for CDF computations and FALSE for PMF computations.

Value

List by treatment of simultaneous confidence intervals


Get eif estimates for treatment-specific PMF

Description

Get eif estimates for treatment-specific PMF

Usage

evaluate_marg_pmf_eif(pmf_est, treat_prob_est, treat, out, out_levels)

Arguments

pmf_est

Estimated conditional PMF for trt_level.

treat_prob_est

Estimated propensity for trt_level.

treat

A numeric vector containing treatment status. Should only assume a value 0 or 1.

out

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

out_levels

A numeric vector containing all ordered levels of the outcome.

Value

a list of eif estimates


Evaluate pointwise confidence interval for marginal PMF.

Description

Evaluate pointwise confidence interval for marginal PMF.

Usage

evaluate_marg_pmf_ptwise_ci(marg_pmf_est, marg_pmf_eif, alpha)

Arguments

marg_pmf_est

The point estimate of the marginal PMF distribution

marg_pmf_eif

The EIF estimates for the marginal PMF estimates

alpha

Confidence intervals have nominal level 1-alpha.

Value

List by treatment of simultaneous confidence intervals


get a covariance matrix for the estimated CDF

Description

get a covariance matrix for the estimated CDF

Usage

evaluate_theta_cov(cdf_est, treat_prob_est, treat, out, out_levels)

Arguments

cdf_est

The estimates of the treatment-specific CDFs

treat_prob_est

List of estimated probability of treatments, output from call to estimate_treat_prob.

treat

A numeric vector containing treatment status. Should only assume a value 0 or 1.

out

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

out_levels

A numeric vector containing all ordered levels of the outcome.

Value

Estimated covariance matrix for CDF estimates


Get a matrix of eif estimates for treatment-specific PMF

Description

Get a matrix of eif estimates for treatment-specific PMF

Usage

evaluate_trt_spec_pmf_eif(
  trt_spec_pmf_est,
  trt_spec_prob_est,
  trt_level,
  treat,
  out,
  out_levels
)

Arguments

trt_spec_pmf_est

Estimated conditional PMF for trt_level.

trt_spec_prob_est

Estimated propensity for trt_level.

trt_level

Treatment level

treat

A numeric vector containing treatment status. Should only assume a value 0 or 1.

out

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

out_levels

A numeric vector containing all ordered levels of the outcome.

Value

a matrix of EIF estimates


get a matrix of eif estimates for the treatment-specific CDF estimates

Description

get a matrix of eif estimates for the treatment-specific CDF estimates

Usage

evaluate_trt_spec_theta_eif(
  trt_spec_cdf_est,
  trt_spec_prob_est,
  trt_level,
  treat,
  out,
  out_levels
)

Arguments

trt_spec_cdf_est

Estimated conditional CDF for trt_level.

trt_spec_prob_est

Estimated propensity for trt_level.

trt_level

Treatment level

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.

out

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

out_levels

A numeric vector containing all ordered levels of the outcome.

Value

matrix of EIF estimates for CDF.


Helper function to fit a treatment specific outcome regression. If there are more than 2 observed levels of the outcome for the specified treatment arm, then polr is used from the MASS package. Otherwise logistic regression is used. In both cases, inverse probability of treatment weights are included in the regression. If there are levels of the outcome that are not observed in this treatment group, then 0's are added in. The function returns a matrix with named columns corresponding to each outcome (ordered numerically). The entries represent the estimated covariate-conditional treatment-specific PMF.

Description

Helper function to fit a treatment specific outcome regression. If there are more than 2 observed levels of the outcome for the specified treatment arm, then polr is used from the MASS package. Otherwise logistic regression is used. In both cases, inverse probability of treatment weights are included in the regression. If there are levels of the outcome that are not observed in this treatment group, then 0's are added in. The function returns a matrix with named columns corresponding to each outcome (ordered numerically). The entries represent the estimated covariate-conditional treatment-specific PMF.

Usage

fit_trt_spec_reg(
  trt_level,
  trt_spec_prob_est,
  out,
  treat,
  covar,
  out_levels,
  out_form = NULL,
  out_model,
  stratify,
  ...
)

Arguments

trt_level

Which level of treatment to fit the proportional odds model for

trt_spec_prob_est

A vector of estimates of Pr(treat = trt_level | covar).

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).

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.

...

Other options (not used).


Compute one log odds based on a given data set.

Description

Compute one log odds based on a given data set.

Usage

get_one_logodds(treat, covar, treat_form, out_model, out, out_levels, out_form)

Arguments

treat

A numeric vector containing treatment status. Should only assume a value 0 or 1.

covar

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

treat_form

The right-hand side of a regression formula for the working model of treatment probability as a function of covariates

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).

out

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

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.

Value

Estimated log odds for these input data.


Compute one estimate of Mann-Whitney parameter based on a given data set.

Description

Compute one estimate of Mann-Whitney parameter based on a given data set.

Usage

get_one_mannwhitney(
  treat,
  covar,
  treat_form,
  out,
  out_levels,
  out_form,
  out_model
)

Arguments

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.

treat_form

The right-hand side of a regression formula for the working model of treatment probability as a function of covariates

out

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

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).

Value

Estimate of Mann-Whitney parameter for these input data.


Compute one estimate of the marginal CDF/PMF on a given data set.

Description

Compute one estimate of the marginal CDF/PMF on a given data set.

Usage

get_one_marg_dist(
  treat,
  covar,
  treat_form,
  out_model,
  out,
  out_levels,
  out_form
)

Arguments

treat

A numeric vector containing treatment status. Should only assume a value 0 or 1.

covar

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

treat_form

The right-hand side of a regression formula for the working model of treatment probability as a function of covariates

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).

out

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

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.

Value

List of estimated cdf/pmf for these input data.


Compute one weighted mean based on a given data set.

Description

Compute one weighted mean based on a given data set.

Usage

get_one_wmean(
  treat,
  covar,
  treat_form,
  out,
  out_levels,
  out_form,
  out_model,
  out_weights
)

Arguments

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.

treat_form

The right-hand side of a regression formula for the working model of treatment probability as a function of covariates

out

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

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).

out_weights

A vector of numeric weights with length equal to the length of out_levels.


Get a response from model formula

Description

Get a response from model formula

Usage

getResponseFromFormula(formula, data)

Arguments

formula

The model formula

data

The data frame associated with the model


Compute jackknife log-odds estimates.

Description

Compute jackknife log-odds estimates.

Usage

jack_logodds(treat, covar, out, treat_form, out_model, out_levels, out_form)

Arguments

treat

A numeric vector containing treatment status. Should only assume a value 0 or 1.

covar

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

out

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

treat_form

The right-hand side of a regression formula for the working model of treatment probability as a function of covariates

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).

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.

Value

Jackknife estimated log-odds


Compute Mann-Whitney log-odds estimates.

Description

Compute Mann-Whitney log-odds estimates.

Usage

jack_mannwhitney(
  treat,
  covar,
  out,
  treat_form,
  out_levels,
  out_form,
  out_model
)

Arguments

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

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

treat_form

The right-hand side of a regression formula for the working model of treatment probability as a function of covariates

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).

Value

Jackknife estimate of Mann-Whitney parameter


Compute jackknife distribution estimates.

Description

Compute jackknife distribution estimates.

Usage

jack_marg_cdf(treat, covar, out, treat_form, out_levels, out_form, out_model)

Arguments

treat

A numeric vector containing treatment status. Should only assume a value 0 or 1.

covar

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

out

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

treat_form

The right-hand side of a regression formula for the working model of treatment probability as a function of covariates

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).

Value

Jackknife estimated distributions


Compute jackknife weighted mean estimates.

Description

Compute jackknife weighted mean estimates.

Usage

jack_wmean(
  treat,
  covar,
  out,
  treat_form,
  out_levels,
  out_form,
  out_weights,
  out_model
)

Arguments

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

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

treat_form

The right-hand side of a regression formula for the working model of treatment probability as a function of covariates

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_weights

A vector of numeric weights with length equal to the length of out_levels.

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).

Value

Jackknife-estimated weighted mean


Marginalize over empirical distribution to obtain marginal treatment-specific CDF estimate.

Description

Marginalize over empirical distribution to obtain marginal treatment-specific CDF estimate.

Usage

marginalize_cdf(cdf_est)

Arguments

cdf_est

Estimates of treatment-specific conditional CDF.


Marginalize over empirical distribution to obtain marginal treatment-specific PMF estimate.

Description

Marginalize over empirical distribution to obtain marginal treatment-specific PMF estimate.

Usage

marginalize_pmf(pmf_est)

Arguments

pmf_est

Estimates of treatment-specific conditional PMF.


Get one bootstrap computation of the log odds parameters.

Description

Get one bootstrap computation of the log odds parameters.

Usage

one_boot_logodds(
  treat,
  covar,
  out,
  treat_form,
  out_levels,
  out_form,
  out_model
)

Arguments

treat

A numeric vector containing treatment status. Should only assume a value 0 or 1.

covar

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

out

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

treat_form

The right-hand side of a regression formula for the working model of treatment probability as a function of covariates

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).

Value

Estimates of log odds for a particular bootstrap sample.


Get one bootstrap computation of the Mann-Whitney parameter.

Description

Get one bootstrap computation of the Mann-Whitney parameter.

Usage

one_boot_mannwhitney(
  treat,
  covar,
  out,
  treat_form,
  out_levels,
  out_form,
  out_model
)

Arguments

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

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

treat_form

The right-hand side of a regression formula for the working model of treatment probability as a function of covariates

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).

Value

Estimates of Mann-Whitney parameter for a particular bootstrap sample.


Get one bootstrap computation of the CDF and PMF estimates

Description

Get one bootstrap computation of the CDF and PMF estimates

Usage

one_boot_marg_dist(
  treat,
  covar,
  out,
  treat_form,
  out_levels,
  out_form,
  out_model
)

Arguments

treat

A numeric vector containing treatment status. Should only assume a value 0 or 1.

covar

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

out

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

treat_form

The right-hand side of a regression formula for the working model of treatment probability as a function of covariates

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).

Value

Estimates of CDF and PMF for a particular bootstrap sample.


Get one bootstrap computation of the weighted mean parameters.

Description

Get one bootstrap computation of the weighted mean parameters.

Usage

one_boot_wmean(
  treat,
  covar,
  out,
  treat_form,
  out_levels,
  out_form,
  out_weights,
  out_model
)

Arguments

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

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

treat_form

The right-hand side of a regression formula for the working model of treatment probability as a function of covariates

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_weights

A vector of numeric weights with length equal to the length of out_levels.

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).

Value

Estimates of weighted mean for a particular bootstrap sample.


Print the output of a "drord" object.

Description

Print the output of a "drord" object.

Usage

## S3 method for class 'drord'
plot(
  x,
  treat_labels = c(1, 0),
  dist = "pmf",
  out_labels = if (dist == "pmf") {     x$out_levels } else {    
    x$out_levels[-length(x$out_levels)] },
  ...
)

Arguments

x

A "drord" object.

treat_labels

Labels for the treatment variables (treat = 1 followed by treat = 0).

dist

Which distribution to plot. Valid options are "cdf" or "pmf".

out_labels

Labels for the ordered outcome levels. If dist = "cdf", the highest level of outcome will be dropped.

...

Other arguments (not used)

Value

A list with named entries plot (a ggplot2 object) and plot_data, the data.frame from which the plot is made. The latter is included for additional modifications to the plot that are desired.


Fits a proportional odds model via pooled logistic regression.

Description

The outcome in data (indicated in the form object) should be an ordered factor.

Usage

POplugin(form, data, weights = 1)

Arguments

form

The model formula

data

The data set used to fit the model

weights

Either equal to 1 (no weights) or a vector of length equal to nrow(data)

Value

A list with the fitted glm, the original data, levels of the outcome, and the outcome name


Predict method for a POplugin object

Description

Predict method for a POplugin object

Usage

## S3 method for class 'POplugin'
predict(object, newdata = NULL)

Arguments

object

An object of class POplugin

newdata

A data.frame on which to predict

Value

A data frame with nrow = number of rows in newdata (or the orignal data frame) and with the number of columns equal to the number of levels of the outcome observed in the original data frame


Print the output of a "drord" object.

Description

Print the output of a "drord" object.

Usage

## S3 method for class 'drord'
print(x, ci = "bca", ...)

Arguments

x

A "drord" object

ci

Which confidence interval should be printed. Defaults to BCa, but it BCa was not computed in call to drord, defaults back to Wald.

...

Other arguments (not used)


Trimmed logistic function

Description

Trimmed logistic function

Usage

trimmed_logit(x)

Arguments

x

A numeric between 0 and 1


Compute a Wald confidence interval for the weighted mean

Description

Compute a Wald confidence interval for the weighted mean

Usage

wald_ci_wmean(wmean_est, alpha)

Arguments

wmean_est

The estimated weighted means + estimated covariance matrix.

alpha

Level of confidence interval.

Value

matrix with treatment-specific weighted mean CIs and CI for difference.