[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Financial:Grid search + leasqr to fit 3 parameters. How to speed up?

From: KRadomański
Subject: Financial:Grid search + leasqr to fit 3 parameters. How to speed up?
Date: Mon, 18 Jul 2011 10:37:08 -0700 (PDT)

I am trying to repeat the analysis proposed in the article below:

I need to fit an option pricing function separately to data about 20 stocks
for each day over 252 days by estimating 3 parameters for each stock.

The function I wrote, based on the article, returns a vector of theoretical
prices of options written on a particular stock for all the available strike
prices, given the current price of the stock, time to maturity, risk-free
interest rate, dividend yield, beta coefficient, market volatility and
idiosyncratic volatility. 

The parameter of interest is beta,but in order to estimate ("imply") it,
dividend yield and idiosyncratic volatility which minimize the pricing
errors are also required.

The authors of the article provide the following grid search algorithm to
imply beta for a given stock:

1. Perform Matlab lsqnonlin optimization (replaced by leasqr in my case) for
each value of beta in a confidence interval based on historical estimate of
beta for the stock +/-6 standard deviations. 

The point is to determine the pair [dividend_yield,
idiosyncratic_volatility] which minimizes the squared difference between the
market prices and theoretical prices of the option. 

The step of the search is 0.01 which implies that there will be at least 140
such minimizations performed.

2. Choose the value of beta for which, with the optimal
[dividend_yield,idiosyncratic_volatility], the error is the smallest.

At the moment, every leasqr estimation of the pair
[dividend_yield,idiosyncratic_volatility] takes up to one minute. If I
merely run 140 such estimations in a loop for each stock, the estimation of
daily betas for the 20 stocks will take as much more as two days! Analyzing
the entire trading year is out of reach then...

I know that execution time does not grow linearly with the size of data when
we work on matrices instead of running the same procedure multiple times.
Unfortunately the leasqr function only accepts one set of observations and
returns one vector of parameters. 

Is there any way to overcome this? 

Is using Matlab instead of Octave any chance for improvement? I read it
deals with loops much quicker. Or perhaps there is another function which
would fit function to multiple data sets given as a matrix?

I will be extremely grateful for any help.

Krzysztof Radomański
Warsaw School of Economics, Poland

View this message in context:
Sent from the Octave - General mailing list archive at

reply via email to

[Prev in Thread] Current Thread [Next in Thread]