code: def calc_rho_and_rho_bar_squared(final_log_likelihood,
                                   null_log_likelihood,
                                   num_est_parameters):
      
      rho_squared = 1.0 - final_log_likelihood / null_log_likelihood
      rho_bar_squared = 1.0 - ((final_log_likelihood - num_est_parameters) /
                               null_log_likelihood)
  
      return rho_squared, rho_bar_squared
docs: Calculates McFadden's rho-squared and rho-bar squared for the given model.
  
      Parameters
      ----------
      final_log_likelihood : float.
          The final log-likelihood of the model whose rho-squared and rho-bar
          squared are being calculated for.
      null_log_likelihood : float.
          The log-likelihood of the model in question, when all parameters are
          zero or their 'base' values.
      num_est_parameters : int.
          The number of parameters estimated in this model.
  
      Returns
      -------
      `(rho_squared, rho_bar_squared)` : tuple of floats.
          The rho-squared and rho-bar-squared for the model.