[R-SIG-Finance] Kalman filter

Sandrine LUNVEN lunven at tac-financial.com
Mon Nov 3 14:29:24 CET 2008


Hi,

Following my previous e-mail on the filter Kalman, I present below my
program.
I work on the following serie:

library(dlm)
library(RODBC)

gdp <-
c(5.534909,6.614441,5.873702,6.310751,7.468986,4.077912,7.544475,8.875515,2.
120741,9.113842,6.631629,
		8.015583,11.200762,1.142806,-4.347483,6.900087,5.602605,2.815967,5.638978,
4.589273,1.6181,2.135441,
		-0.173115,-1.879962,2.807475,4.14091,6.381407,7.48905,6.440708,3.950465,4.
368215,1.089476,-2.043243,
		0.964818,4.282739,3.623547,4.189648,4.760812,3.935963,3.924775,2.016109,0.
762735,-0.743436,1.340256,
		0.468976,1.31187)
gdp <- ts(gdp)


armaMod	<-  dlmModARMA(ar=c(0.45,-0.06),ma=NULL,  sigma2=1,
c(0,0),1e+07*diag(2))
armaFilt	<-  dlmFilter(gdp,armaMod)
armaSmooth	<-  dlmSmooth(armaFilt)

Thank  you in advance for your help,

Sandrine



More information about the R-SIG-Finance mailing list