Method returning the probability integral transform (PIT).
PIT(object, ...)# S3 method for MSGARCH_SPEC
PIT(object, x = NULL, par = NULL, data = NULL,
do.norm = FALSE, do.its = FALSE, n.ahead = 1L, ctr = list(), ...)
# S3 method for MSGARCH_ML_FIT
PIT(object, x = NULL, new.data = NULL,
do.norm = TRUE, do.its = FALSE, n.ahead = 1L, ctr = list(), ...)
# S3 method for MSGARCH_MCMC_FIT
PIT(object, x = NULL, new.data = NULL,
do.norm = TRUE, do.its = FALSE, n.ahead = 1L, ctr = list(), ...)
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 PIT
.
Vector (of size n). Used when do.its = FALSE
.
Vector (of size d) or matrix (of size n.mcmc
x d) of
parameter estimates where d must have
the same length as the default parameters of the specification.
Vector (of size T) of observations.
Logical indicating if the PIT values are transformed
into standard Normal variate. (Default: do.norm = FALSE
)
Logical indicating if the in-sample PIT is returned. (Default: do.its = FALSE
)
Scalar indicating the number of step-ahead evaluation.
Valid only when do.its = FALSE
. (Default: n.ahead = 1L
)
A list of control parameters:
n.sim
(integer >= 0):
Number indicating the number of simulation done for the
evaluation of the PIT at n.ahead > 1
. (Default: n.sim = 10000L
)
Vector (of size T*) of new observations. (Default new.data = NULL
)
A vector or matrix of class MSGARCH_PIT
.
If do.its = FALSE
: Probability integral transform of the
points x
at t = T + T* + 1, ... ,t = T + T* + n.ahead
or Normal variate derived from the probability
integral transform of x
(matrix of size n.ahead
x n).
If do.its = TRUE
: In-sample probability integral transform or Normal variate
derived from the probability integral transform of data
if x = NULL
(vector of
size T + T*) or in-sample probability integral transform or Normal variate
derived from the probability integral transform of x
(matrix of size (T + T*) x n).
If a matrix of MCMC posterior draws is given, the
Bayesian probability integral transform is calculated.
Two or more step-ahead probability integral
transform are estimated via simulation of n.sim
paths up to t = T + T* + n.ahead
.
The empirical probability integral transforms is then inferred from these simulations.
If do.its = FALSE
, the vector x
are evaluated as t = T + T* + 1, ... ,t = T + T* + n.ahead
realizations.
If do.its = TRUE
, x
is evaluated
at each time t
up to time t = T + T*
.
Finally if x = NULL
the vector data
is evaluated for sample evaluation of the PIT.
The do.norm
argument transforms the PIT value into Normal variates so that normality test can be done.
# NOT RUN {
# load data
data("SMI", package = "MSGARCH")
# create model specification
# MS(2)-GARCH(1,1)-Normal (default)
spec <- CreateSpec()
# fit the model on the data by ML
fit <- FitML(spec = spec, data = SMI)
# run PIT method in-sample
pit.its <- PIT(object = fit, do.norm = TRUE, do.its = TRUE)
# diagnostic of PIT with qqnorm
qqnorm(pit.its)
qqline(pit.its)
# simulate a serie from the model
set.seed(123)
sim.series <- Sim(object = spec, par = fit$par, n.ahead= 1000L, n.sim = 1L)
sim.series <- as.vector(sim.series$draw)
# run PIT method on the simualed serie with the true par
pit.x <- PIT(object = spec, par = fit$par, data = sim.series, do.norm = TRUE, do.its = TRUE)
qqnorm(pit.x)
qqline(pit.x)
# }
Run the code above in your browser using DataLab