# Fitting a probability density function with a kernel density estimator. How Matlab handles the support?

10 views (last 30 days)
Cristian Martinez on 3 Jan 2017
Commented: Cristian Martinez on 10 Jan 2017
Hi everybody,
This is related to the fitdist Matlab function (used to fit probability density functions) here. I know how to use the function no problem. My question is when using the Kernel density option, how does Matlab handles the "support". Matlab provides two options for support: 1) unbounded (Density can extend over the whole real line) and positive (Density is restricted to positive values). If anybody can help me illuminating how does Matlab handle theoretically the positive option, I would appreciate it. The unbounded one is pretty clear, but I after considerable time spent, I have not found the documentation in how the "positive" option is handled.
I would like to know the assumptions that goes into handling the 'positive' option as that would help me understand one is really happening near the zero boundary and how justified is my non-parametric probability density function estimation.

Zhao Wang on 9 Jan 2017
I understand that you want to know how MATLAB handles the Kernel density options for 'support' in the "fitdist" function. The documentation page of the function does not provide enough explanation of the Kernel density options for 'support'.
Similar options for 'support' exist in another function "ksdensity", which provides Kernel smoothing function estimate for univariate and bivariate data. The explanation provided for this function is listed as follows:
" *'Support' — Support for the density 'unbounded' (default) | 'positive' | two-element vector, [L U] | two-by-two matrix, [L1 L2 ; U1 U2] Support for the density, specified as the comma-separated pair consisting of 'support' and one of the following.
'unbounded' Default. Allow the density to extend over the whole real line. 'positive' Restrict the density to positive values. Two-element vector, [L U] Give the finite lower and upper bounds for the support of the density. This option is only valid for univariate sample data. Two-by-two matrix, [L1 L2 ; U1 U2] Give the finite lower and upper bounds for the support of the density. The first row contains the lower limits and the second row contains the upper limits. This option is only valid for bivariate sample data. For univariate data, if 'Support' is 'positive', then ksdensity transforms x using a log function, estimates the density of the transformed values, and transforms back to the original scale. If 'Support' is a vector [L U], then ksdensity uses the transformation log((X-L)/(U-X)). The Bandwidth parameter and bw outputs are on the scale of the transformed values.
For bivariate data, 'Support' can be a combination of positive, unbounded, or bounded variables specified as [0 -Inf ; Inf Inf] or [0 L ; Inf U]. ksdensity transforms each dimension of x in the same way as the univariate data. The 'Bandwidth' parameter and bw outputs are on the scale of the transformed values.*"
Please refer to the "Name-Value Pair Arguments" section in the following link:
##### 1 CommentShowHide None
Cristian Martinez on 10 Jan 2017
Thank you. That was exactly what I needed.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!