View source: R/utilities_fsvdraws.R
predloglikWB | R Documentation |
predloglikWB
approximates the predictive log likelihood exploiting
the factor structure and using the Woodbury idenitity and the
corresponding matrix determinant lemma. This is recommended only
if many series and few factors are present.
predloglikWB(x, y, ahead = 1, each = 1, alldraws = FALSE)
x |
Object of class |
y |
Matrix of dimension |
ahead |
Vector of timepoints, indicating how many steps to predict ahead. |
each |
Single integer (or coercible to such) indicating how often should be drawn from the posterior predictive distribution for each draw that has been stored during MCMC sampling. |
alldraws |
Should all the draws be returned or just the final results? (Can be useful to assess convergence.) |
Vector of length length(ahead)
with log predictive
likelihoods.
Currently crudely implemented as a triple loop in pure R, may be slow.
Uses predprecWB
. If m
is small
or many factors are used, consider also using
predcov
.
Other predictors:
predcond()
,
predcor()
,
predcov()
,
predh()
,
predloglik()
,
predprecWB()
set.seed(1)
# Simulate a time series of length 1100:
sim <- fsvsim(n = 1100, series = 3, factors = 1)
y <- sim$y
# Estimate using only 1000 days:
res <- fsvsample(y[seq_len(1000),], factors = 1)
# Evaluate the 1, 10, and 100 days ahead predictive log
# likelihood:
ahead <- c(1, 10, 100)
scores <- predloglikWB(res, y[1000+ahead,], ahead = ahead, each = 10)
print(scores)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.