dist2net: Building and Manipulating Network Flow Problems

Description Usage Arguments Details Value Author(s)

View source: R/rcbsubset-internal.R

Description

These are internal rcbsubset 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 rcbsubset method.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
dist2net(dist.struct, k, exclude.treated = FALSE, exclude.penalty = NULL, ncontrol = NULL,
	tol = 1e-3)

dist2net.matrix(dist.struct, k, exclude.treated = FALSE, exclude.penalty = NULL, 
	tol = 1e-3)

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 TRUE, then when there is no feasible match using all treated units, a minimal number of treated units may be dropped so that a match can be formed. Specifying this argument adds penalized edges to the network so that such a match can be computed. NOTE: this argument is incompatible with values of k greater than 1.

exclude.penalty

a parameter that gives the cost of excluding a treated unit. If left NULL it will be set to a very large value designed to ensure treated units are never excluded if they can be matched. Lower values may result in subsets of treated units being excluded.

ncontrol

the total number of controls in the matching problem. If left NULL the function will attempt to compute it by counting controls referenced in the distance object provided.

tol

edge cost tolerance. This is the smallest tolerated difference between matching costs. It is used in these functions only when exclude.penalty is NULL, to choose a default penalty that is small enough not to cause integer overflows.

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


rcbsubset documentation built on Nov. 9, 2021, 1:06 a.m.