dist2net {rcbalance} | R Documentation |
Building and Manipulating Network Flow Problems
Description
These are internal rcbalance methods not meant to be called directly by users. They are used to construct a network flow problem from the information about a matching problem that is passed to the rcbalance
method.
Usage
dist2net(dist.struct, k, exclude.treated = FALSE, ncontrol = NULL)
dist2net.matrix(dist.struct, k, exclude.treated = FALSE)
add.layer(net.layers, new.layer)
penalty.update(net.layers, newtheta, newp = NA)
penalize.near.exact(net.layers, near.exact)
Arguments
dist.struct |
An object specifying the sparsity structure of the match. For the dist2net method it is a list of vectors, and for the dist2net.matrix method it is a matrix or InfinitySparseMatrix. See rcbalance documentation for more details. |
k |
a nonnegative integer. The number of control units to which each treated unit will be matched. |
exclude.treated |
if |
ncontrol |
the number of controls in the matching problem. If left |
net.layers |
a layered network object of the type produced by the dist2net function. |
new.layer |
a vector equal in length to the number of treated and control units in the matching problem. Each coordinate contains the value of a new fine balance variable for the corresponding unit. |
newtheta |
optional argument giving a new value for the theta field of the net.layers object (see value section for description of this field). |
newp |
optional argument giving a new value for the p field of the net.layers object (see value section for description of this field). |
near.exact |
a vector equal in length to the number of treated and control units in the matching problem. Edges between units with different values of this variable will be penalized. |
Details
dist2net
and dist2net.matrix
take the distance structure given to rcbalance
encoding information about the matching problem and converts it into a network flow problem. add.layer
adds network structure to handle an individual fine balance variable (it can be called iteratively to add many such variables). penalty.update
is used to change the penalties for each layer (and the penalties for edges used to exclude treated units if they are present) and penalize.near.exact
is used to add penalties to the treated-control edges to allow near-exact matching. See the references for a detailed description of how the matching problem is transformed into a network.
Value
A layered network object, formatted as a list with the following arguments (where narcs is the number of arcs and nnodes is the number of nodes in the network):
startn |
a vector of length narc containing the node numbers of the start nodes of each arc in the network. |
endn |
a vector of length narc containing the node numbers of the end nodes of each arc in the network. |
ucap |
a vector of length narc containing the (integer) upper capacity of each arc in the network. |
cost |
a vector of length narc containing the (integer) cost of each arc in the network. |
b |
a vector of length nnode containing the (integer) supply or demand of each node in the network. Supplies are given as positive numbers and demands as negative numbers. |
tcarcs |
an integer giving the total number of arcs between the treated and control nodes in the network. |
layers |
a list object containing information about the refined covariate balance layers of the network. |
z |
a vector of treatment indicators. |
fb.structure |
a matrix containing information about the membership of the treated and control units in the different classes of refined balance covariates. |
penalties |
a vector of integer penalties, one for each fine balance layer. |
theta |
a value no less than 1 giving the ratio by which the penalty is increased with each additional layer of fine balance. |
p |
a nonnegative value giving the penalty for the finest level of fine balance. |
Author(s)
Samuel D. Pimentel