fsreg {fsdaR} | R Documentation |
fsreg: an automatic outlier detection procedure in linear regression
Description
An automatic outlier detection procedure in linear regression
Usage
fsreg(x, ...)
## S3 method for class 'formula'
fsreg(formula, data, subset, weights, na.action,
model = TRUE, x.ret = FALSE, y.ret = FALSE,
contrasts = NULL, offset, ...)
## Default S3 method:
fsreg(x, y, bsb, intercept = TRUE,
family = c("homo", "hetero", "bayes"),
method = c("FS", "S", "MM", "LTS", "LMS"),
monitoring = FALSE, control, trace = FALSE,
...)
Arguments
formula |
a |
data |
data frame from which variables specified in
|
subset |
an optional vector specifying a subset of observations to be used in the fitting process. |
weights |
an optional vector of weights to be used in the fitting process. NOT USED YET. |
na.action |
a function which indicates what should happen
when the data contain |
model , x.ret , y.ret |
|
contrasts |
an optional list. See the |
offset |
this can be used to specify an a priori
known component to be included in the linear predictor
during fitting. An |
family |
family of robust regression models, can be 'homo' for
homoscedastic (same variance) regression model, 'hetero' for
heteroskedastic regression model or 'bayes' Bayesian
linear regression. The default is |
method |
robust regression estimation model, can be 'FS' for
Forward search, 'S' for S regression, 'MM' for MM regression, 'LMS' or 'LTS'.
The default is |
monitoring |
wheather to perform monitoring for several quantities
in each step of the forward search or for series of values of the
breakdown point in case of S estimates or for series of values of the
efficiency in case of MM estimates. Deafault is |
y |
Response variable. Vector. Response variable, specified as a vector of length n, where n is the number of observations. Each entry in y is the response for the corresponding row of X. Missing values (NA's) and infinite values (Inf's) are allowed, since observations (rows) with missing or infinite values will automatically be excluded from the computations. |
x |
Predictor variables. Matrix. Matrix of explanatory
variables (also called 'regressors') of dimension n x (p-1)
where p denotes the number of explanatory variables
including the intercept.
Rows of X represent observations, and columns represent
variables. By default, there is a constant term in the
model, unless you explicitly remove it using input option
|
bsb |
Initial subset - vector of indices. If |
intercept |
Indicator for constant term. Scalar. If |
control |
A control object (S3) containing estimation options. If the control object is supplied, the parameters from it will be used. If parameters are passed also in the invocation statement, they will override the corresponding elements of the control object. |
trace |
Whether to print intermediate results. Default is |
... |
potential further arguments passed to lower level functions. |
Value
Depending on the input parameters family
and method
, one of
the following objects will be returned:
Author(s)
FSDA team
References
Riani, M., Atkinson A.C., Cerioli A. (2009). Finding an unknown number of multivariate outliers. Journal of the Royal Statistical Society Series B, Vol. 71, pp. 201-221.
Examples
## Not run:
library(robustbase)
n <- 200
p <- 3
X <- matrix(data=rnorm(n*p), nrow=n, ncol=p)
y <- matrix(data=rnorm(n*1), nrow=n, ncol=1)
(out = fsreg(X, y))
## Now we use the formula interface:
(out1 = fsreg(y~X, control=FSR_control(plot=FALSE)))
## Or use the variables in a data frame
(out2 = fsreg(Y~., data=hbk, control=FSR_control(plot=FALSE)))
## let us compare to the LTS solution
library(robustbase)
(out3 = ltsReg(Y~., data=hbk))
## Now compute the model without intercept
(out4 = fsreg(Y~.-1, data=hbk, control=FSR_control(plot=FALSE)))
## And compare again with the LTS solution
(out5 = ltsReg(Y~.-1, data=hbk))
## using default (optional arguments)
(out6 = fsreg(Y~.-1, data=hbk, control=FSR_control(plot=FALSE, nsamp=1500, h=50)))
## End(Not run)