Degrees of freedom in a kernel density estimation

8 visualizzazioni (ultimi 30 giorni)
Is there any way to estimate the degrees of freedom from a kernel density estimator?
Background: I want to compare the fitting I get with a parametric distribution with that of a kernel density estimation (with ksdensity). By 'compare' I mean to use the Akaike IC. I can calculate the loglikelihood with the info that ksdensity returns, but what about the number of parameters (or degrees of freedom)? How many parameters does ksdensity actually estimates? According to the literature the trace of the smoothing matrix is a good estimate of the DOF, but this matrix is not returned by ksdensity.
Any ideas?
Thanks

Risposta accettata

Francisco de Castro
Francisco de Castro il 20 Giu 2023
I found a solution for my own question. The degrees of freedom can be can be estimated as the trace of the smoothing matrix. This matrix is not returned by ksdensity, but it can be calculated as detailed below. Assume: 'data' is the vector of data and mormalf is the value of a Normal dist. at x= 1st argument, with mean= 2nd argument, and std= 3rd argument.
[Kpdf,mesh,bandw]= ksdensity(data,data);
N= numel(data);
S= zeros(N);
for k= 1:N
S(k,:)= normalf(data,data(k),bandw);
end
degreesfreedom= trace(S);

Più risposte (0)

Prodotti


Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by