docstr: The gradient of the log posterior.
docstr_tok: ["The","gradient","of","the","log","posterior","."]
code: def logposterior_grad(self, params):
      """
      The gradient of the log posterior.
      """
  
      fep, vcp, vc = self._unpack(params)
  
      lp = 0
      if self.k_fep > 0:
          lp += np.dot(self.exog, fep)
      if self.k_vc > 0:
          lp += self.exog_vc.dot(vc)
  
      mu = self.family.link.inverse(lp)
  
      score_factor = (self.endog - mu) / self.family.link.deriv(mu)
      score_factor /= self.family.variance(mu)
  
      te = [None, None, None]
  
      # Contributions from p(y | x, z, vc)
      if self.k_fep > 0:
          te[0] = np.dot(score_factor, self.exog)
      if self.k_vc > 0:
          te[2] = self.exog_vc.transpose().dot(score_factor)
  
      if self.k_vc > 0:
          # Contributions from p(vc | vcp)
          # vcp0 = vcp[self.ident]
          # s = np.exp(vcp0)
          # ll -= 0.5 * np.sum(vc**2 / s**2) + np.sum(vcp0)
          vcp0 = vcp[self.ident]
          s = np.exp(vcp0)
          u = vc**2 / s**2 - 1
          te[1] = np.bincount(self.ident, weights=u)
          te[2] -= vc / s**2
  
          # Contributions from p(vcp)
          # ll -= 0.5 * np.sum(vcp**2 / self.vcp_p**2)
          te[1] -= vcp / self.vcp_p**2
  
      # Contributions from p(fep)
      if self.k_fep > 0:
          te[0] -= fep / self.fe_p**2
  
      te = [x for x in te if x is not None]
  
      return np.concatenate(te)
  
imports: import numpy
  from scipy.optimize import minimize
  from scipy import sparse
  import statsmodels.base.model
  from statsmodels.iolib import summary2
  from statsmodels.genmod import families
  import pandas
  import warnings
  import patsy
label_desc: Use image node_id 4 for calling the _BayesMixedGLM obj's underlying member method code with example usage: obj.logposterior_grad(params) and returns: np