SS.ID: System Identification

Description Usage Arguments Details Value References Examples

View source: R/SS.ID.R

Description

Perform non-iterative, subspace grey-box system identification

Usage

1
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.

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.

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.

References

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
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 ) )

Example output

Loading required package: mvtnorm
$F.hat
             [,1]       [,2]
[1,]  0.988184463 -0.0333389
[2,] -0.001967216 -0.5075075

$H.hat
           [,1]        [,2]
[1,] -0.3394766 -0.21561253
[2,] -0.3360091 -0.06676318
[3,] -0.3374913 -0.33400987

$Q.hat
          [,1]      [,2]
[1,] 1.6690977 0.1914837
[2,] 0.1914837 0.1104630

$R.hat
           [,1]       [,2]       [,3]
[1,]  1.6679488 -0.1852538 -0.4162877
[2,] -0.1852538  1.8676617 -0.1884310
[3,] -0.4162877 -0.1884310  1.7595779

[1] 1.578029
[1] 1.574385

SSsimple documentation built on Dec. 7, 2019, 9:06 a.m.