outference_seq: Fit a linear model with outliers detected SEQUENTIALLY

Description Usage Arguments Details Value Author(s) References See Also

View source: R/outference.R


This function detects outliers by using Cook's distance sequentially, and fits a linear regression model with outliers removed. The object returned by this function can be used for valid inference corrected for outlier removal through generic functions like summary, confint, predict.


outference_seq(formula, data, sigma = NULL, numOfOutlier)



an object of class "formula", the same syntax as in lm.


an optional data frame, list or environment containing the variables in the model, the same syntax as in lm.


the noise level. Must be one of NULL, "estimate", or a positive scaler value. If sigma = NULL, then the inference will assume the noise level is unknown; if sigma = "estimate", then the inference will base on an estimated noise level.


the number of outliers to be detected.


This function uses the same syntax as lm for the formula and data arguments. Users can access the original "lm" objects through $fit.full and $fit.rm. Common generic functions for lm, including coef, confint, plot, predict and summary are re-written so that they can be used to extract useful features of the object returned by this function.

The i-th observation is considered as an outlier when its Cook's distance rank among top k, where k is the user-specified number of outliers to be detected. The outlier detection event can be characterized as a set of quadratic constraints in the response y:

\bigcap_{i \in I} {y^T Q_i y ≥ 0},

where I is a finite index set, and the constraint returned by this function is the list of Q_i matrices.


This function returns an object of class c("outference_seq", "outference").

The function summary is used to obtain and print a summary (including p-values) of the results. The generic functions coef, confint, plot, predict are used to extract useful features of the object returned by this function.

An object of class c("outference_seq", "outference") is a list containing the following components:


an "lm" object representing the fit using the full data (no outliers are removed).


an "lm" object representing the fit using the data after outlier removal.






the number of outliers to be detected.


indexes of detected outliers.


the vector of the Cook's distance for all observations


the constraint in the response that characterizes the outlier detection event. A list of n by n matrices.


the noise level used in the fit.


the function call.


Shuxiao Chen <[email protected]>


S. Chen and J. Bien. “Valid Inference Corrected for Outlier Removal”. arXiv preprint arXiv:1711.10635 (2017).

See Also

summary.outference for summaries;

coef.outference for extracting coefficients;

confint.outference for confidence intervals of regression coefficients;

plot.outference for plotting the outlying measure;

predict.outference for making predictions.

shuxiaoc/outference documentation built on Dec. 5, 2017, 3:48 a.m.