Hello
I understand that you are trying to use the MATLAB function ‘mvksdensity’ to perform kernel smoothing density estimation and are trying to understand the effect of the ‘Bandwidth’ input argument on the computation time.
The kernel density estimator function can be represented as:
(Source: Wikipedia)
Here, h is the smoothing factor called bandwidth and K is the kernel function.
The ‘Bandwidth’ parameter accepts inputs of 2 forms:
- Scalar: Scalar bandwidth value applies to all dimensions. This means that the scalar value is used as the value of ‘h’ for all data points.
- d-element vector: Here, d is the number of columns of the sample data. Each value in the vector corresponds to a particular column and is used as the value ‘h’ for all data points of that column.
Bandwidth controls the smoothness of the fit of the kernel density estimator function. Larger the bandwidth, the density plot will look like a unimodal distribution and hide all non-unimodal distribution properties. The value of the ‘Bandwidth’ parameter has no effect on the kernel function used in the ‘mvksdensity’. Kernel functions are specified using the ‘Kernel’ parameter and all the kernel functions have fixed definitions, independent of the bandwidth specified. As seen in the equation above, ‘h’ changes the input value passed to the kernel function.
The increase in computation time can be attributed to the change in the input value being passed to the kernel function due to the increasing value of ‘h’ with a larger 'bandwidth’ value. As per my investigation, I found that the computation time starts converging for very large values of ‘Bandwidth’.
For further understanding, you can refer to the following MATLAB Documentation:
- https://in.mathworks.com/help/stats/mvksdensity.html - Refer to the ‘Input Arguments’ section
I hope this helps!
Best Regards
Garmit