Learn R Programming

expectreg (version 0.53)

Mqreg: Semiparametric M-Quantile Regression

Description

Robust M-quantiles are estimated using an iterative penalised reweighted least squares approach. Effects using quadratic penalties can be included, such as P-splines, Markov random fields or Kriging.

Usage

Mqreg(formula, data = NULL, smooth = c("schall", "acv", "fixed"), 
      estimate = c("iprls", "restricted"),lambda = 1, tau = NA, robust = 1.345,
      adaptive = FALSE, ci = FALSE, LSMaxCores = 1)

Value

An object of class 'expectreg', which is basically a list consisting of:

lambda

The final smoothing parameters for all expectiles and for all effects in a list. For the restricted and the bundle regression there are only the mean and the residual lambda.

intercepts

The intercept for each expectile.

coefficients

A matrix of all the coefficients, for each base element a row and for each expectile a column.

values

The fitted values for each observation and all expectiles, separately in a list for each effect in the model, sorted in order of ascending covariate values.

response

Vector of the response variable.

covariates

List with the values of the covariates.

formula

The formula object that was given to the function.

asymmetries

Vector of fitted expectile asymmetries as given by argument expectiles.

effects

List of characters giving the types of covariates.

helper

List of additional parameters like neighbourhood structure for spatial effects or 'phi' for kriging.

design

Complete design matrix.

fitted

Fitted values \( \hat{y} \).

plot, predict, resid, fitted, effects

and further convenient methods are available for class 'expectreg'.

Arguments

formula

An R formula object consisting of the response variable, '~' and the sum of all effects that should be taken into consideration. Each effect has to be given through the function rb.

data

Optional data frame containing the variables used in the model, if the data is not explicitely given in the formula.

estimate

Character string defining the estimation method that is used to fit the expectiles. Further detail on all available methods is given below.

smooth

There are different smoothing algorithms that should prevent overfitting. The 'schall' algorithm iterates the smoothing penalty lambda until it converges, the asymmetric cross-validation 'acv' minimizes a score-function using nlm or the function uses a fixed penalty.

lambda

The fixed penalty can be adjusted. Also serves as starting value for the smoothing algorithms.

tau

In default setting, the expectiles (0.01,0.02,0.05,0.1,0.2,0.5,0.8,0.9,0.95,0.98,0.99) are calculated. You may specify your own set of expectiles in a vector. The option may be set to 'density' for the calculation of a dense set of expectiles that enhances the use of cdf.qp and cdf.bundle afterwards.

robust

Robustness constant in M-estimation. See Details for definition.

adaptive

Logical. Whether the robustness constant is adapted along the covariates.

ci

Whether a covariance matrix for confidence intervals and the summary function is calculated.

LSMaxCores

How many cores should maximal be used by parallelization

Author

Monica Pratesi
University Pisa
https://www.unipi.it

M. Giovanna Ranalli
University Perugia
https://www.unipg.it

Nicola Salvati
University Perugia
https://www.unipg.it

Fabian Otto-Sobotka
University Oldenburg
https://uol.de

Details

In the least squares approach the following loss function is minimised:

\( S = \sum_{i=1}^{n}{ w_p(y_i - m_i(p))^2} \)

with weights

\( w_p(u) = (-(1-p)*c*(u_i< -c)+(1-p)*u_i*(u_i<0 \& u_i>=-c)+p*u_i*(u_i>=0 \& u_i<c)+p*c*(u_i>=c)) / u_i \)

for quantiles and

\( w_p(u) = -(1-p)*c*(u_i< -c)+(1-p)*u_i*(u_i<0 \& u_i>=-c)+p*u_i*(u_i>=0 \& u_i<c)+p*c*(u_i>=c) \)

for expectiles, with standardised residuals \(u_i = 0.6745*(y_i - m_i(p)) / median(y-m(p))\) and robustness constant c.

References

Pratesi M, Ranalli G and Salvati N (2009) Nonparametric M-quantile regression using penalised splines Journal of Nonparametric Statistics, 21:3, 287-304.

Otto-Sobotka F, Ranalli G, Salvati N, Kneib T (2019) Adaptive Semiparametric M-quantile Regression Econometrics and Statistics 11, 116-129.

See Also

expectreg.ls, rqss

Examples

Run this code

data("lidar", package = "SemiPar")

m <- Mqreg(logratio~rb(range,"pspline"),data=lidar,smooth="f",
                        tau=c(0.05,0.5,0.95),lambda=10)
plot(m,rug=FALSE)

Run the code above in your browser using DataLab