I'm trying to implement a simple nearest neighbor matching for bonds that matches bonds from a treatment group with certain characteristics to bonds from a control group with similar characteristics. For the distance I wanted to use the Mahanolobis distance. The bonds are supposed to be matched exact based on certain variables ('ticker' and 'currency') and within a specific range for certain other variables ('maturity' and 'issued_amount_USD'). More precise, the code should match one bond from the treatment group with two bonds from the control group with coinciding ticker and currency while the absolute distance in maturities should be smaller or equal than two years (one bond with earlier maturity and one bond with later maturity) and the distance in issued amount should be smaller or equal than 4x the issued amount of the matched treatment bond.
Is there a specific code that succeeds to implement that matching in the usual MatchIt function or another solution?
Thanks in advance!
To capture the latter, I planned to use the caliper of the MatchIt-function (see below). However, the standard caliper only refers to the standard deviations in distances and not to absolute variable values. Using "std.caliper = False" helps out to use absolute values, but I'm failing at implementing the presented range.
matches <- matchit(
formula = treatment ~ ticker + issued_amount_USD + currency + maturity,
data = bonds,
method = 'nearest',
distance = 'mahalanobis',
ratio = 2,
caliper = c(maturity = 730, issued_amount_USD = 500000000),
std.caliper = FALSE,
exact = c('ticker','currency'),
discard = 'none'
)
Note: I used some arbitrary absolute values in caliper right now.