TimeSeries
The TimeSeries class provides a structured interface for modeling uncertain, univariate time series. It is built on top of the Distribution class and provides convenient wrapper functions to key distribution methods, as well as additional functions relevant for time series analysis.
Creating a time series
def __init__(self, model, timesteps, name="", n_dims=1)
- Parameters:
model: A scipy.stats distribution object or an array of samples.
timesteps (np.ndarray, optional): The time steps in the time series (if None, a default time axis is generated).
name (str, optional): The name of the distribution (default is inferred from the model).
n_dims (int, optional): Dimensionality of the distribution (default is 1).
The class constructs an internal Distribution object using the provided model and stores the associated time steps.
Working with time series
Time Series Properties: Provides methods for computing key statistical properties such as:
mean() -> np.ndarray | float:
Returns the expected value of the time series.
cov() -> np.ndarray | float:
Returns the covariance of all time series points.
variance() -> np.ndarray | float:
Returns the variance of the time series (diagonal of the covariance matrix).
Sampling and PDF Evaluation:
sample(n: int, seed: int = None) -> np.ndarray:
Generates n random samples from the time series.
pdf(x: np.ndarray | float) -> np.ndarray | float:
Evaluates the probability density function (PDF) at the given points.