code: def lm_robust_subset_parts(
      score,
      k_constraints,
      score_deriv_uu,
      score_deriv_cu,
      cov_score_cc,
      cov_score_cu,
      cov_score_uu,
  ):
      """robust generalized score tests on subset of parameters
  
      This is the same as lm_robust_subset with arguments in parts of
      partitioned matrices.
      This can be useful, when we have the parts based on different estimation
      procedures, i.e. when we do not have the full unconstrained model.
  
      Calculates mainly the covariance of the constraint part of the score.
  
      Parameters
      ----------
      score : ndarray, 1-D
          derivative of objective function at estimated parameters
          of constrained model. These is the score component for the restricted
          part under hypothesis. The unconstrained part of the score is assumed
          to be zero.
      k_constraint : int
          number of constraints
      score_deriv_uu : ndarray, symmetric, square
          first derivative of moment equation or second derivative of objective
          function for the unconstrained part
          TODO: could be OPG or any other estimator if information matrix
          equality holds
      score_deriv_cu : ndarray
          first cross derivative of moment equation or second cross
          derivative of objective function between.
      cov_score_cc :  ndarray
          covariance matrix of the score for the unconstrained part.
          This is the inner part of a sandwich estimator.
      cov_score_cu :  ndarray
          covariance matrix of the score for the off-diagonal block, i.e.
          covariance between constrained and unconstrained part.
      cov_score_uu :  ndarray
          covariance matrix of the score for the unconstrained part.
  
      Returns
      -------
      lm_stat : float
          score/lagrange multiplier statistic
      p-value : float
          p-value of the LM test based on chisquare distribution
  
      Notes
      -----
      TODO: these function should just return the covariance of the score
      instead of calculating the score/lm test.
  
      Implementation similar to lm_robust_subset and is based on Boos 1992,
      section 4.1 in the form attributed to Breslow (1990). It does not use the
      computation attributed to Kent (1982) and Engle (1984).
      """
  
      tmp_proj = np.linalg.solve(score_deriv_uu, score_deriv_cu.T).T
      tmp = tmp_proj.dot(cov_score_cu.T)
  
      # this needs to make a copy of cov_score_cc for further inplace modification
      cov = cov_score_cc - tmp
      cov -= tmp.T
      cov += tmp_proj.dot(cov_score_uu).dot(tmp_proj.T)
  
      lm_stat = score.dot(np.linalg.solve(cov, score))
      pval = stats.chi2.sf(lm_stat, k_constraints)
      return lm_stat, pval
  
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 7 for calling a global function with example usage: lm_robust_subset_parts(score, k_constraints, score_deriv_uu, score_deriv_cu, cov_score_cc, cov_score_cu, cov_score_uu) and returns: lm_stat,  pval