awsh {aws}R Documentation

Univariate local polynomial Adaptive Weights Smoothing for regression with heteroscedastic additive errors


This function implements a univariate local polynomial Adaptive Weights Smoothing procedure for regression problems with heteroskedastic additive errors as described in Polzehl & Spokoiny (2003).


awsh(y, x = NULL, p = 0, sigma2 = NULL, qlambda = NULL, eta = 0.5, tau = NULL,
lkern = "Triangle", hinit = NULL, hincr = NULL, hmax = 100, hmaxs= 2*hmax, u = NULL,
graph = FALSE, demo = FALSE, symmetric = NULL, conf = FALSE, qconf = 0.95, alpha = 2)


y y contains the observed values (regression function plus errors). In case of x=NULL (second parameter) y is assumed to be observed on a one-dimensional grid.
x x is either NULL, in this case y is assumed to be observed on a grid, or is a vector determining the design.
p p is the degree of the polynomial model to use. For univariate regression p can be an nonnegative integer less or equal than 5.
sigma2 sigma2 can be used to provide an estimate for the error variance. If is.null(sigma2) a homoskedastic model is assumed and a variance estimate is generated from the data. If length(sigma2)==length(y) this parameter provides variances at the design points.
qlambda qlambda determines the scale parameter qlambda for the stochastic penalty. The scaling parameter in the stochastic penalty lambda is choosen as the qlambda-quantile of a Chi-square-distribution with number of parameters in the polynomial model as degrees of freedom. If is.null(qlambda) a standard value depending on p is choosen.
eta eta is a memory parameter used to stabilize the procedure. eta has to be between 0 and 1, with eta=.5 being the default.
tau tau is used in case of a the scale parameter polynomial degree p!=0 only. It is the scale parameter in the extention penalty used to prevent from leverage problems. The default value for tau depends on p and on the number of parameters in the local model.
lkern lkern determines the location kernel to be used. Options are "Uniform", "Triangle", "Quadratic", "Cubic" and "Exponential". Default is "Triangle". The Kernel operates on the squared distance, so "Triangle" corresponds to the use of an Epanechnikov kernel in kernel smoothing. "Exponential" requires larger values of hmax and therefore more iterations to reach comparable results.
hinit hinit Initial bandwidth for the location penalty. Appropriate value is choosen in case of hinit=NULL
hincr hincr hincr is used as a factor to increase the bandwidth between iterations. Defauts to hincr=1.25
hmax hmax Maximal bandwidth to be used. Determines the number of iterations and is used as the stopping rule.
hmaxs hmaxs Maximal bandwidth to be used when estimating the heterogenous variance from consequtive differences of y by function laws. Determines the number of iterations of laws.
u u used to supply values of the true regression function for test purposes to calculate Mean Squared Error (MSE) and Mean Absolute Error (MAE)
graph graph if TRUE results are displayed after each iteration step.
demo demo if TRUE after each iteration step results are displayed and the process waits for user interaction.
symmetric If symmetric==TRUE the stochastic penalty is symmetrized, i.e. (sij + sji)/lambda is used instead of sij/lambda. See references for details. symmetric==FALSE is forced if p!=0
conf conf if TRUE conditional (on weights) confidence intervals are provided at each design point.
qconf qconf determines the level of the conditional (on weights) confidence intervals
alpha alpha Parameter used for a penalized MSE estimate for p=0. This is experimental to try to select hmax.


This function implements an local polynomial adaptive weights smoothing (AWS) procedure for a univariate heteroskedastic regression model. The approach generalizes the original AWS procedure from Polzehl and Spokoiny (2000).

Adaptive weights smoothing is an iterative data adaptive smoothing technique that is designed for smoothing in regression problems with discontinuous regression function. The basic assumption is that the regression function can be approximated by a simple local, e.g. local constant or local polynomial, model. The estimate of the regression function, i.e. the conditional expectation of y given x is computed as a weighted maximum likelihood estimate, with weights choosen in a completely data adaptive way. The procedure is edge preserving. If the assumed local model is globally valid, almost all weights used will be 1, i.e. the resulting estimate almost is the global estimate.

Currently implemented are the following models (specified by parameter p and attributes of x and y) are implemented:

p=0, x=NULL
local constant univariate AWS on a grid. Measurement unit for hinit and hmax is 1 (number grid points within distance h)
p=0, !is.null(x)
local constant AWS for arbitrary design given in x.
univariate local polynomial AWS for arbitrary univariate design given in x. y has to be a vector. If x is provided it has to be a vector of the same length as y. If is.null(x) an equidistant design (grid) with grid-step 1 is assumed.

The essential parameter in the procedure is qlambda. This parameter has an interpretation as a significance level of a test for equivalence of two local parameter estimates. Optimal values mainly depend on the choosen p and the value of symmetric (determines the use of an asymmetric or a symmetrized test). The optimal values only slightly depend on the model parameters, i.e. the default parameters should work in most situations. Larger values of qlambda may lead to oversmoothing, small values of qlambda lead to a random segmentation of homogeneous regions. A good value of qlambda can be obtained by the propagation condition, requiring that in case of global validity of the local model the estimate for large hmax should be equal to the global estimate.

The numerical complexity of the procedure is mainly determined by hmax. The number of iterations is d*log(hmax/hinit)/log(hincr) with d being the dimension of y. Comlexity in each iteration step is Const*hakt*n with hakt being the actual bandwith in the iteration step and n the number of design points. hmax determines the maximal possible variance reduction.


theta Parameter estimates, first dimension corresponds to parameter components
theta Standard deviations (conditional on weights) of parameter estimates, first dimension corresponds to parameter components
y values provided in y
x values provided in x
call actual function call


Joerg Polzehl,,


Polzehl, J. and Spokoiny, V. (2003). Varying coefficient regression modeling by adaptive weights smoothing, WIAS-Preprint 818.
Polzehl, J. and Spokoiny, V. (2000). Adaptive Weights Smoothing with applications to image restoration, J.R.Statist.Soc. B, 62, Part 2, pp.335-354

See Also



##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--    or do  help(data=index)  for the standard data sets.

[Package aws version 1.3-0 Index]