[SciPy-User] typo in stats tutorial?

josef.pktd@gmai... josef.pktd@gmai...
Wed Dec 5 13:20:00 CST 2012


On Wed, Dec 5, 2012 at 2:01 PM, Neal Becker <ndbecker2@gmail.com> wrote:
> The text says there's very little difference between Scott's Rule and
> Silverman's Rule.  With the code, I don't think there'd be any difference at
> all:
>
> from scipy import stats
>
> x1 = np.array([-7, -5, 1, 4, 5], dtype=np.float)
> kde1 = stats.gaussian_kde(x1)
> kde2 = stats.gaussian_kde(x1, bw_method='silverman')
>
> fig = plt.figure()
> ax = fig.add_subplot(111)
>
> ax.plot(x1, np.zeros(x1.shape), 'b+', ms=20)  # rug plot
> x_eval = np.linspace(-10, 10, num=200)
> ax.plot(x_eval, kde1(x_eval), 'k-', label="Scott's Rule")
> ax.plot(x_eval, kde1(x_eval), 'r-', label="Silverman's Rule")

kde2

what are we supposed to see?

nice, example runs without changes in python 3.2.3 (the only python on
my computer that seems to have a recent scipy and matplotlib)

Josef

>
> plt.show()
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user


More information about the SciPy-User mailing list