class_docstr: A class that holds functions that are optimized/solved.
  
  The general setup of the class is simple.  Any method that starts with
  _opt_ creates a vector of estimating equations named est_vect such that
  np.dot(p, (est_vect))=0 where p is the weight on each
  observation as a 1 x n array and est_vect is n x k.  Then _modif_Newton is
  called to determine the optimal p by solving for the Lagrange multiplier
  (eta) in the profile likelihood maximization problem.  In the presence
  of nuisance parameters, _opt_ functions are  optimized over to profile
  out the nuisance parameters.
  
  Any method starting with _ci_limits calculates the log likelihood
  ratio for a specific value of a parameter and then subtracts a
  pre-specified critical value.  This is solved so that llr - crit = 0.
class_docstr_tok: ["A","class","that","holds","functions","that","are","optimized\/solved",".","The","general","setup","of","the","class","is","simple",".","Any","method","that","starts","with","_opt_","creates","a","vector","of","estimating","equations","named","est_vect","such","that","np.dot","(","p",",","(","est_vect",")",")","=0","where","p","is","the","weight","on","each","observation","as","a","1","x","n","array","and","est_vect","is","n","x","k.","Then","_modif_Newton","is","called","to","determine","the","optimal","p","by","solving","for","the","Lagrange","multiplier","(","eta",")","in","the","profile","likelihood","maximization","problem",".","In","the","presence","of","nuisance","parameters",",","_opt_","functions","are","optimized","over","to","profile","out","the","nuisance","parameters",".","Any","method","starting","with","_ci_limits","calculates","the","log","likelihood","ratio","for","a","specific","value","of","a","parameter","and","then","subtracts","a","pre-specified","critical","value",".","This","is","solved","so","that","llr","-","crit","=","0","."]
docstr: Calculates the gradient of a weighted empirical likelihood
  problem
  
  Parameters
  ----------
  eta : ndarray, (1,m)
      Lagrange multiplier in the profile likelihood maximization
  
  est_vect : ndarray, (n,k)
      Estimating equations vector
  
  weights : 1darray
      Observation weights
  
  Returns
  -------
  gradient : ndarray (m,1)
      The gradient used in _wtd_modif_newton
docstr_tok: ["Calculates","the","gradient","of","a","weighted","empirical","likelihood","problem","Parameters","--","--","--","--","--","eta",":","ndarray",",","(","1",",","m",")","Lagrange","multiplier","in","the","profile","likelihood","maximization","est_vect",":","ndarray",",","(","n",",","k",")","Estimating","equations","vector","weights",":","1darray","Observation","weights","Returns","--","--","--","-","gradient",":","ndarray","(","m,1",")","The","gradient","used","in","_wtd_modif_newton"]
code: def _grad(self, eta, est_vect, weights, nobs):
      """
      Calculates the gradient of a weighted empirical likelihood
      problem
  
      Parameters
      ----------
      eta : ndarray, (1,m)
          Lagrange multiplier in the profile likelihood maximization
  
      est_vect : ndarray, (n,k)
          Estimating equations vector
  
      weights : 1darray
          Observation weights
  
      Returns
      -------
      gradient : ndarray (m,1)
          The gradient used in _wtd_modif_newton
      """
      # eta = np.squeeze(eta)
      data_star_prime = np.sum(weights) + np.dot(est_vect, eta)
      idx = data_star_prime < 1.0 / nobs
      not_idx = ~idx
      data_star_prime[idx] = nobs * (2 - nobs * data_star_prime[idx])
      data_star_prime[not_idx] = 1.0 / data_star_prime[not_idx]
      return np.dot(weights * data_star_prime, est_vect)
  
imports: import numpy
  from scipy import optimize
  from scipy.stats import chi2, skew, kurtosis
  from statsmodels.base.optimizer import _fit_newton
  import itertools
  from statsmodels.graphics import utils
label_desc: Use image node_id 4 for calling the _OptFuncts obj's underlying member method code with example usage: obj._grad(eta, est_vect, weights, nobs) and returns: np