docstr: Hypothesis test for the compatibility of prior mean with data
          
docstr_tok: ["Hypothesis","test","for","the","compatibility","of","prior","mean","with","data"]
code: def test_compatibility(self):
      """Hypothesis test for the compatibility of prior mean with data"""
      # TODO: should we store the OLS results ?  not needed so far, but maybe cache
      # params_ols = np.linalg.pinv(self.model.exog).dot(self.model.endog)
      # res = self.wald_test(self.model.r_matrix, q_matrix=self.model.q_matrix, use_f=False)
      # from scratch
      res_ols = OLS(self.model.endog, self.model.exog).fit()
      r_mat = self.model.r_matrix
      r_diff = self.model.q_matrix - r_mat.dot(res_ols.params)[:, None]
      ols_cov_r = res_ols.cov_params(r_matrix=r_mat)
      statistic = r_diff.T.dot(
          np.linalg.solve(ols_cov_r + self.model.sigma_prior, r_diff)
      )
      from scipy import stats
  
      df = np.linalg.matrix_rank(
          self.model.sigma_prior
      )  # same as r_mat.shape[0]
      pvalue = stats.chi2.sf(statistic, df)
      # TODO: return results class
      return statistic, pvalue, df
  
imports: from statsmodels.compat.python import lrange
  import numpy
  from statsmodels.tools.decorators import cache_readonly
  from statsmodels.regression.linear_model import OLS, GLS, RegressionResults
  from statsmodels.regression.feasible_gls import atleast_2dcols
label_desc: Use image node_id 7 for calling the TheilRegressionResults obj's underlying member method code with example usage: obj.test_compatibility() and returns: statistic,  pvalue,  df