So I have a massive excel spreadsheet of historical options data of the S&P 100 at different dates between 2010 and the present date. I am seeking to find the probability density function of the stock at each of these dates.
The method for finding this function is to take the second derivative of the call price (listed in column 5) with respect to the strike price. I want my MATLAB script to work as follows:
Use the curvefitting toolbox spline fitting function to create a curve of the call price with respect to the strike price at each date. There is about 10 points for each date.
Use the differentiate function to get maybe 50 points for the 2nd derivative to estimate the 2nd derivative function.
Use Riemann integration on these points to compute the integral for the expected value.
My main issues are with grouping of the table. I've done research and think I'll have to use rowfun probably, but I'm really not very experienced with working with data like this.
Any help would be HIGHLY appreciated!
A sample of the data set:
Are you doing steps (1) through (3) simply to compute the "best" 2nd derivative value for that date? If so, there's a much simpler way to do it. In pseudo-code, it would look like:
Because you only fit a parabola, the p_2nd will be a single value. This is your best estimate of the 2nd derivative of that day's data. The units will be dollars (?) per day.