Learn R Programming

cobs (version 1.3-7)

drqssbc2: Regression Quantile Smoothing Spline with Constraints

Description

Estimate the B-spline coefficients for a regression quantile smoothing spline with optional constraints, using Ng(1996)'s algorithm.

Usage

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)

Value

a list with components

comp1

Description of `comp1'

comp2

Description of `comp2'

...

Arguments

x

numeric vector, sorted increasingly, the abscissa values

y

numeric, same length as x, the observations.

w

numeric vector of weights, same length as x, as in cobs.

pw

penalty weights vector passed to l1.design2 or loo.design2. FIXME: This is currently unused.

knots

numeric vector of knots for the splines.

degree

integer, must be 1 or 2.

Tlambda

vector of smoothing parameter values \(\lambda\); if it is longer than one, an “optimal” value will be selected from these.

constraint

see cobs (but cannot be abbreviated here).

ptConstr

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.

maxiter

maximal number of iterations; defaults to 100.

trace

integer or logical indicating the tracing level of the underlying algorithms; not much implemented (due to lack of trace in quantreg ...)

nrq

integer, \(= n\), the number of observations.

nl1

integer, number of observations in the l1 norm that correspond to roughness measure (may be zero).

neqc

integer giving the number of equations.

niqc

integer giving the number of inequality constraints; of the same length as constraint.

nvar

integer giving the number of equations and constraints.

tau

desired quantile level; defaults to 0.5 (median).

select.lambda

logical indicating if an optimal lambda should be selected from the vector of Tlambda.

give.pseudo.x

logical indicating if the pseudo design matrix \(\tilde{X}\) should be returned (as sparse matrix).

rq.tol

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.

tol.0res

tolerance used to check for zero residuals, i.e., \(|r_i| < tol * mean(|r_i|)\).

print.warn

logical indicating if warnings should be printed, when the algorithm seems to have behaved somewhat unexpectedly.

rq.print.warn

logical indicating if warnings should be printed from inside the rq.* function calls, see below.

Author

Pin Ng; this help page: Martin Maechler.

Details

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!

References

Ng, P. (1996) An Algorithm for Quantile Smoothing Splines, Computational Statistics & Data Analysis 22, 99--118.

See Also

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.

Examples

Run this code
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