linearmodels.iv.results.IVGMMResults.c_stat

IVGMMResults.c_stat(variables: list[str] | str | None = None) → InvalidTestStatistic | WaldTestStatistic[source]

C-test of endogeneity.

Parameters:
variables: list[str] | str | None = None

Name or list of names of the endogenous regressors to test for exogeneity. If not provided, all endogenous regressors are jointly tested.

Returns:

Object containing test statistic, p-value, distribution and null. An InvalidTestStatistic is returned if the covariance of the moment conditions of the first model is singular, which can happen if there are too few clusters.

Return type:

linearmodels.shared.hypotheses.WaldTestStatistic or linearmodels.shared.hypotheses.InvalidTestStatistic

Raises:
  • TypeError – If variables is not a str or a list of str.

  • KeyError – If a name in variables is not an endogenous regressor.

Notes

The C statistic is the difference between the J statistics of two GMM estimates of the model, where one or more of the endogenous variables are assumed to be exogenous in the first. Both J statistics use the same estimate of the covariance of the moment conditions. Using a common covariance estimate is required for the C statistic to be non-negative.

The first model treats the tested variables as exogenous. Its moment conditions are the exogenous variables, the tested variables and the instruments. The model would be relatively efficient if the assumption were true, and two quantities are computed, the J statistic, \(J_e\), and the estimated covariance of the moment conditions, \(S_e\), which is the inverse of the weight matrix \(W_e\) used to compute the efficient estimate.

The moment conditions of the original model, the exogenous variables and the instruments, are a subset of the moment conditions in the first model. Let \(S_{e,c}\) be the sub-matrix of \(S_e\) that contains the rows and columns of the original moment conditions, which excludes those for the tested variables. The second J statistic, \(J_c\), is computed using the weight matrix \(S_{e,c}^{-1}\) and parameters that are estimated from the original moment conditions using this weight matrix. Note that this is not the same as the sub-matrix of \(W_e\).

The test statistic is then

\[J_e - J_c \sim \chi^2_{m}\]

where \(m\) is the number of variables whose exogeneity is being tested. If the original model is just identified, \(J_c=0\) and the C statistic is the J statistic of the first model.

The covariance of the moment conditions in the first model is estimated using the same weight_type and weight configuration as the model that the statistic is computed from, e.g., clustered or kernel, so that the statistic is valid under the same assumptions about the moment conditions.

The first model has a moment condition for each tested variable that the model does not have. The estimate of the covariance of its moment conditions has to be nonsingular, and the statistic is invalid if it is not. A clustered estimate that uses G clusters has rank at most G, and at most G - 1 if the moment conditions are centered (center is True), because the centered cluster sums add to zero. There have to be at least as many clusters as moment conditions in the first model, and more if they are centered. The rank of a kernel or robust estimate is bounded in the same way by the number of observations.

See Hayashi (2000), pp. 218-221 and 232-234, or Baum, Schaffer and Stillman (2003), section 4.4, for details.