Learn R Programming

SSsimple (version 0.6.6)

SS.sim.chol: Simulation

Description

Simulate a state space system by supplying measurement variance Cholesky decomposition

Usage

SS.sim.chol(F, H, Q, R.chol, length.out, beta0=0)

Arguments

F

The state matrix. A scalar, or vector of length d, or a d x d matrix. When scalar, F is constant diagonal. When a vector, F is diagonal.

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, Q is constant diagonal. When a vector, Q is diagonal.

R.chol

The Cholesky decomposition of the measurement variance (must possess pivot), must be n x n.

length.out

Scalar integer.

beta0

Initial state value. A scalar, or a vector of length d.

Value

A named list.

Beta

A T x d matrix, the ith row of which is the state at time i.

Y

A T x n matrix, the ith row of which is the noiseless observation at time i.

Z

A T x n matrix, the ith row of which is the observation at time i.

Details

H is the master argument from which system dimensionality is determined. Spiritually identical to SS.sim. This method can be used to speed up simulating multiple systems with the same parameterization.

Examples

Run this code
# NOT RUN {
tau <- 30	
	
x <- I( 0:10 / 10 )

H <- H.omega.sincos( x, c( 1*pi, 4*pi ) )

R <- diag(7, length(x))
R.chol <- chol(R, pivot=TRUE)

xs <- SS.sim.chol( 0.99, H, 1, R.chol, tau, rep(0, ncol(H)) )

# }
# NOT RUN {
for(i in 1:nrow(xs$Z)) {
	plot(x, xs$Z[ i, ], ylim=range(xs$Z), main=i)
	Sys.sleep(1/10)
}
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab