# Kernel Bandwidth: Scott's vs. Silverman's rules

Could anyone explain in plain English what the difference is between Scott's and Silverman's rules of thumb for bandwidth selection? Specifically, when is one better than the other? Is it related to the underlying distribution? Number of samples?

P.S. I am referring to the code in SciPy.

• I don't want to know python either. I just want help in understanding when to use which rule, and why. – xrfang Mar 20 '14 at 3:29

The comments in the code seem to end up defining the two essentially identically (aside a relatively small difference in the constant).

Both are of the form $$cAn^{-1/5}$$, both with what looks like the same $$A$$ (estimate of scale), and $$c$$'s very close to 1 (close relative to the typical uncertainty in the estimate of the optimum bandwidth).

[The binwdith estimate that more usually seems to be associated with Scott is the one from his 1979 paper[1] ($$3.49 s n^{-1/3}$$) -- e.g. see Wikipedia - scroll down a little - or R's nclass.scott.]

The 1.059 in what the code calls the "Scott estimate" is in the (prior) book by Silverman (see p45 of the Silverman reference at your link -- Scott's derivation of it is on p130-131 of the book they refer to). It comes from a normal-theory estimate.

The optimum bandwidth (in integrated mean square error terms) is a function of of the integrated squared second derivative, and $$1.059\sigma$$ comes out of that calculation for a normal, but in many cases that's a good deal wider than is optimum for other distributions.

The $$A$$ term is an estimate of $$\sigma$$ (sort of a robustified estimate, in a way that reduces the tendency for it to be too large if there are outliers/skewness/heavy tails). See eq 3.30 on p47, justified on p46-7.

For similar reasons to those I suggested before, Silverman goes on to suggest reducing 1.059 (in fact he actually uses 1.06 throughout, not 1.059 -- as does Scott in his book). He chooses a reduced value that loses no more than 10% efficiency on IMSE at the normal, which is where the 0.9 comes from.

So both those binwidths are based on the IMSE-optimal binwidth at the normal, one right at the optimum, the other (about 15% smaller, to get within 90% of the efficiency of the optimum at the normal). [I'd call both of them "Silverman" estimates. I have no idea why they name the 1.059 one for Scott.]

In my opinion, both are far too large. I don't use histograms to get IMSE-optimal estimates of the density. If that (obtaining estimates of the density that are optimal in the IMSE sense) was what I wanted to do, I wouldn't want to use histograms for that purpose.

Histograms should be erring on the noisier side (let the eye do the necessary smoothing). I nearly always double (or more) the default number of bins these kinds of rules give. So I wouldn't use 1.06 or 0.9, I'd tend to use something around 0.5, maybe less at really large sample sizes.

There's really very little to choose between them, since they both give far too few bins to be much use at finding what's going on in the data (on which, at least at small sample sizes, see here.

[1]: Scott, D.W. (1979), "On optimal and data-based histograms," Biometrika, 66, 605-610.

• According to SciPy document here, the Scott rule is: n**(-1./(d+4)). By looking at the code, I found I misunderstood the rule as same as "scotts_factor". You are right that the bandwidth is far too large. I will open a new question about numerical bandwidth selection. Thanks. – xrfang Mar 20 '14 at 6:52
• When you're doing univariate data ($d=1$), that's the $n^{-1/5}$ part in the above formulas. But that doesn't take into account the variability in the data (as measured by $A$ above), nor a term for what distribution you're trying to optimize near (what I called $c$ above, like the 1.059 factor). It's just how the bandwidth should change with sample size, not the constants it should be multiplied by. – Glen_b -Reinstate Monica Mar 20 '14 at 6:56
• @Glen_b-ReinstateMonica Could you have a look at the question I posted here? I show the problems Silverman's rule may entail when a large sample size is used. Could you answer what is going on in detail? – user269666 Jan 12 at 16:19