Use Generated Data for Stress Test Predictions

Stress testing in the context of time series refers to a risk management and validation technique that assesses how a model performs under different conditions, typically involving changes in the variables. The goal of stress testing is to evaluate the resilience of a system, portfolio, or model to such extreme scenarios.

In this Shortcut, you will apply a linear autoregressive machine learning model to forecast the next change in the ISM Purchasing Managers Index (ISM PMI), a widely followed monthly economic indicator in the United States that provides insights into the health and direction of the country’s manufacturing sector. 

Following the same previous Shortcuts, you will use a VAE to generate synthetic data that resembles the ISM PMI’s differenced values (to impose stationarity), and then you will fit and predict the regression models on every generated piece of data. The aim is to see if there is a significant different between the accuracy (hit ratio) of the data (original and synthetic).

You must download the ISM PMI data from this repository first. Use the following code to apply the Shortcut:

# Importing the required libraries
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
import pandas as pd
# Fetch S&P 500 price data
data = np.reshape(np.array(pd.read_excel('ISM_PMI.xlsx')), (-1))
data = np.diff(data)
# Define the VAE model

Get Use Generated Data for Stress Test Predictions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.