title: Kernel density estimation in R for 6 Dimensional data
body: <p>This is the frist time to perform KDE in R with data which has more than 5 variables for me for anomaly detection.</p>
  <p>As far as I know that KDE is performable for multidimensional data but I couldn't find examples which using more than 5 dimensional data.</p>
  <p>I'm using data which have 'age', 'trestbps', 'chol', 'thalach', and 'oldpeak' 5 variables as like below.</p>
  <pre><code>'data.frame':   176 obs. of  5 variables:
  $ age     : int  30 50 50 50 50 60 50 40 50 40 ...
  $ trestbps: int  130 130 130 130 130 130 130 130 130 130 ...
  $ chol    : int  198 245 221 288 205 309 240 243 289 250 ...
  $ thalach : int  130 166 164 159 184 131 154 152 124 179 ...
  $ oldpeak : num  1.6 2.4 0 0.2 0 1.8 0.6 0 1 0 ...
  </code></pre>
  <p>I performed KDE for those data, with the approach as like below, but I'm not sure it is correct approach, and proper result.</p>
  <pre><code>evpts &lt;- do.call(expand.grid, lapply(df3, quantile, prob = c(0.1,.25,.5,.75,.9)))
  
  hat2 &lt;- kde(df3, eval.points = evpts)
  
  
  
  &gt; str(hat2)
  List of 9
   $ x          : num [1:176, 1:5] 30 50 50 50 50 60 50 40 50 40 ...
    ..- attr(*, &quot;dimnames&quot;)=List of 2
    .. ..$ : NULL
    .. ..$ : chr [1:5] &quot;age&quot; &quot;trestbps&quot; &quot;chol&quot; &quot;thalach&quot; ...
   $ eval.points:'data.frame':    3125 obs. of  5 variables:
    ..$ age     : Named num [1:3125] 40 40 50 60 60 40 40 50 60 60 ...
    .. ..- attr(*, &quot;names&quot;)= chr [1:3125] &quot;10%&quot; &quot;25%&quot; &quot;50%&quot; &quot;75%&quot; ...
    ..$ trestbps: Named num [1:3125] 108 108 108 108 108 112 112 112 112 112 ...
    .. ..- attr(*, &quot;names&quot;)= chr [1:3125] &quot;10%&quot; &quot;10%&quot; &quot;10%&quot; &quot;10%&quot; ...
    ..$ chol    : Named num [1:3125] 194 194 194 194 194 194 194 194 194 194 ...
    .. ..- attr(*, &quot;names&quot;)= chr [1:3125] &quot;10%&quot; &quot;10%&quot; &quot;10%&quot; &quot;10%&quot; ...
    ..$ thalach : Named num [1:3125] 114 114 114 114 114 ...
    .. ..- attr(*, &quot;names&quot;)= chr [1:3125] &quot;10%&quot; &quot;10%&quot; &quot;10%&quot; &quot;10%&quot; ...
    ..$ oldpeak : Named num [1:3125] 0 0 0 0 0 0 0 0 0 0 ...
    .. ..- attr(*, &quot;names&quot;)= chr [1:3125] &quot;10%&quot; &quot;10%&quot; &quot;10%&quot; &quot;10%&quot; ...
    ..- attr(*, &quot;out.attrs&quot;)=List of 2
    .. ..$ dim     : Named int [1:5] 5 5 5 5 5
    .. .. ..- attr(*, &quot;names&quot;)= chr [1:5] &quot;age&quot; &quot;trestbps&quot; &quot;chol&quot; &quot;thalach&quot; ...
    .. ..$ dimnames:List of 5
    .. .. ..$ age     : chr [1:5] &quot;age=40&quot; &quot;age=40&quot; &quot;age=50&quot; &quot;age=60&quot; ...
    .. .. ..$ trestbps: chr [1:5] &quot;trestbps=108&quot; &quot;trestbps=112&quot; &quot;trestbps=120&quot; &quot;trestbps=128&quot; ...
    .. .. ..$ chol    : chr [1:5] &quot;chol=194.00&quot; &quot;chol=211.00&quot; &quot;chol=244.00&quot; &quot;chol=283.75&quot; ...
    .. .. ..$ thalach : chr [1:5] &quot;thalach=113.50&quot; &quot;thalach=128.25&quot; &quot;thalach=150.00&quot;     &quot;thalach=164.00&quot; ...
    .. .. ..$ oldpeak : chr [1:5] &quot;oldpeak=0.0&quot; &quot;oldpeak=0.0&quot; &quot;oldpeak=0.8&quot; &quot;oldpeak=1.8&quot; ...
   $ estimate   : Named num [1:3125] 5.64e-12 5.64e-12 2.85e-09 7.76e-10 7.76e-10 ...
    ..- attr(*, &quot;names&quot;)= chr [1:3125] &quot;1&quot; &quot;2&quot; &quot;3&quot; &quot;4&quot; ...
   $ H          : num [1:5, 1:5] 6.972 0.866 5.065 -6.541 0.189 ...
   $ gridded    : logi FALSE
   $ binned     : logi FALSE
   $ names      : chr [1:5] &quot;age&quot; &quot;trestbps&quot; &quot;chol&quot; &quot;thalach&quot; ...
   $ w          : num [1:176] 1 1 1 1 1 1 1 1 1 1 ...
   $ type       : chr &quot;kde&quot;
   - attr(*, &quot;class&quot;)= chr &quot;kde&quot;
  </code></pre>
  <p>If it is not proper approach, could you please help me to get correct approach?</p>
  <p>Thank you for your support.</p>