statsmodels.tsa.statespace.tools.validate_matrix_shape

statsmodels.tsa.statespace.tools.validate_matrix_shape(name, shape, nrows, ncols, nobs)[source]

Validate the shape of a possibly time-varying matrix, or raise an exception

Parameters:
namestr

The name of the matrix being validated (used in exception messages)

shapearray_like

The shape of the matrix to be validated. May be of size 2 or (if the matrix is time-varying) 3.

nrowsint

The expected number of rows.

ncolsint

The expected number of columns.

nobsint

The number of observations (used to validate the last dimension of a time-varying matrix)

Raises:
ValueError

If the matrix is not of the desired shape.


Last update: Nov 14, 2024