Learn R Programming

FARS (version 0.7.1)

create_scenario: Create Stressed Scenarios

Description

Constructs hyperellipsoids around MLDFM factor estimates using subsampling. These regions capture estimation uncertainty and allow for the simulation of stressed scenarios.

Usage

create_scenario(model, subsamples, alpha = 0.95, fpr = FALSE)

Value

An object of class fars_scenario, which is a list containing:

ellipsoids

List of matrices defining the hyperellipsoids at each time.

center

Matrix of factor estimates (centers of the ellipsoids).

sigma

List of covariance matrices used to define the ellipsoids.

periods

Number of time observations.

n_points

Number of points used to define each ellipsoid.

alpha

Confidence level for the hyperellipsoids.

call

Function call.

Arguments

model

An object of class mldfm, containing the factor estimates.

subsamples

An object of class mldfm_subsample, returned by mldfm_subsampling.

alpha

Numeric. Confidence level for the hyperellipsoids (e.g., 0.95).

fpr

Logical. If TRUE, uses FPR Gamma (Fresoli, Poncela, Ruiz, 2024); otherwise, uses standard time-varying Gamma.

Examples

Run this code
# \donttest{
data <- matrix(rnorm(100*300), nrow = 100, ncol = 300)
block_ind <- c(150, 300)  
global = 1
local <- c(1, 1)   
mldfm_result <- mldfm(data, blocks = 2, block_ind = block_ind, 
global = global, local = local)
mldfm_subsampling_result <- mldfm_subsampling(data, blocks = 2, 
block_ind = block_ind, global = global, 
local = local, n_samples = 100, sample_size = 0.9)
scenario <- create_scenario(mldfm_result, mldfm_subsampling_result, 
alpha = 0.95)
# }

Run the code above in your browser using DataLab