linearmodels.shared.covariance.cov_cluster

linearmodels.shared.covariance.cov_cluster(z: ndarray[tuple[int, ...], dtype[float64]], clusters: ndarray[tuple[int, ...], Any]) → ndarray[tuple[int, ...], dtype[float64]][source]

Core cluster covariance estimator.

Parameters:
z: ndarray[tuple[int, ...], dtype[float64]]

Mean zero data with shape (n, k).

clusters: ndarray[tuple[int, ...], Any]

Array with shape (n,) that contains the cluster that each observation belongs to.

Returns:

Cluster asymptotic covariance with shape (k, k).

Return type:

numpy.ndarray

Raises:

ValueError – If clusters contains missing values, since the observations they belong to cannot be assigned to a cluster, or has fewer than two groups.