MATLAB Answers

Histogram then a curve fitting to compare with normal

26 views (last 30 days)
Mate 2u
Mate 2u on 5 Feb 2012
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.

Accepted Answer

the cyclist
the cyclist on 5 Feb 2012
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().

Community Treasure Hunt

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

Start Hunting!