PredPdf {MSGARCH} | R Documentation |
Predictive density.
Description
Method returning the predictive density (pdf).
Usage
PredPdf(object, ...)
## S3 method for class 'MSGARCH_SPEC'
PredPdf(
object,
x = NULL,
par = NULL,
data = NULL,
log = FALSE,
do.its = FALSE,
nahead = 1L,
do.cumulative = FALSE,
ctr = list(),
...
)
## S3 method for class 'MSGARCH_ML_FIT'
PredPdf(
object,
x = NULL,
newdata = NULL,
log = FALSE,
do.its = FALSE,
nahead = 1L,
do.cumulative = FALSE,
ctr = list(),
...
)
## S3 method for class 'MSGARCH_MCMC_FIT'
PredPdf(
object,
x = NULL,
newdata = NULL,
log = FALSE,
do.its = FALSE,
nahead = 1L,
do.cumulative = FALSE,
ctr = list(),
...
)
Arguments
object |
Model specification of class |
... |
Not used. Other arguments to |
x |
Vector (of size n). Used when |
par |
Vector (of size d) or matrix (of size |
data |
Vector (of size T) of observations. |
log |
Logical indicating if the log-density is returned. (Default: |
do.its |
Logical indicating if the in-sample predictive is returned. (Default: |
nahead |
Scalar indicating the number of step-ahead evaluation.
Valid only when |
do.cumulative |
Logical indicating if predictive density is computed on the
cumulative simulations (typically log-returns, as they can be aggregated).
Only available for |
ctr |
A list of control parameters:
|
newdata |
Vector (of size T*) of new observations. (Default |
Details
If a matrix of MCMC posterior draws is given, the Bayesian
predictive probability density is calculated.
Two or more step-ahead predictive probability density are estimated via simulation of nsim
paths up to
t = T + T* + nahead
. The predictive distribution are then inferred from these
simulations via a Gaussian Kernel density.
If do.its = FALSE
, the vector x
are evaluated as t = T + T* + 1, ... ,t = T + T* + nahead
realization.
If do.its = TRUE
and x
is evaluated
at each time t
up top time t = T + T*
.
Finally, if x = NULL
the vector data
is evaluated for sample
evaluation of the predictive denisty ((log-)likelihood of each sample points).
Value
A vector or matrix of class MSGARCH_PRED
.
If do.its = FALSE
: (Log-)predictive of
the points x
at t = T + T* + 1, ... ,t = T + T* + nahead
(matrix of
size nahead
x n).
If do.its = TRUE
: In-sample predictive of data
if x = NULL
(vector of size T + T*) or in-sample predictive of x
(matrix of size (T + T*) x n).
Examples
# create model specification
spec <- CreateSpec()
# load data
data("SMI", package = "MSGARCH")
# fit the model on the data by ML
fit <- FitML(spec = spec, data = SMI)
# run PredPdf method in-sample
pred.its <- PredPdf(object = fit, log = TRUE, do.its = TRUE)
# create a mesh
x <- seq(-3,3,0.01)
# run PredPdf method on mesh at T + 1
pred.x <- PredPdf(object = fit, x = x, log = TRUE, do.its = FALSE)