Learn R Programming

expectreg (version 0.16)

expectile.laws: Expectile regression of additive models

Description

Generalized additive models are fitted with least asymmetrically weighted squares or restricted with respect to the mean to obtain the graphs of 11 different expectiles for continuous, spatial or random effects.

Usage

expectile.laws(formula, data = NULL, smooth = c("schall", "acv", "none"), lambda = 0.1, expectiles = NA, parallel = FALSE)

expectile.restricted(formula, data = NULL, smooth = c("schall", "acv", "none"), lambda = 0.1, expectiles = NA, density = FALSE)

expectile.bundle(formula, data = NULL, smooth = c("schall", "acv", "none"), lambda = 0.1, expectiles = NA, density = FALSE)

expectile.sheets(formula, data = NULL, smooth = c("acv", "none"), lambda = 0.1, lambdap = 5, expectiles = NA, density = FALSE)

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 base.
data
Optional data frame containing the variables used in the model, if the data is not explicitely given in the formula.
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
lambda
The fixed penalty can be adjusted. Also serves as starting value for the smoothing algorithms.
lambdap
A penalty for smoothing across the expectiles in the sheets function. Used if no smoothing algorithm is applied.
expectiles
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. Is overridden by density.
parallel
On Unix machines with the package multicore installed the different expectiles can be calculated simultaneously, if the computer has multiple CPU cores.
density
If TRUE, 99 expectiles from 1% to 99% are fitted to allow for a density estimation afterwards.

Value

  • An object of class 'expectreg', which is basically a list consisting of:
  • lambdaThe 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.
  • interceptsThe intercept for each expectile.
  • coefficientsA matrix of all the coefficients, for each base element a row and for each expectile a column.
  • valuesThe 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.
  • responseVector of the response variable.
  • covariatesList with the values of the covariates.
  • formulaThe formula object that was given to the function.
  • The output of the bundle and restricted function consists of two more elements:
  • trend.coefCoefficients of the trend function.
  • residual.coefVector of the coefficients the residual curve was fitted with.
  • asymmetryVector of the asymmetry factors for all expectiles.
  • A plot method is available.

Details

In least asymmetrically weighted squares (LAWS) each expectile is fitted independently from the others. LAWS minimizes: $S = \sum_{i=1}^{n}{ w_i(p)(y_i - \mu_i(p))^2}$ with $w_i(p) = p 1_{(y_i > \mu_i(p))} + (1-p) 1_{(y_i < \mu_i(p))}$. The restricted version fits the 0.5 expectile at first and then the residuals. Afterwards the other expectiles are fitted as deviation by a factor of the residuals from the mean expectile. This algorithm is based on He(1997). The advantage is that expectile crossing cannot occur, the disadvantage is a suboptimal fit in certain heteroscedastic settings. Also, since the number of fits is significantly decreased, the restricted version is much faster. The expectile bundle has a resemblence to the restricted regression. At first, a trend curve is fitted and then an iteration is performed between fitting the residuals and calculating the deviation factors for all the expectiles until the results are stable. Therefore this function shares the (dis)advantages of the restricted. The expectile sheets construct a p-spline basis for the expectiles and perform a continuous fit over all expectiles by fitting the tensor product of the expectile spline basis and the basis of the covariates. In consequence there will be most likely no crossing of expectiles but also a good fit in heteroscedastic scenarios. "schall" smoothing does not yet work for sheets.

References

Schnabel S and Eilers P (2009) Optimal expectile smoothing Computational Statistics and Data Analysis, 53:4168-4177 He X (1997) Quantile Curves without Crossing The American Statistician, 51(2):186-192 Schnabel S and Eilers P (2010) Non crossing expectiles and quantiles submitted to Journal of Computational and Graphical Statistics

See Also

base, expectile.boost

Examples

Run this code
data(dutchboys)

expreg <- expectile.laws(dutchboys[,3] ~ base(dutchboys[,2],"pspline"),smooth="schall",expectiles=c(0.05,0.2,0.8,0.95))

exprest <- expectile.restricted(dutchboys[,3] ~ base(dutchboys[,2],"pspline"),smooth="acv")

expbund <- expectile.bundle(dutchboys[,3] ~ base(dutchboys[,2],"pspline"),smooth="none")

Run the code above in your browser using DataLab