docs: def calc_neg_log_likelihood_and_neg_gradient(self, params):
          """
          Calculates and returns the negative of the log-likelihood and the
          negative of the gradient. This function is used as the objective
          function in scipy.optimize.minimize.
          """
          neg_log_likelihood = -1 * self.convenience_calc_log_likelihood(params)
          neg_gradient = -1 * self.convenience_calc_gradient(params)
  
          if self.constrained_pos is not None:
              neg_gradient[self.constrained_pos] = 0
  
          return neg_log_likelihood, neg_gradient