arch.univariate.LS¶
-
class arch.univariate.LS(y: ndarray | DataFrame | Series | None =
None, x: ndarray | DataFrame | Series | ndarray[tuple[int, int], dtype[float64]] | None =None, constant: bool =True, hold_back: int | None =None, volatility: VolatilityProcess | None =None, distribution: Distribution | None =None, rescale: bool | None =None)[source]¶ Least squares model estimation and simulation.
- Parameters:¶
- y: ndarray | DataFrame | Series | None =
None¶ Vector of nobs elements containing the dependent variable.
- x: ndarray | DataFrame | Series | ndarray[tuple[int, int], dtype[float64]] | None =
None¶ Array with nobs rows and k columns containing exogenous regressors. Must contain only finite values.
- constant: bool =
True¶ Flag whether the model should include a constant.
- hold_back: int | None =
None¶ Number of observations at the start of the sample to exclude when estimating model parameters. Used when comparing models with different lag lengths to estimate on the common sample. Must be a non-negative integer.
- volatility: VolatilityProcess | None =
None¶ Volatility process to use in the model.
- distribution: Distribution | None =
None¶ Error distribution to use in the model.
- rescale: bool | None =
None¶ Flag indicating whether to automatically rescale data if the scale of the data is likely to produce convergence issues when estimating model parameters. If False, the model is estimated on the data without transformation. If True, then y is rescaled and the new scale is reported in the estimation results. If None, the data is not rescaled and a warning is issued when its scale is likely to produce convergence issues.
- y: ndarray | DataFrame | Series | None =
- Raises:¶
TypeError – If
hold_backis not an integer (a float, including 5.0, and a bool are not accepted), ifconstantorrescaleis not a bool (rescalecan also be None), ifvolatilityordistributionis not an instance ofVolatilityProcessorDistribution, or ifxcannot be converted to numbers.ValueError – If
hold_backis negative, or ifxcontains NaN or inf or does not have a row for each observation ofy.
Notes
The LS model is described by
\[y_t = \mu + \gamma' x_t + \epsilon_t\]Examples
>>> import numpy as np >>> from arch.univariate import LS >>> y = np.random.randn(100) >>> x = np.random.randn(100,2) >>> ls = LS(y, x) >>> res = ls.fit()Methods
append(y[, x])Append observations to the model in-place.
bounds()Construct bounds for parameters to use in non-linear optimization.
compute_param_cov(params[, backcast, robust])Compute parameter covariances using numerical derivatives.
Construct linear constraint arrays for use in non-linear optimization.
fit([update_freq, disp, starting_values, ...])Estimate model parameters.
fix(params[, first_obs, last_obs])Construct an ARCHModelFixedResult from fixed parameters.
forecast(params[, horizon, start, align, ...])Construct forecasts from estimated model.
Return the names of the parameters of the mean model.
resids(params[, y, regressors])Compute model residuals.
simulate(params, nobs[, burn, ...])Simulate data from a linear regression, AR or HAR models.
Return starting values for the mean model.
Properties
Get or set the error distribution.
The name of the model.
Number of parameters in the model.
Get or set the volatility process.
The exogenous regressors in the model.
The dependent variable.