Description Usage Arguments Value Author(s) See Also Examples
Use a glm-style formula and family arguments to setup a state space model.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ssm(formula, family = gaussian, data = list(), subset =
NULL, fit = TRUE, phi = NULL, m0 = NULL, C0 = NULL,
Fmat = NULL, Gmat = NULL, Vmat = NULL, Wmat = NULL)
## S3 method for class 'ssm'
C0(ssm)
## S3 method for class 'ssm'
m0(ssm)
## S3 method for class 'ssm'
Fmat(ssm)
## S3 method for class 'ssm'
Gmat(ssm)
## S3 method for class 'ssm'
Vmat(ssm)
## S3 method for class 'ssm'
Wmat(ssm)
## S3 method for class 'ssm'
phi(ssm)
## S3 replacement method for class 'ssm'
C0(ssm) <- value
## S3 replacement method for class 'ssm'
m0(ssm) <- value
## S3 replacement method for class 'ssm'
Fmat(ssm) <- value
## S3 replacement method for class 'ssm'
Gmat(ssm) <- value
## S3 replacement method for class 'ssm'
Vmat(ssm) <- value
## S3 replacement method for class 'ssm'
Wmat(ssm) <- value
## S3 replacement method for class 'ssm'
phi(ssm) <- value
getFit(ssm)
|
formula |
a formula with univariate response on the lefthand
side. The righthand side is a sum of terms and the special functions
|
family |
a description of the error distribution and link function to
be used in the model. This can be a character string naming a
family function, a family function or the result of a call to
a family function. (See |
data |
an optional data frame containing the variables in the model.
If not found in |
subset |
an optional vector specifying a subset of observations to be used in the fitting process. |
ssm |
an object of class |
fit |
a logical. If |
phi |
a vector of initial values of hyperparamters. Note
that these have to be in the right order. Best advice is to
leave this option to be |
m0 |
a vector with the initial state vector. |
C0 |
a matrix with the variance matrix of the initial state. |
Fmat |
a function giving the regression matrix at a given timepoint. |
Gmat |
a function giving the evolution matrix at a given timepoint. |
Wmat |
a function giving the evolution variance matrix at a given timepoint. |
Vmat |
a function giving the observation variance matrix at a given timepoint. |
value |
an object to be assigned to the element of the state space model. |
An object of class ssm
with the following components
ss |
an object of class |
Claus Dethlefsen and Søren Lundbye-Christensen.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | data(vandrivers)
vandrivers$y <- ts(vandrivers$y,start=1969,frequency=12)
vd.time <- time(vandrivers$y)
vd <- ssm( y ~ tvar(1) + seatbelt + sumseason(vd.time,12),
family=poisson(link="log"),
data=vandrivers,
phi = c(1,0.0004),
C0=diag(13)*100,
fit=FALSE
)
phi(vd)["(Intercept)"] <- exp(- 2*3.703307 )
C0(vd) <- diag(13)*1000
vd.res <- kfs(vd)
plot( vd.res$m[,1:3] )
attach(vandrivers)
plot(y,ylim=c(0,20))
lines(exp(vd.res$m[,1]+vd.res$m[,2]*seatbelt),lwd=2 )
detach(vandrivers)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.