Learn R Programming

SMFilter (version 1.0.3)

SimModel1: Simulate from the type one state-space Model on Stiefel manifold.

Description

This function simulates from the type one model on Stiefel manifold. See Details part below.

Usage

SimModel1(iT, mX = NULL, mZ = NULL, mY = NULL, alpha_0, beta,
  mB = NULL, Omega = NULL, vD, burnin = 100)

Arguments

iT

the sample size.

mX

the matrix containing X_t with dimension \(T \times q_1\).

mZ

the matrix containing Z_t with dimension \(T \times q_2\).

mY

initial values of the dependent variable for ik-1 up to 0. If mY = NULL, then no lagged dependent variables in regressors.

alpha_0

the initial alpha, \(p \times r\).

beta

the \(\beta\) matrix, iqx+ip*ik, y_1,t-1,y_1,t-2,...,y_2,t-1,y_2,t-2,...

mB

the coefficient matrix \(\boldsymbol{B}\) before mZ with dimension \(p \times q_2\).

Omega

covariance matrix of the errors.

vD

vector of the diagonals of \(D\).

burnin

burn-in sample size (matrix Langevin).

Value

A list containing the sampled data and the dynamics of alpha.

The object is a list containing the following components:

dData

a data.frame of the sampled data

aAlpha

an array of the \(\boldsymbol{\alpha}_{t}\) with the dimension \(T \times p \times r\)

Details

The type one model on Stiefel manifold takes the form: $$\boldsymbol{y}_t \quad = \quad \boldsymbol{\alpha}_t \boldsymbol{\beta} ' \boldsymbol{x}_t + \boldsymbol{B} \boldsymbol{z}_t + \boldsymbol{\varepsilon}_t$$ $$\boldsymbol{\alpha}_{t+1} | \boldsymbol{\alpha}_{t} \quad \sim \quad ML (p, r, \boldsymbol{\alpha}_{t} \boldsymbol{D})$$ where \(\boldsymbol{y}_t\) is a \(p\)-vector of the dependent variable, \(\boldsymbol{x}_t\) and \(\boldsymbol{z}_t\) are explanatory variables wit dimension \(q_1\) and \(q_2\), \(\boldsymbol{x}_t\) and \(\boldsymbol{z}_t\) have no overlap, matrix \(\boldsymbol{B}\) is the coefficients for \(\boldsymbol{z}_t\), \(\boldsymbol{\varepsilon}_t\) is the error vector.

The matrices \(\boldsymbol{\alpha}_t\) and \(\boldsymbol{\beta}\) have dimensions \(p \times r\) and \(q_1 \times r\), respectively. Note that \(r\) is strictly smaller than both \(p\) and \(q_1\). \(\boldsymbol{\alpha}_t\) and \(\boldsymbol{\beta}\) are both non-singular matrices. \(\boldsymbol{\alpha}_t\) is time-varying while \(\boldsymbol{\beta}\) is time-invariant.

Furthermore, \(\boldsymbol{\alpha}_t\) fulfills the condition \(\boldsymbol{\alpha}_t' \boldsymbol{\alpha}_t = \boldsymbol{I}_r\), and therefor it evolves on the Stiefel manifold.

\(ML (p, r, \boldsymbol{\alpha}_{t} \boldsymbol{D})\) denotes the Matrix Langevin distribution or matrix von Mises-Fisher distribution on the Stiefel manifold. Its density function takes the form $$f(\boldsymbol{\alpha_{t+1}} ) = \frac{ \mathrm{etr} \left\{ \boldsymbol{D} \boldsymbol{\alpha}_{t}' \boldsymbol{\alpha_{t+1}} \right\} }{ _{0}F_1 (\frac{p}{2}; \frac{1}{4}\boldsymbol{D}^2 ) }$$ where \(\mathrm{etr}\) denotes \(\mathrm{exp}(\mathrm{tr}())\), and \(_{0}F_1 (\frac{p}{2}; \frac{1}{4}\boldsymbol{D}^2 )\) is the (0,1)-type hypergeometric function for matrix.

Note that the function does not add intercept automatically.

Examples

Run this code
# NOT RUN {
iT = 50 # sample size
ip = 2 # dimension of the dependent variable
ir = 1 # rank number
iqx=2 # number of variables in X
iqz=2 # number of variables in Z
ik = 1 # lag length

if(iqx==0) mX=NULL else mX = matrix(rnorm(iT*iqx),iT, iqx)
if(iqz==0) mZ=NULL else mZ = matrix(rnorm(iT*iqz),iT, iqz)
if(ik==0) mY=NULL else mY = matrix(0, ik, ip)

alpha_0 = matrix(c(runif_sm(num=1,ip=ip,ir=ir)), ip, ir)
beta = matrix(c(runif_sm(num=1,ip=ip*ik+iqx,ir=ir)), ip*ik+iqx, ir)
if(ip*ik+iqz==0) mB=NULL else mB = matrix(c(runif_sm(num=1,ip=(ip*ik+iqz)*ip,ir=1)), ip, ip*ik+iqz)
vD = 50

ret = SimModel1(iT=iT, mX=mX, mZ=mZ, mY=mY, alpha_0=alpha_0, beta=beta, mB=mB, vD=vD)

# }

Run the code above in your browser using DataLab