This is my R code:
x <- c(5.89,6.81,6.69,7.61,5.44,6.17)
y <- c(1,0.09392423,0.07090779,0.0687634,0.06819157,0.06261615)
plot(density(x, bw=0.050, adjust=1, kernel="gaussian",weights=(y),n=1000))
I'm trying to achieve the same result using D3.js or any other equivalent JavaScript library..
Can somebody please help?
The statistical properties of a kernel are determined by σ K 2 = ∫ t 2 K ( t ) d t \sigma^2_K = \int t^2 K(t) dt σK2=∫t2K(t)dt which is always =1 for our kernels (and hence the bandwidth bw is the standard deviation of the kernel) and R ( K ) = ∫ K 2 ( t ) d t R(K) = \int K^2(t) dt R(K)=∫K2(t)dt .
Kernel Density Estimation (KDE) It is estimated simply by adding the kernel values (K) from all Xj. With reference to the above table, KDE for whole data set is obtained by adding all row values. The sum is then normalized by dividing the number of data points, which is six in this example.
A kernel density estimate (KDE) plot is a method for visualizing the distribution of observations in a dataset, analogous to a histogram. KDE represents the data using a continuous probability density curve in one or more dimensions.
Some of the most popular and useful density estimation techniques are mixture models such as Gaussian Mixtures ( GaussianMixture ), and neighbor-based approaches such as the kernel density estimate ( KernelDensity ).
Have you seen the kernel density estimation example?
Admittedly it uses the Epanechnikov kernel rather than Gaussian, but that part could be modified.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With