def index_trim_outlier(resid, k):
 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)

def index_trim_outlier ( resid , k ) : 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 )
returns indices to residual array with k outliers removed parameters resid : array_like .