dirconn.fit_var#
- dirconn.fit_var(data: TimeSeries, order: int, *, ridge: float = 0.0, demean: bool = True) VarFit#
Fit a VAR model by pooled least squares.
All trials contribute to one regression; the regressors of a sample never come from another trial. Failures raise: a rank-deficient design or too few samples are errors, never silently replaced by another model.
- Parameters:
data (TimeSeries) – The data; every trial is treated as an independent realisation. With masks only the rows selected by
row_mask()are fitted, and the mean is that of the valid samples.order (int) – Number of lags, at least 1.
ridge (float) – Relative ridge penalty, at least 0. The absolute penalty is
ridgetimes the mean power of a regressor column, so it is scale free. Use it when channels are many or nearly collinear.demean (bool) – Remove the per-channel mean over trials and time first (the model has no intercept). An evoked response, if the data contain one, must be removed beforehand.
- Return type:
- Raises:
ValueError – For an invalid
orderorridge, too few samples, or a rank-deficient design.