compute_fars: Compute Factor Augmented Quantile Regressions and Stressed...

View source: R/compute_fars.R

compute_farsR Documentation

Compute Factor Augmented Quantile Regressions and Stressed Quantiles

Description

Performs quantile regressions of a dependent variable on MLDFM-extracted factors. Optionally generates quantile forecasts under stressed scenarios using hyperellipsoids.

Usage

compute_fars(
  dep_variable,
  factors,
  h = 1,
  edge = 0.05,
  scenario = NULL,
  min = TRUE,
  QTAU = 0.05
)

Arguments

dep_variable

A numeric vector representing the dependent variable (e.g., GDP growth, inflation).

factors

A matrix of factor estimates from a mldfm model.

h

Integer. Forecast horizon (in time steps) for the quantile regression. Default is 1.

edge

Numeric. Trimming amount applied to the outermost quantiles (default 0.05).

scenario

Optional list of matrices representing a stressed scenario, as returned by create_scenario().

min

Logical. If TRUE (default), implement a stepwise minimization. If FALSE, implement a stepwise maximization.

QTAU

Numeric. Quantile level (default 0.05) used to compute stressed factors via compute_stressed_factors(). Only used if scenario is provided.

Value

A list containing:

Quantiles

Matrix of forecasted quantiles (rows = time, cols = quantile levels).

Strssed_Quantiles

Matrix of stressed scenario quantiles (same format), returned only if scenario is provided.

Coeff

Matrix of quantile regression coefficients for each quantile.

Std. Error

Matrix of Std. Error for each regression coefficient.

Pvalue

Matrix of p-values for each regression coefficient.

QTAU

The quantile level used to compute stressed factors (if applicable).

Stressed_Factors

Matrix of selected stressed factors (only if scenario is provided and QTAU is set).

Examples


dep_variable <- rnorm(100)  # A numeric vector
data <- matrix(rnorm(100*300), nrow = 100, ncol = 300)
block_ind <- c(150, 300)  # Defines 2 blocks
global = 1
local <- c(1, 1)   
mldfm_result <- mldfm(data, blocks = 2, block_ind = block_ind, global = global , local = local)
fars_result <- compute_fars(dep_variable, mldfm_result$Factors, h = 1, edge = 0.05)

 
 

FARS documentation built on Aug. 8, 2025, 7:33 p.m.