| PIT {MSGARCH} | R Documentation | 
Probability integral transform.
Description
Method returning the probability integral transform (PIT).
Usage
PIT(object, ...)
## S3 method for class 'MSGARCH_SPEC'
PIT(
  object,
  x = NULL,
  par = NULL,
  data = NULL,
  do.norm = FALSE,
  do.its = FALSE,
  nahead = 1L,
  do.cumulative = FALSE,
  ctr = list(),
  ...
)
## S3 method for class 'MSGARCH_ML_FIT'
PIT(
  object,
  x = NULL,
  newdata = NULL,
  do.norm = TRUE,
  do.its = FALSE,
  nahead = 1L,
  do.cumulative = FALSE,
  ctr = list(),
  ...
)
## S3 method for class 'MSGARCH_MCMC_FIT'
PIT(
  object,
  x = NULL,
  newdata = NULL,
  do.norm = TRUE,
  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.  | 
do.norm | 
 Logical indicating if the PIT values are transformed
into standard Normal variate. (Default:   | 
do.its | 
 Logical indicating if the in-sample PIT is returned. (Default:   | 
nahead | 
 Scalar indicating the number of step-ahead evaluation.
Valid only when   | 
do.cumulative | 
 Logical indicating if the PIT 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 probability integral transform is calculated.
Two or more step-ahead probability integral
transform are estimated via simulation of nsim paths up to t = T + T* + nahead.
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* + nahead
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.
Value
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* + nahead or Normal variate derived from the probability
integral transform of x (matrix of size nahead 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).
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 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 <- simulate(object = spec, par = fit$par, nahead= 1000L, nsim = 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)