Qlm {Qest} | R Documentation |
Q-Estimation of Linear Regression Models
Description
Use Q-estimation to fit a Normal model in which the mean is a linear function of the predictors, and the variance is constant.
Usage
Qlm(formula, data, subset, weights, na.action, start = NULL, contrasts = NULL,
wtau = NULL, control = Qest.control(), ...)
Arguments
formula |
an object of class “formula” (or one that can be coerced to that class): a symbolic description of the model to be fitted. |
data |
an optional data frame, list or environment (or object coercible by |
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. 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. |
na.action |
a function which indicates what should happen when the data contain |
start |
optional starting values for the regression coefficients. |
contrasts |
an optional list. See the |
wtau |
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 |
control |
a list of operational parameters. See |
... |
additional arguments for |
Details
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.
Value
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:
coefficients |
a named vector of coefficients. |
std.errs |
a named vector of standard errors. |
covar |
the estimated covariance matrix of the estimators. |
dispersion |
the estimated dispersion parameter (residual variance). |
residuals |
the working residuals. |
rank |
the estimated degrees of freedom. |
fitted.values |
the fitted values. |
df.residual |
the residual degrees of freedom. |
obj.function |
the value of the minimized loss function. |
gradient |
the first derivatives of the minimized loss function. |
hessian |
the matrix of second derivatives of the minimized loss function. |
convergence |
logical. The convergence status. |
n.it |
the number of iterations. |
control |
control parameters. |
xlevels |
(only where relevant) a record of the levels of the factors used in fitting. |
call |
the matched call. |
terms |
the “terms” object used. |
model |
if requested (the default), the model frame used. |
Author(s)
Gianluca Sottile <gianluca.sottile@unipa.it>, Paolo Frumento <paolo.frumento@unipi.it>
References
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>
See Also
Qest
, for general Q-estimation.
Examples
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)