This function calculates the difference between outcomes of
a set of subjects and the subjects in their matched sets. That is, the
value of Rj - Ri
in equation (7)
in Section 2.2
of the manuscript.
diff_reward(data_MS, idx_MS, max_size = 1, delta, dist_mat)
data_MS | a matrix that contains outcome, treatment, and feature information of a set of subjects. |
---|---|
idx_MS | a data frame of two columns |
max_size | an integer indicating the upper limit of the sizes of all
matched sets. The default setting is |
delta | a scalar, as defined in |
dist_mat | a precalculated matrix of distances between subjects.
This matrix must include all subjects in |
A vector of length max_size*nrow(data_MS)
.
The (i-1)*max_size+1
to the i*max_size
elements are the distances,
in ascending order, between the ith subject and the subjects in
its matched set. If the size of this matched set is smaller than max_size
,
some elements will be NA
.