Estimate the B-spline coefficients for a regression quantile smoothing spline with optional constraints, using Ng(1996)'s algorithm.
drqssbc2(x, y, w = rep.int(1,n), pw, knots, degree, Tlambda,
constraint, ptConstr, maxiter = 100, trace = 0,
nrq = length(x), nl1, neqc, niqc, nvar,
tau = 0.5, select.lambda, give.pseudo.x = FALSE,
rq.tol = 1e-8 * sc.y, tol.0res = 1e-6,
print.warn = TRUE, rq.print.warn = FALSE)
a list with components
Description of `comp1'
Description of `comp2'
...
numeric vector, sorted increasingly, the abscissa values
numeric, same length as x
, the observations.
numeric vector of weights, same length as x
, as in
cobs
.
penalty weights vector passed to l1.design2
or
loo.design2
. FIXME: This is currently unused.
numeric vector of knots for the splines.
integer, must be 1 or 2.
vector of smoothing parameter values \(\lambda\); if it is longer than one, an “optimal” value will be selected from these.
see cobs
(but cannot be abbreviated here).
list
of pointwise constraints;
notably equal
, smaller
, greater
and gradient
are 3-column matrices specifying the respective constraints. May have
0 rows if there are no constraints of the corresponding kind.
maximal number of iterations; defaults to 100.
integer or logical indicating the tracing level of the underlying algorithms; not much implemented (due to lack of trace in quantreg ...)
integer, \(= n\), the number of observations.
integer, number of observations in the l1 norm that correspond to roughness measure (may be zero).
integer giving the number of equations.
integer giving the number of inequality
constraints; of the same length as constraint
.
integer giving the number of equations and constraints.
desired quantile level; defaults to 0.5 (median).
logical indicating if an optimal lambda should be
selected from the vector of Tlambda
.
logical indicating if the pseudo design matrix \(\tilde{X}\) should be returned (as sparse matrix).
numeric convergence tolerance for the interior point
algorithm called from rq.fit.sfnc()
or
rq.fit.sfn()
. Note that (for scale
invariance) this has to be in units of y
, which the default
makes use of.
tolerance used to check for zero residuals, i.e., \(|r_i| < tol * mean(|r_i|)\).
logical indicating if warnings should be printed, when the algorithm seems to have behaved somewhat unexpectedly.
logical indicating if warnings should be printed
from inside the rq.*
function calls, see below.
Pin Ng; this help page: Martin Maechler.
This is an auxiliary function for cobs
, possibly
interesting on its own. Depending on degree
, either
l1.design2
or loo.design2
are
called for construction of the sparse design matrix.
Subsequently, either rq.fit.sfnc
or
rq.fit.sfn
is called as the main “work horse”.
This documentation is currently sparse; read the source code!
Ng, P. (1996) An Algorithm for Quantile Smoothing Splines, Computational Statistics & Data Analysis 22, 99--118.
The main function cobs
and its auxiliary
qbsks2
which calls drqssbc2()
repeatedly.
l1.design2
and loo.design2
;
further rq.fit.sfnc
and
rq.fit.sfn
from package quantreg.
set.seed(1243)
x <- 1:32
fx <- (x-5)*(x-15)^2*(x-21)
y <- fx + round(rnorm(x,s = 0.25),2)
Run the code above in your browser using DataLab