gEconpy.model.statespace.data_from_prior#

gEconpy.model.statespace.data_from_prior(statepace_mod, pymc_model, index=None, n_samples=500, pct_missing=0, random_seed=None)#

Generate artificial data from prior predictive samples.

Also modifies the pymc model and the statespace model in-place to act as if build_statespace_graph has been called with the new data.

Parameters:
statepace_mod: DSGEStateSpace

Statespace model to generate data from. Must have been configured with the .configure method.

pymc_model: pm.Model

PyMC model with priors on expected DSGE parameters. It should not have a Kalman Filter added via build_statespace_graph.

index: pd.DatetimeIndex

Index to use for the generated data. If None, a quarterly index from 1980-01-01 to 2024-11-01 is used.

n_samples: int

Number of prior predictive samples to draw.

pct_missing: float

Percentage of missing data to introduce into the generated data. Must be between 0 and 1.

random_seed: np.random.Generator or int, optional

Random number generator to use for sampling. If None, the default numpy random number generator is used.

Returns:
true_parameters: xr.Dataset

True parameters used to generate the data.

data: pd.DataFrame

Generated data.

prior_idata: az.InferenceData

Draws from the prior predictive distribution, plus conditional prior predictive samples.