Kernel Density Estimation - Find the pdf and perform integration and derivative on this function

2 views (last 30 days)
Tam Ho
Tam Ho on 2 Jan 2018
Edited: Tam Ho on 11 Jan 2018
I have performed KDE on data:
[f,xi] = ksdensity(data,'bandwidth',0.5,'Function','pdf');
I have the following code which aims to solve for theta - roots of first derivative of the pdf. What I did was plot the pdf from kernel estimation, using Basic Fitting to obtain the function, then solve for theta.
syms theta %create symbolic variable theta
assume(theta,'real') %theta is real
pf = poly2sym(fit.coeff,theta); %calling our fitted polynomials
g = diff(pf,theta);
theta = double(g0);
However, Basic Fitting doesn't fit very well with the pdf. How can I obtain pdf and take derivative without producing too much residuals? (see pic)
Additionally, theta has to follow three conditions: -smaller than the highest pdf value -pdf evaluation of theta must be smaller than 0.8 times of that of the highest pdf value -integral from min x value to theta of pdf must be larger than 0.05
θ < μ, f(θ)<0.8·f(μ) and ∫ f (x)dx > 0.05 from min x to θ.
Is there a way to incorporate loop and boolean to automate solving for theta.
Tam Ho
Tam Ho on 11 Jan 2018
How to " use traditional signal processing approach, smooth the data and use a functions such as findpeaks on a numerical derivative of the signal." ? Can you give an example please?
Essentially the analysis procedure requires finding the pdf of the data and perform derivation on that.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!