Learn R Programming

atRisk (version 0.2.0)

f_compile_quantile: Estimation of quantiles

Description

Predicted values based on each quantile regression (Koenker and Basset, 1978), at time=t_trgt, for each quantile in qt_trgt.

Usage

f_compile_quantile(qt_trgt, v_dep, v_expl, newdata = NULL)

Value

A list with the following elements:

quantile_target

Numeric vector, dim k, of k quantiles for different qt-estimations.

results_qt

Numeric matrix with all the predicted values based on each quantile regression, where each column corresponds to a quantile target. This matrix includes out-of-sample values of the dependent variable if `newdata` is specified.

Arguments

qt_trgt

Numeric vector, dim k, of k quantiles for different qt-estimations

v_dep

Numeric vector of the dependent variable

v_expl

Numeric vector or matrix of the (k) explanatory covariate(s)

newdata

Numeric optional vector of the (k) out of sample explanatory covariate(s)

References

Koenker, Roger, and Gilbert Bassett Jr. "Regression quantiles." Econometrica: journal of the Econometric Society (1978): 33-50.

Examples

Run this code
# Import data
data("data_euro")

# Data process
PIB_euro_forward_4 = data_euro["GDP"][c(5:length(data_euro["GDP"][,1])),]
FCI_euro_lag_4 = data_euro["FCI"][c(1:(length(data_euro["GDP"][,1]) - 4)),]
CISS_euro_lag_4 = data_euro["CISS"][c(1:(length(data_euro["GDP"][,1]) - 4)),]

quantile_target <- as.vector(c(0.10,0.25,0.75,0.90))
results_quantile_reg <- f_compile_quantile(qt_trgt=quantile_target,
v_dep=PIB_euro_forward_4,
v_expl=as.matrix(cbind(FCI_euro_lag_4, CISS_euro_lag_4)))

Run the code above in your browser using DataLab