statsmodels.tools.tools.isestimable

statsmodels.tools.tools.isestimable(c, d)[source]

True if (Q, P) contrast c is estimable for (N, P) design d.

From an Q x P contrast matrix C and an N x P design matrix D, checks if the contrast C is estimable by looking at the rank of vstack([C,D]) and verifying it is the same as the rank of D.

Parameters:
carray_like

A contrast matrix with shape (Q, P). If 1 dimensional assume shape is (1, P).

darray_like

The design matrix, (N, P).

Returns:
bool

True if the contrast c is estimable on design d.

Examples

>>> d = np.array([[1, 1, 1, 0, 0, 0],
...               [0, 0, 0, 1, 1, 1],
...               [1, 1, 1, 1, 1, 1]]).T
>>> isestimable([1, 0, 0], d)
False
>>> isestimable([1, -1, 0], d)
True

Last update: Nov 14, 2024