Learn R Programming

timsac (version 1.3.0)

optsim: Optimal Control Simulation

Description

Perform optimal control simulation and evaluate the means and variances of the controlled and manipulated variables X and Y.

Usage

optsim(y, max.order=NULL, ns, q, r, noise=NULL, len, plot=TRUE)

Arguments

y
a multivariate time series.
max.order
upper limit of model order. Default is $2 \sqrt{n}$, where $n$ is the length of the time series y.
ns
number of steps of simulation.
q
positive definite matrix $Q$.
r
positive definite matrix $R$.
noise
noise. If not provided, Gaussian vector white noise with the length len is generated.
len
length of white noise record.
plot
logical. If TRUE (default) controlled variables $X$ and manipulated variables $Y$ are plotted.

Value

  • transfirst $m$ columns of transition matrix, where $m$ is the number of controlled variables.
  • gammagamma matrix.
  • gaingain matrix.
  • convarcontrolled variables $X$.
  • manvarmanipulated variables $Y$.
  • xmeanmean of $X$.
  • ymeanmean of $Y$.
  • xvarvariance of $X$.
  • yvarvariance of $Y$.
  • x2sumsum of $X^2$.
  • y2sumsum of $Y^2$.
  • x2meanmean of $X^2$.
  • y2meanmean of $Y^2$.

References

H.Akaike and T.Nakagawa (1988) Statistical Analysis and Control of Dynamic Systems. Kluwer Academic publishers.

Examples

Run this code
# Multivariate Example Data
  ar <- array(0,dim=c(3,3,2))
  ar[,,1] <- matrix(c(0.4,  0,   0.3,
                      0.2, -0.1, -0.5,
                      0.3,  0.1, 0),3,3,byrow=TRUE)
  ar[,,2] <- matrix(c(0,  -0.3,  0.5,
                      0.7, -0.4,  1,
                      0,   -0.5,  0.3),3,3,byrow=TRUE)
  x <- matrix(rnorm(200*3),200,3)
  y <- mfilter(x,ar,"recursive")
  q <- matrix(c(0.16,0,0,0.09), 2, 2)
  r <- matrix(0.001, 1, 1)
  optsim(y, max.order=10, ns=20, q, r, len=20)

Run the code above in your browser using DataLab