comp_f_state: Construct companion matrix for VAR(p) model

Description Usage Arguments Details Value Examples

View source: R/comp_f_state.R

Description

create_inventory constructs companion matrix for VAR(p) model.

Usage

1
comp_f_state(phi, Q, H, con, n, k)

Arguments

phi

Diagoanl matrix of dimension k x k with vector autoregressive coefficients.

Q

A matrix of .

H

A matrix of lambadas from Multi-Move Gibbs sampler in companion form.

con

A scalar, where con = 1 for model with intercept, con = 0 for model without intercept.

n

Number of variables.

k

Number of states (number of factors).

Details

The function runs inside the Multi-Move Gibbs sampler.

Value

A List with phi, Q, H in companion form.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
yt <- as.matrix(t(Xmat))
k <- 2
n <- dim(yt)[1]
lambdasim <- matrix(rep(rnorm(n,0,1)*0.1,k),
nrow = n, ncol = k, byrow = TRUE)
diag(lambdasim) <- 1
lambdasim[upper.tri(lambdasim)] <- 0
lambda <- lambdasim
phi <- diag(rnorm(k,0,1))
Q <- as.matrix(diag(0.1,k))
const <- 0
matcomp <- comp_f_state(phi,Q,lambda,const)

h4sci/packagr documentation built on Jan. 7, 2021, 10:40 p.m.