class_docstr: This class implements a Generalized Gamma model for univariate data. The model has parameterized
  form:
  
  The survival function is:
  
  .. math::
  
      S(t)=\left\{  \begin{array}{}
         1-\Gamma_{RL}\left( \frac{1}{{{\lambda }^{2}}};\frac{{e}^{\lambda \left( \frac{\log(t)-\mu }{\sigma} \right)}}{\lambda ^{2}} \right)  \textit{ if } \lambda> 0 \\
            \Gamma_{RL}\left( \frac{1}{{{\lambda }^{2}}};\frac{{e}^{\lambda \left( \frac{\log(t)-\mu }{\sigma} \right)}}{\lambda ^{2}} \right)  \textit{ if } \lambda \le 0 \\
      \end{array} \right.\,\!
  
  where :math:`\Gamma_{RL}` is the regularized lower incomplete Gamma function.
  
  This model has the Exponential, Weibull, Gamma and Log-Normal as sub-models, and thus can be used as a way to test which
  model to use:
  
  1. When :math:`\lambda = 1` and :math:`\sigma = 1`, then the data is Exponential.
  2. When :math:`\lambda = 1` then the data is Weibull.
  3. When :math:`\sigma = \lambda` then the data is Gamma.
  4. When :math:`\lambda = 0` then the data is Log-Normal.
  5. When :math:`\lambda = -1` then the data is Inverse-Weibull.
  6. When :math:`\sigma = -\lambda` then the data is Inverse-Gamma.
  
  
  After calling the ``.fit`` method, you have access to properties like: ``cumulative_hazard_``, ``survival_function_``,
  A summary of the fit is available with the method ``print_summary()``.
  
  
  Important
  -------------
  The parameterization implemented has :math:`\log\sigma`, thus there is a `ln_sigma_` in the output. Exponentiate this parameter
  to recover :math:`\sigma`.
  
  
  Important
  -------------
  This model is experimental. It's API may change in the future. Also, it's convergence is not very stable.
  
  
  Parameters
  -----------
  alpha: float, optional (default=0.05)
      the level in the confidence intervals.
  
  
  Examples
  --------
  .. code:: python
  
      from lifelines import GeneralizedGammaFitter
      from lifelines.datasets import load_waltons
      waltons = load_waltons()
  
      ggf = GeneralizedGammaFitter()
      ggf.fit(waltons['T'], waltons['E'])
      ggf.plot()
      ggf.summary
  
  Attributes
  ----------
  cumulative_hazard_ : DataFrame
      The estimated cumulative hazard (with custom timeline if provided)
  hazard_ : DataFrame
      The estimated hazard (with custom timeline if provided)
  survival_function_ : DataFrame
      The estimated survival function (with custom timeline if provided)
  cumulative_density_ : DataFrame
      The estimated cumulative density function (with custom timeline if provided)
  density_: DataFrame
      The estimated density function (PDF) (with custom timeline if provided)
  
  variance_matrix_ : DataFrame
      The variance matrix of the coefficients
  median_survival_time_: float
      The median time to event
  lambda_: float
      The fitted parameter in the model
  rho_: float
      The fitted parameter in the model
  alpha_: float
      The fitted parameter in the model
  durations: array
      The durations provided
  event_observed: array
      The event_observed variable provided
  timeline: array
      The time line to use for plotting and indexing
  entry: array or None
      The entry array provided, or None
code: def _log_hazard(self, params, times):
      mu_, ln_sigma_, lambda_ = params
      ilambda_2 = 1 / lambda_**2
      Z = (log(times) - mu_) / safe_exp(ln_sigma_)
      clipped_exp = np.clip(
          safe_exp(lambda_ * Z) * ilambda_2, 1e-300, 1e20
      )
      if lambda_ > 0:
          v = (
              log(lambda_)
              - log(times)
              - ln_sigma_
              - gammaln(ilambda_2)
              + -2 * log(lambda_) * ilambda_2
              - clipped_exp
              + Z / lambda_
              - gammainccln(ilambda_2, clipped_exp)
          )
      elif lambda_ < 0:
          v = (
              log(-lambda_)
              - log(times)
              - ln_sigma_
              - gammaln(ilambda_2)
              - 2 * log(-lambda_) * ilambda_2
              - clipped_exp
              + Z / lambda_
              - gammaincln(ilambda_2, clipped_exp)
          )
      else:
          v = (
              norm.logpdf(Z, loc=0, scale=1)
              - ln_sigma_
              - log(times)
              - norm.logsf(Z)
          )
      return v
  
file_path: lifelines/lifelines/fitters/generalized_gamma_fitter.py
imports: import autograd.numpy
  from autograd.numpy import exp, log
  from scipy.special import gammainccinv, gammaincinv
  from autograd_gamma import gammaincc, gammainc, gammaln, gammainccln, gammaincln
  from lifelines.fitters import KnownModelParametricUnivariateFitter
  from lifelines.utils import CensoringType
  from lifelines.utils.safe_exp import safe_exp
  from autograd.scipy.stats import norm
label_desc: Use image node_id 3 for calling the GeneralizedGammaFitter obj's underlying member method code with example usage: obj._log_hazard(params, times) and returns: v