docs: def calc_choice_sequence_probs(prob_array,
                                 choice_vec,
                                 rows_to_mixers,
                                 return_type=None):
      """
      Parameters
      ----------
      prob_array : 2D ndarray.
          All elements should be ints, floats, or longs. All elements should be
          between zero and one (exclusive). Each element should represent the
          probability of the corresponding alternative being chosen by the
          corresponding individual during the given choice situation, given the
          particular draw of coefficients being considered. There should be one
          column for each draw of the coefficients.
      choice_vec : 1D ndarray.
          All elements should be zeros or ones. Should denote the rows that were
          chosen by the individuals corresponding to those rows.
      rows_to_mixers : 2D scipy sparse array.
          All elements should be zeros and ones. Will map the rows of the design
          matrix to the particular units that the mixing is being performed over.
          Note that in the case of panel data, this matrix will be different from
          `rows_to_obs`.
      return_type : `'all'` or None, optional.
          If `'all'` is passed, then a tuple will be returned. The first element
          will be a 1D numpy array of shape `(num_mixing_units,)`. Each value
          will be the average probability of predicting the associated mixing
          unit's probability of making the observed sequence of choices. The
          second element of the tuple will be a 2D numpy array with shape
          `(num_mixing_units, num_draws)`, where
          `num_draws == prob_array.shape[1]`. Each value will be the probability
          of predicting the associated mixing unit's probability of making the
          observed sequence of choices, given the associated draw of the mixing
          distribution for the given individual. If None, only the first
          element of the tuple described above will be returned. Default == None.
  
      Returns
      -------
      See `return_type` kwarg.
      """
      if return_type not in [None, 'all']:
          raise ValueError("return_type must be None or 'all'.")
  
      log_chosen_prob_array = choice_vec[:, None] * np.log(prob_array)
      # Create a 2D array with shape (num_mixing_units, num_random_draws)
      # Each element will be the log of the probability of the sequence of
      # choices, given the random draw of the coefficients
      expanded_log_sequence_probs = rows_to_mixers.T.dot(log_chosen_prob_array)
      # Calculate the probability of the sequence of choices for each mixing
      # unit, given the random draw of the coefficients
      expanded_sequence_probs = np.exp(expanded_log_sequence_probs)
      # Guard against underflow since none of the probabilities are actually zero
      zero_idx = np.where(expanded_sequence_probs == 0)
      expanded_sequence_probs[zero_idx] = min_comp_value
      # Calculate the simulated probability of the sequence of choices of each
      # mixing unit
      sequence_probs = expanded_sequence_probs.mean(axis=1)
  
      if return_type is None:
          return sequence_probs
      elif return_type == 'all':
          return sequence_probs, expanded_sequence_probs