cedalion.models.glm.solve
Solve the GLM model.
Functions
|
Fit design matrix to data. |
|
Iterate over the design matrix and yield the design matrix for each group. |
|
Predict time series from design matrix and thetas. |
- cedalion.models.glm.solve.fit(
- ts: cdt.NDTimeSeries,
- design_matrix: DataArray,
- channel_wise_regressors: list[DataArray] | None = None,
- noise_model='ols',
Fit design matrix to data.
- Parameters:
ts – the time series to be modeled
design_matrix – DataArray with dims time, regressor, chromo
channel_wise_regressors – optional list of design matrices, with additional channel dimension
noise_model – must be ‘ols’ for the moment
- Returns:
thetas as a DataArray
- cedalion.models.glm.solve.predict(
- ts: cdt.NDTimeSeries,
- thetas: DataArray,
- design_matrix: DataArray,
- channel_wise_regressors: list[DataArray] | None = None,
Predict time series from design matrix and thetas.
- Parameters:
ts (cdt.NDTimeSeries) – The time series to be modeled.
thetas (xr.DataArray) – The estimated parameters.
design_matrix (xr.DataArray) – DataArray with dims time, regressor, chromo
channel_wise_regressors (list[xr.DataArray]) – Optional list of design matrices,
dimension. (with additional channel)
- Returns:
The predicted time series.
- Return type:
prediction (xr.DataArray)
- cedalion.models.glm.solve.iter_design_matrix(
- ts: cdt.NDTimeSeries,
- design_matrix: DataArray,
- channel_wise_regressors: list[DataArray] | None = None,
- channel_groups: list[int] | None = None,
Iterate over the design matrix and yield the design matrix for each group.
- Parameters:
ts (cdt.NDTimeSeries) – The time series to be modeled.
design_matrix (xr.DataArray) – DataArray with dims time, regressor, chromo.
channel_wise_regressors (list[xr.DataArray] | None, optional) – Optional list of design matrices, with additional channel dimension.
channel_groups (list[int] | None, optional) – Optional list of channel groups.
- Yields:
tuple –
- A tuple containing:
dim3 (str): The third dimension name.
group_y (cdt.NDTimeSeries): The grouped time series.
group_design_matrix (xr.DataArray): The grouped design matrix.