# what is the weight.matrix from the GenMatch (Matching package) in R

So when using the GenMatch function to generate optimal weight coefficients for use in the Match() function. What do these values in the weight.matrix represent? For example, if we work through the example from the ?GenMatch example

library(Matching)
data(lalonde)
attach(lalonde)
X = cbind(age, educ, black, hisp, married, nodegr, u74, u75, re75, re74)
BalanceMat <- cbind(age, educ, black, hisp, married, nodegr, u74, u75, re75, re74,
I(re74*re75))
genout <- GenMatch(Tr=treat, X=X, BalanceMatrix=BalanceMat, estimand="ATE", M=1,
pop.size=16, max.generations=10, wait.generations=1)
genout\$Weight.matrix


We get a value of 296.8 for our age variable. What does this number represent, where does it come from/how is it calculated, is it in someway related to the variance of the data?

And leading on from this, how would one alter this age weighting value, such that matching occurs with +-5 years ?

Jasjeet Singh Sekhon wrote the matching package for R, but both reference data contains no description on the weight.matrix

The weight matrix is described in detail on page 6 of the paper you link to. When matching on multiple variables you need some way to combine the different dimensions into a single distance metric that tells you the distance between any two observations. The diagonal of the weight matrix is the relative weight placed on each variable/dimension for that single distance metric, where distance in each variable's dimension is standardized by the SD for that variable. GenMatch uses an evolutionary algorithm to search over different possible weight matrices and selects the one it finds that best minimizes a loss function defined by fit.func. By default GenMatch selects the proposed weight matrix that maximizes the minimum p-value on a balance check of all variables matched on in order to improve overall balance. If you only want matches within a certain distance on a particular variable you can provide a vector to the argument caliper with a cutoff for each variable defined in the SD of that variable.