Oct
1

## R Optimization Function Test

Using Kalman Filter for CIR interest rate model parameter estimation was introduced at my previously post Kalman Filter finance, soon after that I got a few comments saying the final results are unstable and highly depend on the initial values, that's true, local vs global minimum is never ending.

This post is therefore

The true values are listed in the paper "

I intentionally set the starting values far away from the true ones in order to see which one is able to find closest answers, obviously nlminb outperforms all others and returns almost the true values, I change the starting values randomly and still,

Check several alternative R optimization packages if you are not satisfied.

Hot posts:

15 Incredibly Stupid Ways People Made Their Millions

Online stock practice

Value at Risk xls

Ino.com: Don't Join Marketclub until You Read This MarketClub Reviews

Bootstrapping interest rate curve

Random posts:

Multidimensional numerical integration

Kernel density estimation

Quantitative Asset Management library

VaR Backtesting

High Probability ETF Trading Strategies on Stock

This post is therefore

**a sample test**of the optimization functions in R as I started to move from Matlab to R recently, and R allows us to choose the method we'd like to use for minimization.**Purpose**: to estimate the parameters for Vasicek interest rate model;**Function to be minimized**: similar as in Kalman Filter finance, where a CIR model is used instead;**Number of Parameters**: 8**Data**: two years time series of 3 month, 6 month, 1 year and 5 year US interest rate;**R function to be tested**: nlm, optim(Nelder-Mead), optim(BFGS), optim(SANN), nlminb, optim (L-BFGS-B)The true values are listed in the paper "

*estimating and testing exponential-affine term structure models by kalman filter*", abs.tol and rel.tol are set to be 1e-6 wherever possible, derivative is not given and unconstrained optimization is preferedI intentionally set the starting values far away from the true ones in order to see which one is able to find closest answers, obviously nlminb outperforms all others and returns almost the true values, I change the starting values randomly and still,

**nlminb is the best**and all R functions finish within seconds.Check several alternative R optimization packages if you are not satisfied.

**People viewing this post also viewed:**

Hot posts:

Random posts:

Ben Bolker

2010/10/01 19:04 [Add/Edit reply] [Clear reply] [Del comment] [Block]

are you willing to post the code and (re)post data?

abiao

2010/10/01 22:22 [Add/Edit reply] [Clear reply] [Del comment] [Block]

data and code are in my original post http://www.mathfinance.cn/kalman-filter-finance-revisited/, but you have to change the code from matlab to R. I can send my code to you if you have problem to convert.

Pages: 1/1 1