[R] Kalman Smoothing - time-variant parameters (sspir)

From: ¨Tariq Khan <tariq.khan_at_gmail.com>
Date: Thu 01 Dec 2005 - 23:12:24 EST

Dear R-brains,

I'm rather new to state-space models and would benefit from the extra confidence in using the excellent package sspir.

In a one-factor model, If I am trying to do a simple regression where I assume the intercept is constant and the 'Beta' is changing, how do I do that? How do i Initialize the filter (i.e. what is appropriate to set m0, and C0 for the example below)?

The model I want is: y = alpha + beta + err1; beta_(t+1) = beta_t + err2

I thought of the following:
library(mvtnorm) # (1)
# Let's get some data so we can all try this at home dfrm <- data.frame(

                   y =
                   x = c(-0.03,-0.01,0.07,-0.03,-0.07,0.05,0.02,-0.05,-0.04,

0,0.07,0.04,-0.02,0,-0.03,0.04,-0.04,-0.01,0.03,0.02,0.05,0.04, 0.05,0.03,0,-0.04,0.05,0.05,0.06,0.02,0.04,-0.06)
ss <- ssm(y ~ tvar(x), time = 1:nrow(dfrm), family=gaussian(link="identity"),

smooth.params <- smoother(kfilter(ss$ss))$m

(1) I read in http://ww.math.aau.dk/~mbn/Teaching/MarkovE05/Lecture3.pdf that this is requred as there is a bug in sspir.

To what should I set ss$ss$m0 and ss$ss$C0? (I did notice that smoother() replaces these, but it still matters what I initialize it to in the first place)

Many thanks!

Tariq Khan

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Dec 01 23:17:12 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:25 EST