Description Usage Arguments Value Examples
View source: R/multimove_gibbs.R
The Multi-Move Gibbs sampler applies the kalman filter by forward and backwards filtering.
1 | multimove_gibbs(yt, phi, Q, lambda, const, Tt, q, alpha_0, P_0, R)
|
yt |
A matrix of demeaned and standardized time series data. |
phi |
Diagoanl matrix of dimension k x k with vector autoregressive coefficients. |
Q |
A matrix of . |
lambda |
A vector of dimension n x k of the factor loadings. |
const |
A scalar, where const = 1 for model with intercept, const = 0 for model without intercept. |
Tt |
Number of high-frequency periods. |
q |
lag length for state equation (adjust starting value of phi accordingly). |
alpha_0 |
Vector of dimension m x 1 (Initial conditions for Kalman filter). |
P_0 |
Diagonal matrix of dimension m (Initial conditions for Kalman filter). |
R |
Diagonal matrix of dimension n of idiosyncratic component. |
A Vector of factors conditional parameters.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | q <- 1
yt <- as.matrix(t(Xmat))
n <- dim(yt)[1]
Tt <- dim(yt)[2]
k <- 2
m <- k*q
alpha_0 <- matrix(0,m,1)
P_0 <- diag(m)
const <- 0
R <- as.matrix(diag(n)*0.01)
phi <- diag(rnorm(k,0,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
Q <- as.matrix(diag(0.1,k))
matcomp <- comp_f_state(phi,Q,lambda,const)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.