prep.matrixDynamics | R Documentation |
Recipe function for creating Linear Dynamics using matrices
prep.matrixDynamics(params.dyn = NULL, values.dyn, params.exo = NULL,
values.exo = NULL, params.int = NULL, values.int = NULL, covariates,
isContinuousTime)
params.dyn |
the matrix of parameter names for the transition matrix in the specified linear dynamic model |
values.dyn |
the matrix of starting/fixed values for the transition matrix in the specified linear dynamic model |
params.exo |
the matrix of parameter names for the regression slopes of covariates on the latent variables (see details) |
values.exo |
matrix of starting/fixed values for the regression slopes of covariates on the latent variables (see details) |
params.int |
vector of names for intercept parameters in the dynamic model specified as a matrix or list of matrices. |
values.int |
vector of intercept values in the dynamic model specified as matrix or list of matrices. Contains starting/fixed values of the intercepts. |
covariates |
the names or the index numbers of the covariates used in the dynamic model |
isContinuousTime |
logical. When TRUE, use a continuous time model. When FALSE use a discrete time model. |
A recipe function for specifying the deterministic portion of a set of linear dynamic functions as:
Discrete-time model: eta(t+1) = int + dyn*eta(t) + exo*x(t), where eta(t) is a vector of latent variables, x(t) is a vector of covariates, int, dyn, and exo are vectors and matrices specified via the arguments *.int, *.dyn, and *.exo.
Continuous-time model: d/dt eta(t) = int + dyn*eta(t) + exo*x(t), where eta(t) is a vector of latent variables, x(t) is a vector of covariates, int, dyn, and exo are vectors and matrices specified via the arguments *.int, *.dyn, and *.exo.
The left-hand side of the dynamic model consists of a vector of latent variables for the next time point in the discrete-time case, and the vector of derivatives for the latent variables at the current time point in the continuous-time case.
For models with regime-switching dynamic functions, the user will need to provide a list of the *.int, *.dyn, and *.exo arguments. (when they are specified to take on values other than the default of zero vectors and matrices), or if a single set of vectors/matrices are provided, the same vectors/matrices are assumed to hold across regimes.
prep.matrixDynamics
serves as an alternative to prep.formulaDynamics
.
Object of class 'dynrDynamicsMatrix'
Methods that can be used include: print
, show
#Single-regime, continuous-time model. For further details run:
#demo(RSNonlinearDiscrete, package="dynr"))
dynamics <- prep.matrixDynamics(
values.dyn=matrix(c(0, -0.1, 1, -0.2), 2, 2),
params.dyn=matrix(c('fixed', 'spring', 'fixed', 'friction'), 2, 2),
isContinuousTime=TRUE)
#Two-regime, continuous-time model. For further details run:
#demo(RSNonlinearDiscrete, package="dynr"))
dynamics <- prep.matrixDynamics(
values.dyn=list(matrix(c(0, -0.1, 1, -0.2), 2, 2),
matrix(c(0, -0.1, 1, 0), 2, 2)),
params.dyn=list(matrix(c('fixed', 'spring', 'fixed', 'friction'), 2, 2),
matrix(c('fixed', 'spring', 'fixed', 'fixed'), 2, 2)),
isContinuousTime=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.