title: confusion on 2 dimension kernel density estimation in R
body: <p>A kernel density estimator is used to estimate a particular probability density function (see <a href="http://www.mvstat.net/tduong/research/seminars/seminar-2001-05/" rel="nofollow noreferrer">mvstat.net</a> and <a href="http://scikit-learn.org/stable/modules/density.html" rel="nofollow noreferrer">sckit-learn docs</a> for references)</p>
  
  <p>My confusion is about what exactly does <code>kde2d()</code> do? Does it estimate the joint distribution probability density function of two random variables <em>f(a,b)</em> in the below example? And what does the color mean?</p>
  
  <p>Here is the code example I am referring to.</p>
  
  <pre><code>b &lt;- log10(rgamma(1000, 6, 3))
  a &lt;- log10((rweibull(1000, 8, 2)))
  density &lt;- kde2d(a, b, n=100)
  
  colour_flow &lt;- colorRampPalette(c('white', 'blue', 'yellow', 'red', 'darkred'))
  filled.contour(density, color.palette=colour_flow)
  </code></pre>