CalAPCE {aihuman}R Documentation

Calculate APCE

Description

Calculate average principal causal effects (APCE) with ordinal decision. See Section 3.4 for more details.

Usage

CalAPCE(
  data,
  mcmc.re,
  subgroup,
  name.group = c("overall", "Sex0", "Sex1", "Sex1 White0", "Sex1 White1"),
  rho = 0,
  burnin = 0,
  out.length = 500,
  c0 = 0,
  c1 = 0,
  ZX = NULL,
  save.individual.optimal.decision = FALSE,
  parallel = FALSE,
  optimal.decision.only = FALSE,
  dmf = NULL,
  fair.dmf.only = FALSE
)

Arguments

data

A data.frame or matrix of which columns consists of pre-treatment covariates, a binary treatment (Z), an ordinal decision (D), and an outcome variable (Y). The column names of the latter three should be specified as "Z", "D", and "Y" respectively.

mcmc.re

A mcmc object generated by AiEvalmcmc() function.

subgroup

A list of numeric vectors for the index of each of the five subgroups.

name.group

A list of character vectors for the label of five subgroups.

rho

A sensitivity parameter. The default is 0 which implies the unconfoundedness assumption (Assumption 4).

burnin

A proportion of burnin for the Markov chain. The default is 0.

out.length

An integer to specify the progress on the screen. Every out.length-th iteration is printed on the screen. The default is 500.

c0

The cost of an outcome. See Section 3.7 for more details. The default is 0.

c1

The cost of an unnecessarily harsh decision. See Section 3.7 for more details. The default is 0.

ZX

The data matrix for interaction terms. The default is the interaction between Z and all of the pre-treatment covariates (X).

save.individual.optimal.decision

A logical argument specified to save individual optimal decision rules. The default is FALSE.

parallel

A logical argument specifying whether parallel computing is conducted. Do not change this argument manually.

optimal.decision.only

A logical argument specified to compute only the optimal decision rule. The default is FALSE.

dmf

A numeric vector of binary DMF recommendations. If null, use judge's decisions (0 if the decision is 0 and 1 o.w; e.g., signature or cash bond).

fair.dmf.only

A logical argument specified to compute only the fairness of given DMF recommendations. The default is FALSE. Not used in the analysis for the JRSSA paper.

Value

An object of class list with the following elements:

P.D1.mcmc

An array with dimension n.mcmc by 5 by (k+1) by (k+2) for quantity P(D(1)=d| R=r), dimension 1 is each posterior sample; dimension 2 is subgroup, dimension 3 is (k+1) values of D from 0 to k, dimension 4 is (k+2) values of R from 0 to k+1.

P.D0.mcmc

An array with dimension n.mcmc by 5 by (k+1) by (k+2) for quantity P(D(0)=d| R=r).

APCE.mcmc

An array with dimension n.mcmc by 5 by (k+1) by (k+2) for quantity P(D(1)=d| R=r)-P(D(0)=d| R=r).

P.R.mcmc

An array with dimension n.mcmc by 5 by (k+2) for quantity P(R=r) for r from 0 to (k+1).

Optimal.Z.mcmc

An array with dimension n.mcmc by 5 for the proportion of the cases where treatment (PSA provided) is optimal.

Optimal.D.mcmc

An array with dimension n.mcmc by 5 by (k+1) for the proportion of optimal decision rule (average over observations). If save.individual.optimal.decision = TRUE, the dimension would be n by (k+1) (average over mcmc samples).

P.DMF.mcmc

An array with dimension n.mcmc by 5 by (k+1) by (k+2) for the proportion of binary DMF recommendations. Not used in the analysis for the JRSSA paper.

Utility.g_d.mcmc

Included if save.individual.optimal.decision = TRUE. An array with dimension n for the individual utility of judge's decisions.

Utility.g_dmf.mcmc

Included if save.individual.optimal.decision = TRUE. An array with dimension n for the individual utility of DMF recommendation.

Utility.diff.control.mcmc

Included if save.individual.optimal.decision = TRUE. An array with dimension n.mcmc for estimated difference in utility between judge's decisions and DMF recommendation among control group.

Utility.diff.treated.mcmc

Included if save.individual.optimal.decision = TRUE. An array with dimension n.mcmc for estimated difference in utility between judge's decisions and DMF recommendation among treated group.

Examples

data(synth)
sample_mcmc = AiEvalmcmc(data = synth, n.mcmc = 2)
subgroup_synth = list(1:nrow(synth),which(synth$Sex==0),which(synth$Sex==1),
                      which(synth$Sex==1&synth$White==0),which(synth$Sex==1&synth$White==1))
sample_apce = CalAPCE(data = synth, mcmc.re = sample_mcmc, subgroup = subgroup_synth)


[Package aihuman version 0.1.0 Index]