'calculate studentized residuals
Parameters
sigma : None or float
estimate of the standard deviation of the residuals. If None, then
the estimate from the regression results is used.
Returns
stzd_resid : ndarray
studentized residuals
Notes
studentized residuals are defined as ::
resid / sigma / np.sqrt(1 - hii)
where resid are the residuals from the regression, sigma is an
estimate of the standard deviation of the residuals, and hii is the
diagonal of the hat_matrix.'

def get_resid_studentized_external(self, sigma=None):

    hii = self.hat_matrix_diag
    if (sigma is None):
        sigma2_est = self.results.mse_resid
        sigma = np.sqrt(sigma2_est)
    return ((self.results.resid / sigma) / np.sqrt((1 - hii)))
