Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

How to define the value of bandwidth when we have a vector where all the values is the same? In this case, IQR and sample variation are both equal zero and Silverman's rule also result in zero.

Using R, we have for $\vec{v} = (1,1)$ the bandwidth of 0.7835

density(c(1,1))$bw

and for $\vec{v} = (10,10)$, the value 7.834955

density(c(10,10))$bw
share|improve this question
Why would you want to use use kernel density estimation when all the values are the same? – onestop Feb 17 '12 at 17:33
I use KDE for samples in general. But sometimes it happens to see a sample where all numbers are equal or that most is. For example, for the vector $\vec{x} (70,70,70,70,100)$, $IQR = 0$, and on Silvermans' rule, the bandwidth would be 0 due to $\min(s, IQR)$. – zeferino Feb 17 '12 at 19:35

1 Answer

up vote 1 down vote accepted

I found an way to deal with small values of $\sigma$ or $IQR$. I believe that this is what is used in the density function:

if $\sigma$ < $\epsilon$ or $IQR < \epsilon$ than $ bandwidth = 0.9 \bar{x} n^{-0.2} $

For $\vec{x} = (1,1)$, we get 0.7834955 like in

density(c(1,1))$bw

I used $\epsilon = 10^{-6}$

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.