Welcome State space notation Functions > ckal.fil.po.gam.id
Last update Jul 10, 2004

DESCRIPTION:

Conjugated Kalman filter for Poisson data assuming identity link and partially specified linear latent process. The conjugate prior on the mean parameter is gamma. The specific model is
Observation equation:
(yt | ht)
~
Po(mt),
Signal:
lt
=
FtTqt,
System equation:
qt
=
Gtqt-1 + wt,
    wt
~
[0,Wt],
Initial prior:
q0
~
[m0,C0].

USAGE:

      ckal.fil.po.gam.id(ssm)

REQUIRED ARGUMENTS:

ssm:
Object of class ssm (state space model).
The following attributes must be specified in ssm:
Yt:
1 × n vector containing the Poisson observations.
Ft:
Function returning a p × 1 design vector.
Gt:
Function returning a p × p evolution transfer matrix.
Wt:
Function returning a p × p evolution variance matrix.
m0:
p × 1 vector (prior mean).
C0:
p × p matrix (prior variance).

OPTIONAL ARGUMENTS:

The following attributes of the ssm object might be needed:
Xt:
Matrix containing the covariates needed in Ft, Gt and/or Wt. This matrix must have n rows, such that row t contains the covariates needed for generating the system matrices at time t.
psi:
Parameter vector must be supplied if it is needed in the calculation of the system matrices.
The following attributes of the ssm object are optional:
fam:
Tacitly assumed to have value Poisson.
link:
Tacitly assumed to have value identity.
m.start:
Not used in the conjugate filter.

VALUE:

Returns an object of class ssm with the same attributes as the object in the call, but with attribute filtered updated with:
mt:
Posterior means mt given the observations up to and including time t. These are arranged row-wise in a matrix.
Ct:
Posterior variances Ct given the observations up to and including time t. These are arranged in a 3-dimensional array such that Ct is placed in filtered$Ct[,,t].
Rt:
Prior variances for the states arranged in 3-dimensional array such that Rt is placed in filtered$Rt[,,t]. The reason for returning these is that they are needed in the Kalman smoother.
The returned object can the be given as argument to the Kalman smoother.

SIDE EFFECTS:

None

DETAILS:

This is the conjugate filter introduced for the class of dynamic generalized linear models by West, Harrison and Migon (1985). Instead of approximating the observational model with a Gaussian one like in the extended Kalman filter, the latent process guides the choice of the conjugate prior on the natural parameter.

REFERENCES:

Klein, (2003), State Space Models for Exponential Family Data, Ph.D. Thesis, Department of Statistics, University of Southern Denmark.
West & Harrison, (1997), Bayesian Forecasting and Dynamic Models, Springer Series in Statistics.
West, Harrison & Migon, (1985),Dynamic Generalized Linear Models and Bayesian Forecasting (with discussion), Journal of the American Statistical association, 80, 73-97.

EXAMPLES:

# Specify a state space model
# Latent process is local linear growth
ss <- ssm(Ft = function(i,x,phi)  
                       {c(1,0)},
          Gt = function(i,x,phi)  
                       {matrix(c(1,1,0,1),ncol=2,byrow=T)},
          Wt = function(i,x,phi)  
                       {diag(2)/100},
          m0 = c(15,0),
          C0 = diag(10,2),
          fam = "Poisson",
          link = "identity")

# Simulate Poisson observations
ss <- simulate.ssm(ss, n=50)

# Apply the conjugated Kalman filter
ss <- ckal.fil.po.gam.id(ss)

plot(ss$filtered$mt[,1],
     ylab="mean", lty=1, type="l", 
     ylim=c(0,max(ss$Yt)))
lines(ss$simulated$theta[,1], lty=2)
points(ss$Yt, pch=16)
legend(0,max(ss$Yt),legend=c("Filtered mean",
                             "Simulated mean","Yt"), 
       lty=c(1,2,-1), marks=c(-1,-1,16))
title("Results from ckal.fil.po.gam.id")