MATLAB: Histogram then a curve fitting to compare with normal

curvedistributionfittingnormalplot

Dear Everbody, I have a array of daily returns of size 1775.
When I use:
histfit(GLLlogreturn, 60)
I get a histogram with a normal curve superimposed.
Is there a way I can get a curve fitting tool to match my data as a comparison to the normal distribution curve?
So 3 things on 1 plot: Histogram, Curve fitting of my data, Normal curve.

Best Answer

It's not perfectly clear to me what you want, but here are a couple factoids for you.
First, it's important to realize that the normal curve that histfit() calculates is a fit to the underlying data, not to the histogram of the data. So, if what you want is a normal curve fit to your curve, histfit() is doing what you want.
If you don't want a normal curve, then what do you mean by "curve fitting of your data"? Do you have some other functional form in mind? MATLAB can fit to many different functions.
If you want to do something non-parametric rather than a specific function, then one possibility is to do a kernel density estimation. MATLAB has a function for that as well: ksdensity().
Related Question