statsmodels.stats.multivariate_tools.cc_ranktest#
- statsmodels.stats.multivariate_tools.cc_ranktest(x1, x2, demean=True, fullrank=False, return_object=False)[source]#
Rank tests based on smallest canonical correlation coefficients
Anderson canonical correlations test (LM test) and Cragg-Donald test (Wald test) Assumes homoskedasticity and independent observations, overrejects if there is heteroscedasticity or autocorrelation.
The Null Hypothesis is that the rank is k - 1, the alternative hypothesis is that the rank is at least k.
- Parameters:
- x1, x2array_like, 2-D
Two 2-dimensional data arrays, observations in rows, variables in columns.
- demeanbool,
optional If demean is true, then the mean is subtracted from each variable.
- fullrankbool,
optional If true, then only the test that the matrix has full rank is returned. If false, the test for all possible ranks are returned. However, the p-values are not corrected for the multiplicity of tests.
- return_objectbool,
optional If False (default), the results are returned as a plain tuple
(statistic, pvalue, df, ccorr, wald_statistic, wald_pvalue), the legacy return format of this function. If True, aCCRankTestResultinstance is returned instead, which exposes the same values as named attributes and still unpacks as the same 6-tuple.
- Returns:
tupleorCCRankTestResultBy default, the tuple
(statistic, pvalue, df, ccorr, wald_statistic, wald_pvalue). Ifreturn_objectis True, aCCRankTestResultwith the same values as attributes.
See also
Notes
Degrees of freedom for the distribution of the test statistic are based on number of columns of x1 and x2 and not on their matrix rank. (I’m not sure yet what the interpretation of the test is if x1 or x2 are of reduced rank.)
References
Anderson, T. W. 1951. “Estimating Linear Restrictions on Regression Coefficients for Multivariate Normal Distributions.” The Annals of Mathematical Statistics 22 (3): 327-51.
Cragg, John G., and Stephen G. Donald. 1993. “Testing Identifiability and Specification in Instrumental Variable Models.” Econometric Theory 9 (2): 222-40.