Use Q-estimation to fit a Normal model in which the mean is a linear function of the predictors, and the variance is constant.
Qlm(formula, data, subset, weights, na.action, start = NULL, contrasts = NULL,
wtau = NULL, control = Qest.control(), ...)
Qlm returns an object of classes “Qlm”, “lm”, and “Qest”.
The generic accessor functions summary
, coefficients
, fitted.values
, and residuals
can be used to extract infromation from a “Qlm” object.
An object of class “Qlm” is a list containing at least the following elements:
a named vector of coefficients.
a named vector of standard errors.
the estimated covariance matrix of the estimators.
the estimated dispersion parameter (residual variance).
the working residuals.
the estimated degrees of freedom.
the fitted values.
the residual degrees of freedom.
the value of the minimized loss function.
the first derivatives of the minimized loss function.
the matrix of second derivatives of the minimized loss function.
logical. The convergence status.
the number of iterations.
control parameters.
(only where relevant) a record of the levels of the factors used in fitting.
the matched call.
the “terms” object used.
if requested (the default), the model frame used.
an object of class “formula” (or one that can be coerced to that class): a symbolic description of the model to be fitted.
an optional data frame, list or environment (or object coercible by as.data.frame
to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula)
, typically the environment from which Qlm
is called.
an optional vector specifying a subset of observations to be used in the fitting process.
an optional vector of weights to be used in the fitting process. The weights will always be normalized to sum to the sample size. This implies that, for example, using double weights will not halve the standard errors.
a function which indicates what should happen when the data contain NA
s. See lm
.
optional starting values for the regression coefficients.
an optional list. See the contrasts.arg
of model.matrix.default
.
an optional function that assigns a different weight to each quantile. By default, all quantiles in (0,1) have the same weight. Please check the documentation of wtrunc
for built-in weighting functions.
a list of operational parameters. See Qest.control
for details.
additional arguments for wtau
.
Gianluca Sottile <gianluca.sottile@unipa.it>, Paolo Frumento <paolo.frumento@unipi.it>
This function is used exactly as lm
, but estimates the model parameters as in Qest
. Using Q-estimation allows to obtain outlier-robust estimators of the regression coefficients. The optional argument wtau
permits assigning a different weight to each quantile in (0,1). It is possible to choose wtau
to be a discontinuous function (e.g., wtau = function(tau){tau < 0.95}
). However, this may occasionally result in poorly estimated of the standard errors.
Note that Qlm
, like lm
, does not support censored or truncated data.
Sottile G, and Frumento P (2022). Robust estimation and regression with parametric quantile functions. Computational Statistics and Data Analysis. <doi:10.1016/j.csda.2022.107471>
Qest
, for general Q-estimation.
set.seed(1234)
n <- 100
x1 <- rnorm(n)
x2 <- runif(n,0,3)
theta <- c(1,4,1,2)
y <- rnorm(n, 4 + x1 + 2*x2, 1)
m1 <- Qlm(y ~ x1 + x2)
summary(m1)
Run the code above in your browser using DataLab