code: def compute_aic(model_object):
      
      assert isinstance(model_object.params, pd.Series)
      assert isinstance(model_object.log_likelihood, Number)
  
      return -2 * model_object.log_likelihood + 2 * model_object.params.size
docs: Compute the Akaike Information Criteria for an estimated model.
  
      Parameters
      ----------
      model_object : an MNDC_Model (multinomial discrete choice model) instance.
          The model should have already been estimated.
          `model_object.log_likelihood` should be a number, and
          `model_object.params` should be a pandas Series.
  
      Returns
      -------
      aic : float.
          The AIC for the estimated model.
  
      Notes
      -----
      aic = -2 * log_likelihood + 2 * num_estimated_parameters
  
      References
      ----------
      Akaike, H. (1974). 'A new look at the statistical identification model',
          IEEE Transactions on Automatic Control 19, 6: 716-723.