Learn R Programming

DMQ (version 0.1.2)

SimulateDMQ: Simulate from the DMQ model

Description

Approximate simulation from the DMQ model. Allows to simulate quantiles and observations.

Usage

SimulateDMQ(iT, vQ_0, vTau, iTau_star, vPn, ScalingType = "InvSqrt", fSim = NULL)

Value

A list with two elements:

vY

A numeric vector of T simulated observations.

mQ

A numeric TxJ matrix of simulated quantiles.

Arguments

iT

Number of observations to simulate.

vQ_0

numeric vector of limiting quantiles.

vTau

numeric vector of length Jx1 containing probability levels at which quantiles are estimated.

iTau_star

Integer indicating the position in vTau where the reference quantile is placed. For instance, if vTau = seq(0.01, 0.99, 0.01) then iTau_star = 50 means that the median is used as the reference quantile.

vPn

numeric named vector of length 4x1 with starting values for the optimizer. For example vPn = c("phi" = 0.9, "gamma" = 0.05, "alpha" = 0.01, "beta" = 0.7).

ScalingType

character Indicating the scaling mechanism for the conditional quasi score. Possible choices are "Identity", "Inv","InvSqrt". When ScalingType = "InvSqrt" quasi scores are scaled by their standard deviation. When ScalingType = "Inv" quasi scores are scaled by their variance. When ScalingType = "Identity" quasi scores are not scaled. Default value ScalingType = "InvSqrt".

fSim

function to simulate from the discretized distribution implied by the simulated quantiles. By default fSim = NULL meaning that an internal simulation scheme is employed. See details.

Author

Leopoldo Catania

Details

Given a set of simulated quantiles a Uniform variable drawn. The discretized quantile function is linearly interpoled at the simulated Uniform draw to obtain an observations. When the Uniform draw is outside the range spanned by vTau a Gaussian quantile function is used. The mean and variance of the Gaussian quantile distribution are set to those implied by the simulated quantiles using the same scheme of MomentsDMQ.

Examples

Run this code

set.seed(123)

# Simulate 500 observations from the DMQ model.

# Use the percentiles
vTau = seq(0.01, 0.99, 0.01)

# Median as reference quantile
iTau_star = 50

# Standard Gaussian limiting distribution
vQ_0 = qnorm(vTau)

# vector of parameters
vPn = c("phi" = 0.95, "gamma" = 0.10, "alpha" = 0.01, "beta" = 0.7)

lSim = SimulateDMQ(iT = 500, vQ_0, vTau, iTau_star, vPn)

plot.ts(lSim$vY)
plot.ts(lSim$mQ, plot.type = "single")

Run the code above in your browser using DataLab