Learn R Programming

DMQ (version 0.1.2)

MomentsDMQ: Estimate conditional moments using DMQ

Description

Compute DMQ implied conditional moments. At each point in time moments are computed using the discretized distribution implied by the estimated conditional quantiles.

Usage

MomentsDMQ(Fit)

Value

A list of four elements:

mMoments

a Tx4 numeric matrix with columns containing first, second, third, and fourth moments.

mCenterdMoments

a Tx4 numeric matrix with columns containing first, second, third, and fourth central moments.

vSkew

a numeric vector of length T of estimated skewness coefficients.

vKurt

a numeric vector of length T estimated kurtosis coefficients.

Arguments

Fit

The output of the function EstimateDMQ or UpdateDMQ.

Author

Leopoldo Catania

Details

Moments are computed using the following approximation: $$\mathbb{E}[g(x)] \approx \sum_{j = 1}^J (\tau_j - \tau_{j-1}) g(\hat q_t^{\tau_j}),$$ with \(\tau_0 = 0\), where \(\hat q_t^{\tau_j}\) are estimated quantiles.

Examples

Run this code
# \donttest{
# Load Microsoft Corporation logarithmic percentage returns from December 8, 
# 2010 to November 15, 2018 for a total of T = 2000 observation
data("MSFT")

##############################################################
######################## Estimate DMQ ########################
##############################################################

# Estimate DMQ on the in sample period
Fit = EstimateDMQ(vY = vY,
                  vTau = seq(0.01, 0.99, 0.01),
                  iTau_star = 50,
                  FixReference = TRUE,
                  fn.optimizer = fn.solnp)

# Compute estimated moments

Moments = MomentsDMQ(Fit)
# }

Run the code above in your browser using DataLab