def __init__(self): dataset = data.sp500_closing_prices(num_points=100) super(StochasticVolatilitySP500Small, self).__init__( name='stochastic_volatility_sp500_small', pretty_name= 'Smaller stochastic volatility model of S&P500 returns.', **dataset)
def testStochasticVolatilityModelSP500(self): num_train_points = 2516 dataset = data.sp500_closing_prices() self.assertEqual((num_train_points, ), dataset['centered_returns'].shape) self.assertAllClose(0.0, np.mean(dataset['centered_returns']), atol=1e-5)
def stochastic_volatility_sp500(): """Stochastic volatility model. This uses a dataset of 2517 daily closing prices of the S&P 500 index, representing the time period 6/25/2010-6/24/2020. Returns: target: StanModel. """ dataset = data.sp500_closing_prices() return stochastic_volatility.stochastic_volatility(**dataset)
def stochastic_volatility_sp500_small(): """Stochastic volatility model. This is a smaller version of `stochastic_volatility_model_sp500` using only 100 days of returns from the S&P 500, ending 6/24/2020. Returns: target: StanModel. """ dataset = data.sp500_closing_prices(num_points=100) return stochastic_volatility.stochastic_volatility(**dataset)
def __init__(self): dataset = data.sp500_closing_prices() super(StochasticVolatilitySP500, self).__init__( name='stochastic_volatility_sp500', pretty_name='Stochastic volatility model of S&P500 returns.', **dataset)