compute_stressed_factors: Compute Stressed Factors

View source: R/compute_stressed_factors.R

compute_stressed_factorsR Documentation

Compute Stressed Factors

Description

Computes stressed factors.

Usage

compute_stressed_factors(
  dep_variable,
  factors,
  ellipsoids,
  h = 1,
  qtau = 0.05,
  direction = c("min", "max")
)

Arguments

dep_variable

Numeric vector of length T representing the dependent variable (e.g., GDP growth, inflation).

factors

Numeric matrix or data frame of dimension T x r, containing factor estimates.

ellipsoids

List of matrices. Each matrix represents a stressed ellipsoid for a given time period.

h

Integer (>= 1). Lag order used in the regression (default = 1)

qtau

Numeric between 0 and 1. The quantile level used in quantile regression (default = 0.05).

direction

Character, either "min" or "max". Determines whether to minimize or maximize

Value

A numeric matrix of dimension T x r containing the stressed factors for each time period.

Examples

set.seed(42)
T <- 100; r <- 3
Y <- rnorm(T)
F <- matrix(rnorm(T * r), T, r)          
E <- replicate(T, matrix(rnorm(50 * r), nrow = 50, ncol = r), simplify = FALSE)
stressed_factors <- compute_stressed_factors(Y, F, E, h = 1, qtau = 0.05, direction = "min")


FARS documentation built on Feb. 17, 2026, 5:06 p.m.