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 |
Compute a BCa confidence interval
bca_interval(pt_est, boot_samples, jack_samples, alpha = 0.05)
bca_interval(pt_est, boot_samples, jack_samples, alpha = 0.05)
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- |
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
bca_logodds( treat, covar, out, nboot, treat_form, out_levels, out_form, out_model, logodds_est, alpha = 0.05 )
bca_logodds( treat, covar, out, nboot, treat_form, out_levels, out_form, out_model, logodds_est, alpha = 0.05 )
treat |
A |
covar |
A |
out |
A |
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 |
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 |
logodds_est |
The estimated log-odds. |
alpha |
Level of confidence interval. |
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
bca_mannwhitney( treat, covar, out, nboot, treat_form, out_levels, out_form, mannwhitney_est, out_model, alpha = 0.05 )
bca_mannwhitney( treat, covar, out, nboot, treat_form, out_levels, out_form, mannwhitney_est, out_model, alpha = 0.05 )
treat |
A |
covar |
A |
out |
A |
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 |
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 |
alpha |
Level of confidence interval. |
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
bca_marg_dist( treat, covar, out, nboot, treat_form, out_levels, out_form, out_model, marg_cdf_est, marg_pmf_est, alpha = 0.05 )
bca_marg_dist( treat, covar, out, nboot, treat_form, out_levels, out_form, out_model, marg_cdf_est, marg_pmf_est, alpha = 0.05 )
treat |
A |
covar |
A |
out |
A |
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 |
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 |
marg_cdf_est |
Point estimate of treatment-specific CDF. |
marg_pmf_est |
Point estimate of treatment-specific PMF. |
alpha |
Level of confidence interval. |
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
bca_wmean( treat, covar, out, nboot, treat_form, out_levels, out_form, out_weights, out_model, wmean_est, alpha = 0.05 )
bca_wmean( treat, covar, out, nboot, treat_form, out_levels, out_form, out_weights, out_model, wmean_est, alpha = 0.05 )
treat |
A |
covar |
A |
out |
A |
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 |
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 |
out_model |
Which R function should be used to fit the proportional odds
model. Options are |
wmean_est |
The estimated weighted means + estimated covariance matrix. |
alpha |
Level of confidence interval. |
matrix with treatment-specific weighted mean CIs and CI for difference.
Used to compute treatment-specific BCa intervals for the CDF and PMF
compute_trt_spec_bca_intervals( dist = c("cdf", "pmf"), trt = c(1, 0), marg_est, boot_samples, jack_samples, alpha )
compute_trt_spec_bca_intervals( dist = c("cdf", "pmf"), trt = c(1, 0), marg_est, boot_samples, jack_samples, alpha )
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- |
List of pointwise and simultaneous confidence intervals for dist
.
Compute simultaneous confidence interval for treatment-specific marginal distribution
compute_trt_spec_marg_dist_ptwise_ci(pt_est, cov_est, alpha, cdf = TRUE)
compute_trt_spec_marg_dist_ptwise_ci(pt_est, cov_est, alpha, cdf = TRUE)
pt_est |
The point estimate of the treatment-specific marginal CDF/PMF |
cov_est |
Covariance matrix estimates. |
alpha |
Confidence intervals have nominal level 1- |
cdf |
Is this for CDF or PMF? |
Confidence interval
Compute simultaneous confidence interval for treatment-specific marginal distribution
compute_trt_spec_marg_dist_simul_ci( pt_est, trt_spec_marg_dist_eif, remove_last = TRUE, alpha )
compute_trt_spec_marg_dist_simul_ci( pt_est, trt_spec_marg_dist_eif, remove_last = TRUE, alpha )
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
|
alpha |
Confidence intervals have nominal level 1- |
Confidence interval
A simulated dataset containing outcomes, (hypothetical) treatment, and age group
covid19
covid19
A data frame with 500 rows and 3 variables:
study outcome, here 1 represents death, 2 intubation, 3 no adverse outcome
age category with 1 the youngest and 7 the oldest
hypothetical treatment, here 1 represents an (effective) active treatment and 0 a control
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).
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, ... )
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, ... )
out |
A |
treat |
A |
covar |
A |
out_levels |
A |
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 |
out_model |
Which R function should be used to fit the proportional odds
model. The recommended option is |
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 |
ci |
A vector of |
alpha |
Confidence intervals have nominal level 1- |
nboot |
Number of bootstrap replicates used to compute bootstrap confidence intervals. |
return_models |
If |
est_dist |
A |
stratify |
If |
... |
Other options (not currently used). |
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
).
An object of class drord
. In addition to information related to
how drord
was called, the output contains the following:
inference pertaining to the log-odds parameter. NULL
if
this parameter not requested in call to drord
.
inference pertaining to the Mann-Whitney parameter. NULL
if
this parameter not requested in call to drord
.
inference pertaining to weighted mean parameter. NULL
if
this parameter not requested in call to drord
.
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
.
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
.
the fitted model for the probability of treatment as a function
of covariates. NULL
if return_models = FALSE
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
.
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")
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
eif_pmf_k(k, out, treat, trt_level, trt_spec_prob_est, trt_k_spec_pmf_est)
eif_pmf_k(k, out, treat, trt_level, trt_spec_prob_est, trt_k_spec_pmf_est)
k |
The level of the outcome. |
out |
A |
treat |
A |
trt_level |
Treatment level |
trt_spec_prob_est |
Estimated propensity for |
trt_k_spec_pmf_est |
Estimated conditional PMF for |
Get EIF estimates for treatment-specific CDF at a particular level of the outcome
eif_theta_k(k, out, treat, trt_level, trt_spec_prob_est, trt_k_spec_cdf_est)
eif_theta_k(k, out, treat, trt_level, trt_spec_prob_est, trt_k_spec_cdf_est)
k |
The level of the outcome. |
out |
A |
treat |
A |
trt_level |
Treatment level |
trt_spec_prob_est |
Estimated propensity for |
trt_k_spec_cdf_est |
Estimated conditional CDF for |
Map an estimate of the conditional PMF into an estimate of the conditional CDF
estimate_cdf(pmf_est)
estimate_cdf(pmf_est)
pmf_est |
A list of the treatment-specific PMF estimates |
A list of treatment-specific CDF estimates
Compute confidence interval/s for the log-odds parameters
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, ... )
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, ... )
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 |
treat_prob_est |
Estimated probability of treatments, output from call
to |
treat |
A |
treat_form |
The right-hand side of a regression formula for the working model of treatment probability as a function of covariates |
out |
A |
ci |
A vector of |
alpha |
Confidence intervals have nominal level 1- |
nboot |
Number of bootstrap replicates used to compute bootstrap confidence intervals. |
out_levels |
A |
out_model |
Which R function should be used to fit the proportional odds
model. Options are |
... |
Other options (not currently used). |
List with wald
and bca
-estimated confidence intervals
for the weighted mean parameters.
Compute confidence interval/s for the Mann-Whitney parameter
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 )
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 )
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 |
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 |
ci |
A vector of |
out |
A |
alpha |
Confidence intervals have nominal level 1- |
nboot |
Number of bootstrap replicates used to compute bootstrap confidence intervals. |
out_levels |
A |
covar |
A |
out_model |
Which R function should be used to fit the proportional odds
model. Options are |
List with wald
and bca
-estimated confidence intervals
for the Mann-Whitney parameter.
Compute confidence interval/s for the treatment specific PMF and CDF.
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 )
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 )
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 |
treat_prob_est |
Estimated probability of treatments, output from call
to |
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 |
ci |
A vector of |
out_levels |
A |
out_model |
Which R function should be used to fit the proportional odds
model. Options are |
out |
A |
alpha |
Confidence intervals have nominal level 1- |
nboot |
Number of bootstrap replicates used to compute bootstrap confidence intervals. |
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
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 )
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 )
out |
A |
treat |
A |
covar |
A |
wmean_est |
The point estimates for weighted means |
alpha |
Confidence intervals have nominal level 1- |
out_levels |
A |
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 |
out_model |
Which R function should be used to fit the proportional odds
model. Options are |
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 |
nboot |
Number of bootstrap replicates used to compute bootstrap confidence intervals. |
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.
estimate_cond_mean(trt_spec_pmf_est, ordered_out_levels, ordered_out_weights)
estimate_cond_mean(trt_spec_pmf_est, ordered_out_levels, ordered_out_weights)
trt_spec_pmf_est |
The treatment-specific PMF estimates |
ordered_out_levels |
Self explanatory |
ordered_out_weights |
Self explanatory |
Vector of estimated conditional means
Obtain an estimate of the efficient influence function for the treatment-specific weighted mean parameter
estimate_eif_wmean( trt_spec_cond_mean_est, trt_spec_prob_est, trt_level, out, treat )
estimate_eif_wmean( trt_spec_cond_mean_est, trt_spec_prob_est, trt_level, out, treat )
trt_spec_cond_mean_est |
Conditional mean for |
trt_spec_prob_est |
Propensity for |
trt_level |
Treatment level |
out |
A |
treat |
A |
implements a plug-in estimator of equation (2) in Diaz et al
estimate_logodds(cdf_est)
estimate_logodds(cdf_est)
cdf_est |
A list of treatment-specific CDF estimates |
Log odds of treatment = 1, = 0, and the difference.
Compute the estimate of Mann-Whitney based on conditional CDF and PMF
estimate_mannwhitney(cdf_est, pmf_est)
estimate_mannwhitney(cdf_est, pmf_est)
cdf_est |
Conditional CDF estimates |
pmf_est |
Conditional PMF estimates |
Mann-Whitney point estimate
fit_trt_spec_reg
, which
fits the proportion odds model in a given treatment arm.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, ... )
estimate_pmf( out, treat, covar, out_levels, out_form = NULL, out_model, treat_prob_est, stratify = FALSE, return_models = TRUE, ... )
out |
A |
treat |
A |
covar |
A |
out_levels |
A |
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 |
treat_prob_est |
Estimated probability of treatments, output from call
to |
stratify |
Boolean indicating whether to use nonparametric maximum likelihood
(i.e., a stratified estimator). If |
return_models |
If |
... |
Other options (not used). |
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
estimate_treat_prob(treat, covar, treat_form, return_models)
estimate_treat_prob(treat, covar, treat_form, return_models)
treat |
A |
covar |
A |
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 |
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.
estimate_wmean( pmf_est, treat, out, out_levels, out_weights, treat_prob_est, return_cov = TRUE )
estimate_wmean( pmf_est, treat, out, out_levels, out_weights, treat_prob_est, return_cov = TRUE )
pmf_est |
List of treatment-specific PMF estimates. |
treat |
A |
out |
A |
out_levels |
A |
out_weights |
A vector of |
treat_prob_est |
Estimated probability of treatments, output from call
to |
return_cov |
If |
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
evaluate_beta_cov(cdf_est, theta_cov)
evaluate_beta_cov(cdf_est, theta_cov)
cdf_est |
Estimated CDFs |
theta_cov |
Covariance matrix for CDF estimates |
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.
evaluate_mannwhitney_gradient(cdf_est, pmf_est)
evaluate_mannwhitney_gradient(cdf_est, pmf_est)
cdf_est |
Conditional CDF estimates |
pmf_est |
Conditional PMF estimates |
3-length vector for delta method calculus
Get eif estimates for treatment-specific CDF
evaluate_marg_cdf_eif(cdf_est, treat_prob_est, treat, out, out_levels)
evaluate_marg_cdf_eif(cdf_est, treat_prob_est, treat, out, out_levels)
cdf_est |
Estimated conditional CDF for |
treat_prob_est |
Estimated propensity for |
treat |
A |
out |
A |
out_levels |
A |
a list of eif estimates
Evaluate pointwise confidence interval for marginal CDF.
evaluate_marg_cdf_ptwise_ci(marg_cdf_est, marg_cdf_eif, alpha)
evaluate_marg_cdf_ptwise_ci(marg_cdf_est, marg_cdf_eif, alpha)
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- |
List by treatment of simultaneous confidence intervals
Evaluate simultaneous confidence interval for marginal PMF or CDF.
evaluate_marg_dist_simul_ci( marg_dist_est, marg_dist_eif, alpha, remove_last = FALSE )
evaluate_marg_dist_simul_ci( marg_dist_est, marg_dist_eif, alpha, remove_last = FALSE )
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- |
remove_last |
Should the last level be removed? Should be set equal to
|
List by treatment of simultaneous confidence intervals
Get eif estimates for treatment-specific PMF
evaluate_marg_pmf_eif(pmf_est, treat_prob_est, treat, out, out_levels)
evaluate_marg_pmf_eif(pmf_est, treat_prob_est, treat, out, out_levels)
pmf_est |
Estimated conditional PMF for |
treat_prob_est |
Estimated propensity for |
treat |
A |
out |
A |
out_levels |
A |
a list of eif estimates
Evaluate pointwise confidence interval for marginal PMF.
evaluate_marg_pmf_ptwise_ci(marg_pmf_est, marg_pmf_eif, alpha)
evaluate_marg_pmf_ptwise_ci(marg_pmf_est, marg_pmf_eif, alpha)
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- |
List by treatment of simultaneous confidence intervals
get a covariance matrix for the estimated CDF
evaluate_theta_cov(cdf_est, treat_prob_est, treat, out, out_levels)
evaluate_theta_cov(cdf_est, treat_prob_est, treat, out, out_levels)
cdf_est |
The estimates of the treatment-specific CDFs |
treat_prob_est |
List of estimated probability of treatments, output from call
to |
treat |
A |
out |
A |
out_levels |
A |
Estimated covariance matrix for CDF estimates
Get a matrix of eif estimates for treatment-specific PMF
evaluate_trt_spec_pmf_eif( trt_spec_pmf_est, trt_spec_prob_est, trt_level, treat, out, out_levels )
evaluate_trt_spec_pmf_eif( trt_spec_pmf_est, trt_spec_prob_est, trt_level, treat, out, out_levels )
trt_spec_pmf_est |
Estimated conditional PMF for |
trt_spec_prob_est |
Estimated propensity for |
trt_level |
Treatment level |
treat |
A |
out |
A |
out_levels |
A |
a matrix of EIF estimates
get a matrix of eif estimates for the treatment-specific CDF estimates
evaluate_trt_spec_theta_eif( trt_spec_cdf_est, trt_spec_prob_est, trt_level, treat, out, out_levels )
evaluate_trt_spec_theta_eif( trt_spec_cdf_est, trt_spec_prob_est, trt_level, treat, out, out_levels )
trt_spec_cdf_est |
Estimated conditional CDF for |
trt_spec_prob_est |
Estimated propensity for |
trt_level |
Treatment level |
treat |
A |
out |
A |
out_levels |
A |
matrix of EIF estimates for CDF.
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.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.
fit_trt_spec_reg( trt_level, trt_spec_prob_est, out, treat, covar, out_levels, out_form = NULL, out_model, stratify, ... )
fit_trt_spec_reg( trt_level, trt_spec_prob_est, out, treat, covar, out_levels, out_form = NULL, out_model, stratify, ... )
trt_level |
Which level of treatment to fit the proportional odds model for |
trt_spec_prob_est |
A vector of estimates of Pr( |
out |
A |
treat |
A |
covar |
A |
out_levels |
A |
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 |
stratify |
Boolean indicating whether to use nonparametric maximum likelihood
(i.e., a stratified estimator). If |
... |
Other options (not used). |
Compute one log odds based on a given data set.
get_one_logodds(treat, covar, treat_form, out_model, out, out_levels, out_form)
get_one_logodds(treat, covar, treat_form, out_model, out, out_levels, out_form)
treat |
A |
covar |
A |
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 |
out |
A |
out_levels |
A |
out_form |
The right-hand side of a regression formula for the working proportional odds model. NOTE: THIS FORMULA MUST NOT SUPPRESS THE INTERCEPT. |
Estimated log odds for these input data.
Compute one estimate of Mann-Whitney parameter based on a given data set.
get_one_mannwhitney( treat, covar, treat_form, out, out_levels, out_form, out_model )
get_one_mannwhitney( treat, covar, treat_form, out, out_levels, out_form, out_model )
treat |
A |
covar |
A |
treat_form |
The right-hand side of a regression formula for the working model of treatment probability as a function of covariates |
out |
A |
out_levels |
A |
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 |
Estimate of Mann-Whitney parameter for these input data.
Compute one estimate of the marginal CDF/PMF on a given data set.
get_one_marg_dist( treat, covar, treat_form, out_model, out, out_levels, out_form )
get_one_marg_dist( treat, covar, treat_form, out_model, out, out_levels, out_form )
treat |
A |
covar |
A |
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 |
out |
A |
out_levels |
A |
out_form |
The right-hand side of a regression formula for the working proportional odds model. NOTE: THIS FORMULA MUST NOT SUPPRESS THE INTERCEPT. |
List of estimated cdf/pmf for these input data.
Compute one weighted mean based on a given data set.
get_one_wmean( treat, covar, treat_form, out, out_levels, out_form, out_model, out_weights )
get_one_wmean( treat, covar, treat_form, out, out_levels, out_form, out_model, out_weights )
treat |
A |
covar |
A |
treat_form |
The right-hand side of a regression formula for the working model of treatment probability as a function of covariates |
out |
A |
out_levels |
A |
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 |
out_weights |
A vector of |
Get a response from model formula
getResponseFromFormula(formula, data)
getResponseFromFormula(formula, data)
formula |
The model formula |
data |
The data frame associated with the model |
Compute jackknife log-odds estimates.
jack_logodds(treat, covar, out, treat_form, out_model, out_levels, out_form)
jack_logodds(treat, covar, out, treat_form, out_model, out_levels, out_form)
treat |
A |
covar |
A |
out |
A |
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 |
out_levels |
A |
out_form |
The right-hand side of a regression formula for the working proportional odds model. NOTE: THIS FORMULA MUST NOT SUPPRESS THE INTERCEPT. |
Jackknife estimated log-odds
Compute Mann-Whitney log-odds estimates.
jack_mannwhitney( treat, covar, out, treat_form, out_levels, out_form, out_model )
jack_mannwhitney( treat, covar, out, treat_form, out_levels, out_form, out_model )
treat |
A |
covar |
A |
out |
A |
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 |
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 |
Jackknife estimate of Mann-Whitney parameter
Compute jackknife distribution estimates.
jack_marg_cdf(treat, covar, out, treat_form, out_levels, out_form, out_model)
jack_marg_cdf(treat, covar, out, treat_form, out_levels, out_form, out_model)
treat |
A |
covar |
A |
out |
A |
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 |
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 |
Jackknife estimated distributions
Compute jackknife weighted mean estimates.
jack_wmean( treat, covar, out, treat_form, out_levels, out_form, out_weights, out_model )
jack_wmean( treat, covar, out, treat_form, out_levels, out_form, out_weights, out_model )
treat |
A |
covar |
A |
out |
A |
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 |
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 |
out_model |
Which R function should be used to fit the proportional odds
model. Options are |
Jackknife-estimated weighted mean
Marginalize over empirical distribution to obtain marginal treatment-specific CDF estimate.
marginalize_cdf(cdf_est)
marginalize_cdf(cdf_est)
cdf_est |
Estimates of treatment-specific conditional CDF. |
Marginalize over empirical distribution to obtain marginal treatment-specific PMF estimate.
marginalize_pmf(pmf_est)
marginalize_pmf(pmf_est)
pmf_est |
Estimates of treatment-specific conditional PMF. |
Get one bootstrap computation of the log odds parameters.
one_boot_logodds( treat, covar, out, treat_form, out_levels, out_form, out_model )
one_boot_logodds( treat, covar, out, treat_form, out_levels, out_form, out_model )
treat |
A |
covar |
A |
out |
A |
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 |
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 |
Estimates of log odds for a particular bootstrap sample.
Get one bootstrap computation of the Mann-Whitney parameter.
one_boot_mannwhitney( treat, covar, out, treat_form, out_levels, out_form, out_model )
one_boot_mannwhitney( treat, covar, out, treat_form, out_levels, out_form, out_model )
treat |
A |
covar |
A |
out |
A |
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 |
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 |
Estimates of Mann-Whitney parameter for a particular bootstrap sample.
Get one bootstrap computation of the CDF and PMF estimates
one_boot_marg_dist( treat, covar, out, treat_form, out_levels, out_form, out_model )
one_boot_marg_dist( treat, covar, out, treat_form, out_levels, out_form, out_model )
treat |
A |
covar |
A |
out |
A |
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 |
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 |
Estimates of CDF and PMF for a particular bootstrap sample.
Get one bootstrap computation of the weighted mean parameters.
one_boot_wmean( treat, covar, out, treat_form, out_levels, out_form, out_weights, out_model )
one_boot_wmean( treat, covar, out, treat_form, out_levels, out_form, out_weights, out_model )
treat |
A |
covar |
A |
out |
A |
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 |
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 |
out_model |
Which R function should be used to fit the proportional odds
model. Options are |
Estimates of weighted mean for a particular bootstrap sample.
"drord"
object.Print the output of a "drord"
object.
## 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)] }, ... )
## 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)] }, ... )
x |
A |
treat_labels |
Labels for the treatment variables (treat = 1 followed by treat = 0). |
dist |
Which distribution to plot. Valid options are |
out_labels |
Labels for the ordered outcome levels. If |
... |
Other arguments (not used) |
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.
The outcome in data
(indicated in the form
object) should be an ordered factor.
POplugin(form, data, weights = 1)
POplugin(form, data, weights = 1)
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) |
A list with the fitted glm, the original data, levels of the outcome, and the outcome name
POplugin
objectPredict method for a POplugin
object
## S3 method for class 'POplugin' predict(object, newdata = NULL)
## S3 method for class 'POplugin' predict(object, newdata = NULL)
object |
An object of class |
newdata |
A |
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
"drord"
object.Print the output of a "drord"
object.
## S3 method for class 'drord' print(x, ci = "bca", ...)
## S3 method for class 'drord' print(x, ci = "bca", ...)
x |
A |
ci |
Which confidence interval should be printed. Defaults to BCa,
but it BCa was not computed in call to |
... |
Other arguments (not used) |
Trimmed logistic function
trimmed_logit(x)
trimmed_logit(x)
x |
A numeric between 0 and 1 |
Compute a Wald confidence interval for the weighted mean
wald_ci_wmean(wmean_est, alpha)
wald_ci_wmean(wmean_est, alpha)
wmean_est |
The estimated weighted means + estimated covariance matrix. |
alpha |
Level of confidence interval. |
matrix with treatment-specific weighted mean CIs and CI for difference.