title: Nearest-neighbor matching with the Mahalanobis distance in R
body: <p>I would like to use the MatchIt package in R to perform nearest neighbor matching using the Mahalanobis distance withing some caliper. Which of the following two parameters of the <code>matchit</code> function that are related to the Mahalanobis distance should I use:</p>
  <ol>
  <li>the <code>distance=&quot;mahalanobis&quot;</code> param, or</li>
  <li>the <code>mahvars</code> param (e.g., <code>mahvars = c(&quot;X1&quot;, &quot;X2&quot;)</code>?</li>
  </ol>
  <p>What's the difference between the two?</p>
  <p>The documentation is terse about this (see pages 16 and 19): <a href="https://imai.fas.harvard.edu/research/files/matchit.pdf" rel="nofollow noreferrer">https://imai.fas.harvard.edu/research/files/matchit.pdf</a>.</p>