The function creates the network for optimal variable-ratio matching to be passed via callrelax to the Fortran code for Bertsekas and Tseng's (1988) Relax IV.
Of limited interest to most users; function netvr() would typically be called by some other functions.
netvr(z,dist,min.control=1,max.control=min.control,
total.control=sum(z)*min.control,
fine=rep(1,length(z)),penalty=1000)A vector whose ith coordinate is 1 for a treated unit and is 0 for a control.
A distance list with the starting node (treated subjec), ending node (control), the extra distance between them.
A positive integer giving the minimum number of controls to be matched to each treated subject. If min.control is too large, the match will be infeasible.
A positive integer giving the maximum number of controls to be matched to each treated subject.
A positive integer giving the total number of controls to be matched to each treated subject. If total.control is too large, the match will be infeasible.
A vector of with length(z)=length(fine) giving the nominal levels that are to be nearly-finely balanced.
A numeric penalty imposed for each violation of fine balance.
A network for optimal variable-ratio matching.
The network contains a bipartite graph for treated and control subjects plus additional nodes for fine balance categories, plus additional nodes accept needed deviations from fine balance yielding near-fine balance.
Bertsekas, D. P. and Tseng, P. (1988) The relax codes for linear minimum cost network flow problems. Annals of Operations Research, 13, 125-190. Fortran and C code: http://www.mit.edu/~dimitrib/home.html. Available in R via the optmatch package.