# Tag Info

9

A simple google search should get your started: I like this one the best because it compares different packages: http://stat-www.berkeley.edu/~brill/Stat248/kalmanfiltering.pdf and here couple more: http://www.r-bloggers.com/the-kalman-filter-for-financial-time-series/ http://cran.r-project.org/web/packages/dlm/index.html http://cran.r-project.org/...

5

A great example of kalman filtering is in the Kyle Model. I have attached a presentation on the application of R to the kalman filter in the Kyle Model. http://www.rinfinance.com/RinFinance2009/presentations/microstructure-tutorial.pdf Basically in the Kyle Model, a market maker finds the likelihood an asset is ending up at a certain price given that a ...

5

There is no a "yes/no answer" to that question. Generally Kalman Filter tends to be better than linear regression, but everything depends on the data which you have, how you calibrate your model. I expect that you have used some library for estimating linear regression parameters. Now you need to think how will you "tune" Kalman filter - the constants ...

3

I recently blogged about this very topic. Essentially, there are 3 ways to estimate Q & R. approximate calculate variate estimate of error in a controlled environment if z doesn't change, calculate variance estimate of z if z does change, calculate variance of regression estimate of z guess use some constant multiplied by the identity matrix ...

3

Consider historical observation dates $t_0 < t_1 < \cdots < t_n$. From the state variable equations \begin{align*} dZ_t^1&=-kZ_t^1dt+h_1dW_t^1+h_2dW_t^2,\\ dZ_t^2&=h_0dW_t^1. \end{align*} We obtain that, for $i=1, \ldots, n$, \begin{align*} Z_{t_i}^1 &= e^{-k \Delta t_i} Z_{t_{i-1}}^1 + h_1 \int_{t_{i-1}}^{t_i}e^{-k (t_i-s)}dW_s^1 + h_2 ...

3

There is no magic in the Kalman Filter. The linear regression model usually assumes the coefficients follow a random walk and as such it essentially boils down to an estimation followed by exponential smoothing of the coefficients.

2

If you have a linear/gaussian state space model and you're using a Kalman Filter, you can use maximum likelihood estimation or the EM algorithm. I personally prefer the former since you don't need to know anything about smoothing. If you use the EM, you do. If your observations are $z_1, \ldots, z_n$, then you can write down an innovations likelihood L(\...

2

Estimation of the initial states of R and particularly Q is indeed more of an art than science. The task at hand is to estimate the covariances. You have basically two main choices: Live with the fact that you will never be able to exactly pinpoint the covariance of noise in financial time series. The most often used approach is to pose the coveriance ...

2

This is definitely not a Kalman filter's issue: if you replace this line of code args <- eapply(env = env, FUN = function(x){ClCl(x)}) with this one args <- eapply(env = env, FUN = function(x){ClCl(x)})[Symbols] eapply() will keep the order of the original Yahoo query from quantmod. You can check and you will see each $\beta_{t}$ matches about ...

2

This book goes through exactly this problem in quite detail (with C++ codes included). I've worked through it in the past, but can't sum it up off the top of my head.

2

In the paper you cited in the question, the equation (1) is not the equation of state in kalman filter model, but an $AR(3)$ estimated via OLS as shown in Stock & Watson (2002). What the authors estimated in the paper using the Kalman filter is the latent variables $f_t,_h$ and the relative lags through which they estimated both the equation (1) and (2)....

1

Yes, linear regression can be cast as a Kalman filter estimate. I believe, D. Simons book "Optimal State Estimation: .. " has all the details.

1

It is not about estimating those equations via PC. There are various methods to estimate the latent factor fth, one of which is principal components. They have asked us to use that. Series(z) in those equations is observed data so we use the estimated fth and observed z to perform the OLS as suggested AR(3) or ARMA(1,0,3) would make the residual series ...

1

We use KFilter. here is a link to their documentation page for you to peruse. If you share a bit more about how you want to use the filter then it may help us. However please note that suggest me a library questions are typically not on topic on any of the stack exchange sites To update the answer to include the function the user wanted.... Here is the ...

1

Q1- for AR(1) only one 1 lag, ie burn in, should be sufficient. However, you could do 50 to feel comfortable. Q2- Matching the theoretical one is not a possibility Q3. (update) AIC/BIC tests on the simulated series can help select the best one. You can get the logL values from KF or estimate functions in Matlab.

1

Usually $var(e_x), var(e_y)$ variances are calibrated by maximum likelihood from data similar as you want to calibrate your parameters $\theta$. Ratio $var(e_x)/var(e_y)$ tells you what are changes in your time-series $var(e_x)/var(e_y)$ is small: changes in time-series of observations are just noise and underlying state doesn't change much; \$var(e_x)/...

1

The following paper gives you a step-by-step presentation of how to use the Kalman filter in an application in a pricing model framework for a spot and futures market. Everything is explained using Excel: A Simplified Approach to Understanding the Kalman Filter Technique by T. Arnold, M. Bertus and J. M. Godbey

Only top voted, non community-wiki answers of a minimum length are eligible