File Exchange

## Bivariant Kernel Density Estimation (V2.1)

version 1.2.0.0 (213 KB) by
A tool for bivariant pdf, cdf and icdf estimation using Gaussian kernel function.

Updated 12 Aug 2013

This function implements bivariant Gaussian kernel density estimation. It can be used to estimate bivariant probability density function (pdf), cumulative distribution function (cdf) and inversed cdf (icdf) from a set of random data. The code is programmed in a way to be suitable for beginners to learn kernel density estimation.

### Cite As

Yi Cao (2021). Bivariant Kernel Density Estimation (V2.1) (https://www.mathworks.com/matlabcentral/fileexchange/19280-bivariant-kernel-density-estimation-v2-1), MATLAB Central File Exchange. Retrieved .

Takumi Sase

Sorry, please ignore the comment below.

Takumi Sase

How to optimaze the number of peaks in the code?

Larissa

So the function works once you figure out how the data needs to be structured. My only problem is that, as written, the actual pdf values scale down as your data range gets larger. Should this really be happening?

Up to and including the line

z=(X(k+zeros(n,1),:)-x)./h(ones(n,1),:);

the values are the same regardless of data scale. However, the next line scales by the bandwidth AGAIN and messes that up. Is this accurate? If so, could you explain the reasoning for this?

Joseph

examples do work, and so does the code. Really straightforward coding and simple to manipulate for use in your individual needs, even if you're new to KDE

Xinyao Tang

It seems that your bandwidth formula doesn't correct.

I just delete % to run the examples, but I got "Error in gkde2"

Matthew

documentation is false, misleading, and old.

Michael

nice code. I like that you put your references for methods, and I need to double-check them. Wish you had a link to Wolfram or an online resource.

Internal nomenclature could be cleaned up. The command call in the example should be able to be copied, pasted to command-line and executed.

sebastiano

Yong-ha

yolgs Hoffmann

ah ok: The functions does not get p.xy, the information in the file is misleading. But instead requires p.x and p.y separately. It´s in the check function around line 180 f.

yolgs Hoffmann

Nice one. But to really use it I definitely need to put in my own grid locations. So I have the same problem as Frank. Please - is there a solution? That would be really good.

Frank

Nice program with the default values. Put I'm not seeing how I can input my own grid locations. The optional inputs say "p.xy - Nx2 matrix for locations to make estimation", however, I don't see where this is done within the program. Also, I get errors on line 260 when I try to input my own bandwidth values.

Turkay YILDIZ

Warrick

Very easy to understand for a Matlab novice like myself. However, is the bandwidth formula correct? It doesn't seem to match the reference? Also, my total probability density is almost, but not exactly 1 (~0.96)

Tyler Jandreau

V. Poor

nicolas cachy

very handy, thank you

##### MATLAB Release Compatibility
Created with R2007b
Compatible with any release
##### Platform Compatibility
Windows macOS Linux