

def index_trim_outlier(resid, k):
    'returns indices to residual array with k outliers removed\n\n    Parameters\n    ----------\n    resid : array_like, 1d\n        data vector, usually residuals of a regression\n    k : int\n        number of outliers to remove\n\n    Returns\n    -------\n    trimmed_index : array, 1d\n        index array with k outliers removed\n    outlier_index : array, 1d\n        index array of k outliers\n\n    Notes\n    -----\n\n    Outliers are defined as the k observations with the largest\n    absolute values.\n\n    '
    sort_index = np.argsort(np.abs(resid))
    trimmed_index = np.sort(sort_index[:(- k)])
    outlier_index = np.sort(sort_index[(- k):])
    return (trimmed_index, outlier_index)

dataset/ETHPy150Open statsmodels/statsmodels/examples/incomplete/wls_extended.py index_trim_outlier/original