Learn R Programming

SSsimple (version 0.6.6)

SS.ID: System Identification

Description

Perform non-iterative, subspace grey-box system identification

Usage

SS.ID(Z, d, rsN = NULL)

Arguments

Z

A T x n data matrix

d

A scalar integer. The system ``order.''

rsN

A 3-element integer vector, containing r, s, N as described by Ljung.

Value

A named list.

F.hat

A d x d matrix.

H.hat

An n x d matrix.

Q.hat

A d x d matrix.

R.hat

An n x n matrix.

Details

Only works when T >> n (one resolved to using SS.ID when this is not true is free to pluck columns from Z until it is).

Complaints issued from this function to the effect that a matrix that is some function of ``PP'' cannot be inverted might be remedied by turning r and s down (the first two elements of the rsN argument), or perhaps by adding a small amount of noise to Z.

This is subspace estimation. SS.ID estimates system hyperparameters from data. One can usually henceforth solve (using SS.solve) for good quality observation-space estimates, but should not assume the resulting state estimates are anywhere near truth. One may wish to use estimates generated with this function as initial values for iterative estimation techniques, e.g., package Stem.

References

Lennart Ljung. System Identification, Theory for the User. Prentice Hall, 1999.

Examples

Run this code
# NOT RUN {
Q <- diag(1/10, 2)
R <- diag(2, 3)
H <- matrix(1, 3, 2)
F <- diag(0.99, 2)

set.seed(9999)
xs <- SS.sim(F, H, Q, R, 2000, rep(0, 2))

## notice that while the parameter estimates appear somewhat inaccurate ...
ssid <- SS.ID( xs$Z , 2,  c(3, 6, 900) ) ; ssid

## the observation estimate:
sss <- SS.solve( xs$Z, ssid$F.hat, ssid$H.hat, ssid$Q.hat, ssid$R.hat, nrow(xs$Z), 10^5, c(0,0)) 
Z.hat <- t( ssid$H.hat %*% t( sss$B.apri ) )
sqrt( mean( (xs$Z - Z.hat)^2 ) )

## is nontheless very close to that using true hyperparameter values:
sss.true <- SS.solve( xs$Z, F, H, Q, R, nrow(xs$Z), 10^5, c(0,0)) 
Z.hat <- t( H %*% t( sss.true$B.apri ) )
sqrt( mean( (xs$Z - Z.hat)^2 ) )
# }

Run the code above in your browser using DataLab