statsmodels.tsa.statespace.tools.companion_matrix

statsmodels.tsa.statespace.tools.companion_matrix(polynomial)[source]

Create a companion matrix

Parameters:

polynomial : array_like, optional.

If an iterable, interpreted as the coefficients of the polynomial from which to form the companion matrix. Polynomial coefficients are in order of increasing degree. If an integer, the size of the companion matrix (the polynomial coefficients are then set to zeros).

Returns:

companion_matrix : array

Notes

Returns a matrix of the form

\begin{bmatrix} \phi_1 & 1 & 0 & \cdots & 0 \\ \phi_2 & 0 & 1 & & 0 \\ \vdots & & & \ddots & 0 \\ & & & & 1 \\ \phi_n & 0 & 0 & \cdots & 0 \\ \end{bmatrix}

where some or all of the \phi_i may be non-zero (if polynomial is None, then all are equal to zero).

If the coefficients provided are (c_0, c_1, \dots, c_{n}), then the companion matrix is an n \times n matrix formed with the elements in the first column defined as \phi_i = -\frac{c_i}{c_0}, i \in 1, \dots, n.