'Return the model parameters packed into a single vector.
Parameters
use_sqrt : bool
If True, the Cholesky square root of `cov_re` is
included in the packed result.  Otherwise the
lower triangle of `cov_re` is included.
has_fe : bool
If True, the fixed effects parameters are included
in the packed result, otherwise they are omitted.'

def get_packed(self, use_sqrt, has_fe=False):

    if (self.k_re > 0):
        if use_sqrt:
            L = np.linalg.cholesky(self.cov_re)
            cpa = L[self._ix]
        else:
            cpa = self.cov_re[self._ix]
    else:
        cpa = np.zeros(0)
    if use_sqrt:
        vcomp = np.sqrt(self.vcomp)
    else:
        vcomp = self.vcomp
    if has_fe:
        pa = np.concatenate((self.fe_params, cpa, vcomp))
    else:
        pa = np.concatenate((cpa, vcomp))
    return pa
