title: Plotting density function of propensity score before matching
body: <p>I'm running a dif-in-dif estimation and using the MatchIt package to match my treatment and control groups by their distance to a certain location (nearest neighbour matching, logit model, caliper = 0.25).</p>
  
  <p>Everything is ok with the actual matching, however I ran across this kind of plot in a paper I read:</p>
  
  <p><img src="https://i.stack.imgur.com/jqjLU.png" alt="Density functions before and after"></p>
  
  <p>I'm a bit confused, how is it possible to plot propensity scores before matching since the matching itself gives the propensity scores? So if anyone is familiar with this kind of plotting I'd appreciate help. Here's my code so far, which only gives the density functions after matching for treatment (Near) and control.</p>
  
  <pre><code>m.df &lt;- matchit(Near ~ Distance_to_center, data = df, method = "nearest", distance = "logit", caliper =0.25)
  mdf &lt;- match.data(m.df,distance = "pscore")
  
  df &lt;- mdf
  
  plot(density(df$pscore[df$Near==1]))
  plot(density(df$pscore[df$Near==0]))
  </code></pre>