SS.solve {SSsimple} | R Documentation |
Optimal Estimation
Description
Solve a state space system using the Kalman Filter
Usage
SS.solve(Z, F, H, Q, R, length.out, P0, beta0=0)
Arguments
Z |
A T x n data matrix. |
F |
The state matrix. A scalar, or vector of length d, or a d x d matrix. When scalar, |
H |
The measurement matrix. Must be n x d. |
Q |
The state variance. A scalar, or vector of length d, or a d x d matrix. When scalar, |
R |
The measurement variance. A scalar, or vector of length n, or an n x n matrix. When scalar, |
length.out |
Scalar integer. |
P0 |
Initial a priori prediction error. |
beta0 |
Initial state value. A scalar, or a vector of length d. |
Details
H
is the master argument from which system dimensionality is determined.
Value
A named list.
B.apri |
A T x d matrix, the ith row of which is the best state estimate prior to observing data at time i. |
B.apos |
A T x d matrix, the ith row of which is the best state estimate given the observation at time i. |
Note
For a definition of the system of interest, please see SSsimple
.
Examples
set.seed(999)
H <- matrix(1)
x <- SS.sim( 1, H, 1, 1, 100, 0 )
y <- SS.solve( x$Z, 1, H, 1, 1, 100, 10^5, 0 )
z.hat <- t( H %*% t( y$B.apri ) )
plot( x$Z, type="l", col="blue" )
points( z.hat[ ,1], type="l", col="red" )