WORK IN PROGRESS
The tvRRR package implements time-varying reduced rank regression as proposed in A state-space approach to time-varying reduced-rank regression (Work in progress, Brune, Bura and Scherrer).
The development version can be installed from GitHub with:
if (!require(devtools)) {
install.packages("devtools")
}
devtools::install_github("b-brune/tvRRR")
We fit a reduced-rank regression with time-varying coefficient matrices. We implement two types of time-variation, called model (A) and model (B):
(A) yt = αtβ′xt + Γut + εt
(B) yt = αβt′xt + Γut + εt
Model fitting is carried out using a Gaussian linear state-space model and the Kalman filter.
The function dataset()
draws data from models (A) and (B) with
different specifications of the time-variation in the parameter matrix.
library(tvRRR)
set.seed(712)
dat <- dataset("VARbreak", p = 5, d = 2, q = 5, t = 100, model = "A")
X <- dat$X; y <- dat$y
The main function of the dataset is tvRRR()
. It automatically selects
the rank of the model using BIC (in case it is unknown) and fits the
tvRRR model.
fit <- tvRRR(X = X, y = y, select_rank = TRUE, d_max = 5, silent = TRUE,
model = "A")
fit
#> Time-varying reduced rank regression model of type A with latent rank d = 2
#>
#> Convergence information:
#>
#> Model selected based on BIC
#>
#> Tried d = 1 to d = 5
#> Rank selected: d = 2 with BIC 558.277561
#>
#> Model diagnostics / Convergence information
#>
#> Algorithm stopped after 29 iterations.
#> Relative likelihood difference: 0.000378
#> Difference in Omega: 0.000968
#> Difference in beta: 0.00052
#> Difference in Sigma: 0.000436
#>
#> Estimated state covariance matrix:
#>
#> [,1] [,2]
#> [1,] 0.047435252 -0.003688764
#> [2,] -0.003688764 0.086516325
tvRRR()
returns a list of the filtered time-varying parameters
(one-step-ahead, filtered and smoothed), as well as the fitted
parameters and some information on the data log-likelihood and
convergence.
For more information on the model fitting algorithm see the paper, the accompanying vignette, and the function’s documentation.
We are grateful for any contribution to the further development of the R package. If you experience any problems using the package or have suggestions for new features, please open an issue in the issue tracker.
Barbara Brune ( b-brune ) - TU Wien, Vienna, Austria
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.