DESCRIPTION:
Creates an instance of the class ssm (state space model).
USAGE:
ssm(Ft=function(i, x, phi),
Gt=function(i, x, phi),
Vt=NA,
Wt=function(i, x, phi),
Xt=NA,
phi=NA,
m0,
C0,
Yt=NA,
nt=NA,
fam="Gaussian",
link="identity",
m.start=NA)
REQUIRED ARGUMENTS:
The following attributes must be specified for all state space model objects:
- Ft:
- Function returning a p × 1 design vector for
binomial, Gaussian and Poisson data. If the data is multinomial the
function must return a p × (k-1) design matrix, where k is
the number of categories.
- 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).
- fam:
- The distribution of the observations. Choices are
binomial, Poisson, Gaussian, and
multinomial.
- link:
- The link function between the mean and the
signal. The possible choices are given in the table below.
OPTIONAL ARGUMENTS:
The following attributes of the ssm object might be needed:
- Yt:
- A 1 × n vector of observations in the
Gaussian, binomial and Poisson case. In the case of multinomial data
with k categories, Yt must be an n × k matrix
containing the multinomial observations arranged row-wise. If data
is not supplied (i.e. Yt=NA) a time series can be simulated
using simulate.ssm. This is done if
the iterated extended Kalman filter and smoother
ieks is applied to an ssm object without
observations.
- nt:
- . This must be specified for binomial and multinomial
observations. In that case it should be a 1 × n vector containing
the number of trials at each time-point
- Vt:
- Function returning the observation variance (only
needed for Gaussian observations).
- 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:
- m.start:
- Used to specify the Taylor expansion points.
These are not meant to be set by the user. Applying the
Kalman smoother on a ssm object
that has been filtered will set the m.start attribute to the
smoothed states.
VALUE:
Returns an object of class ssm with the specified attributes.
SIDE EFFECTS:
None.
DETAILS:
This object is used in the implemented filters and the Kalman smoother.
REFERENCES:
Klein, (2003), State Space Models for Exponential Family Data,
Ph.D. Thesis, Department of Statistics, University of Southern Denmark.
EXAMPLES:
# Specify a state space model
ss <- ssm(Ft = function(i,x,phi)
{c(1,1)},
Gt = function(i,x,phi)
{matrix(c(0.8,0,0,0),ncol=2,byrow=T)},
Wt = function(i,x,phi)
{diag(2)/2},
m0 = c(0,0),
C0 = diag(10,2),
nt = rep(10,50),
fam = "binomial",
link = "logit")
# Produce summary of the specified model
summary(ss)
|