class_docstr: generic moment test for GMM
  
  This is a class to calculate and hold the various results
  
  This is based on Newey 1985 on GMM.
  Lemma 1:
  Theorem 1
  
  The main method is `chisquare` which returns the result of the
  conditional moment test.
  
  Warning: name of class and methods will likely be changed
  
  Parameters
  ----------
  moments : ndarray, 1-D
      moments that are tested to be zero. They do not need to be derived
      from a likelihood function.
  moments_deriv : ndarray
      derivative of the moment function with respect to the parameters that
      are estimated
  cov_moments : ndarray
      An estimate for the joint (expected) covariance of all moments. This
      can be a heteroscedasticity or correlation robust covariance estimate,
      i.e. the inner part of a sandwich covariance.
  weights : ndarray
      Weights used in the GMM estimation.
  transf_mt : ndarray
      This defines the test moments where `transf_mt` is the matrix that
      defines a Linear combination of moments that have expected value equal
      to zero under the Null hypothesis.
  
  Notes
  -----
  The one letter names in Newey 1985 are
  
  moments, g :
  cov_moments, V :
  moments_deriv, H :
  weights, W :
  transf_mt, L :
      linear transformation to get the test condition from the moments
  
  not used, add as argument to methods or __init__?
  K cov for misspecification
  or mispecification_deriv
  
  This follows the GMM version in Newey 1985a, not the MLE version in
  Newey 1985b. Newey uses the generalized information matrix equality in the
  MLE version Newey (1985b).
  
  Newey 1985b Lemma 1 does not impose correctly specified likelihood, but
  assumes it in the following. Lemma 1 in both articles are essentially the
  same assuming D = H' W.
  
  References
  ----------
  - Newey 1985a, Generalized Method of Moment specification testing,
    Journal of Econometrics
  - Newey 1985b, Maximum Likelihood Specification Testing and Conditional
    Moment Tests, Econometrica
code: def __init__(
      self, moments, cov_moments, moments_deriv, weights, transf_mt
  ):
      self.moments = moments
      self.cov_moments = cov_moments
      self.moments_deriv = moments_deriv
      self.weights = weights
      self.transf_mt = transf_mt
  
      # derived quantities
      self.moments_constraint = transf_mt.dot(moments)
      self.htw = moments_deriv.T.dot(weights)  # H'W
  
      # TODO check these
      self.k_moments = self.moments.shape[-1]  # in this case only 1-D
      # assuming full rank of L'
      self.k_constraints = self.transf_mt.shape[0]
  
imports: import warnings
  import numpy
  from scipy import stats
  from statsmodels.tools.decorators import cache_readonly
  from statsmodels.regression.linear_model import OLS
label_desc: Use image node_id 1 to create a new CMTNewey object  with example: obj = CMTNewey(moments, cov_moments, moments_deriv, weights, transf_mt)