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 MSGARCH_SPEC created with CreateSpec
or fit object of type MSGARCH_ML_FIT created with FitML or MSGARCH_MCMC_FIT
created with FitMCMC.
...: Not used. Other arguments to PredPdf.
x: Vector (of size n). Used when do.its = FALSE.
par: Vector (of size d) or matrix (of size nmcmc x d) of parameter estimates where d must have the same length as the default parameters of the specification.
data: Vector (of size T) of observations.
log: Logical indicating if the log-density is returned. (Default: log = FALSE)
do.its: Logical indicating if the in-sample predictive is returned. (Default: do.its = FALSE)
nahead: Scalar indicating the number of step-ahead evaluation. Valid only when do.its = FALSE. (Default: nahead = 1L)
do.cumulative: Logical indicating if predictive density is computed on the cumulative simulations (typically log-returns, as they can be aggregated). Only available for do.its = FALSE. (Default: do.cumulative = FALSE)
ctr: A list of control parameters:
nsim (integer >= 0) : Number indicating the number of simulation done for the evaluation of the density at nahead > 1. (Default: nsim = 10000L)
newdata: Vector (of size T*) of new observations. (Default newdata = NULL)
Returns
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).
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).
Examples
# create model specificationspec <- CreateSpec()# load datadata("SMI", package ="MSGARCH")# fit the model on the data by MLfit <- FitML(spec = spec, data = SMI)# run PredPdf method in-samplepred.its <- PredPdf(object = fit, log =TRUE, do.its =TRUE)# create a meshx <- seq(-3,3,0.01)# run PredPdf method on mesh at T + 1pred.x <- PredPdf(object = fit, x = x, log =TRUE, do.its =FALSE)