f_distrib_histo {matrisk} | R Documentation |
Historical distributions
Description
This function is based on f_distrib function (Adrian et al., 2019; Adrian et al., 2022) and is used to get historical estimation of empirical distributions and associated parameters. Results allow to realize a 3D graphical representation.
Usage
f_distrib_histo(
qt_trgt,
v_dep,
v_expl,
type_function,
starting_values,
step,
x_min,
x_max
)
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 of the (k) explanatory variable(s) |
type_function |
String argument : "gaussian" for normal distribution or "skew-t" for t-student distribution |
starting_values |
Numeric vector with initial values for optimization |
step |
Numeric argument for accuracy graphics abscissa |
x_min |
Numeric optional argument (default value = -15) |
x_max |
Numeric optional argument (default value = 10) |
Value
A list with:
distrib_histo |
Numeric matrix with historical values of x, y and t |
param_histo |
Numeric matrix containing the parameters of the distribution for each period |
References
Adrian, Tobias, Nina Boyarchenko, and Domenico Giannone. "Vulnerable growth." American Economic Review 109.4 (2019): 1263-89.
Adrian, Tobias, et al. "The term structure of growth-at-risk." American Economic Journal: Macroeconomics 14.3 (2022): 283-323.
Examples
# 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)),]
results_histo <- f_distrib_histo(qt_trgt=c(0.10,0.25,0.75,0.90), v_dep=PIB_euro_forward_4,
v_expl=cbind(FCI_euro_lag_4,CISS_euro_lag_4),
type_function="skew-t",
starting_values=c(0, 1, -0.5, 1.3),
step=5, x_min=-10, x_max=5)
library(plot3D) # load
scatter3D(results_histo$distrib_histo[,3],
results_histo$distrib_histo[,1],
results_histo$distrib_histo[,2],
pch = 10, theta = 70, phi = 10,
main = "Distribution of GDP Growth over time - Euro Area",
xlab = "Date",
ylab ="Pib",
zlab="", cex = 0.3)