Description Usage Arguments Details Value Author(s) References See Also Examples
Function used to define the smooth term (via P-splines) within the gcrq formula. The function actually does not evaluate a (spline) smooth, but simply it passes relevant information to proper fitter functions.
1 2 3 |
... |
The quantitative covariate supposed to have a nonlinear relationships with the quantiles. In growth charts this variable is typically the age. |
lambda |
A supplied smoothing parameter for the smooth term. If it is negative scalar, the smoothing parameter is estimated iteratively as discussed in Muggeo et al. (2020). If a positive scalar, it represents the actual smoothing parameter. If it is a vector, cross validation is performed to select the ‘best’ value. See Details in |
d |
The difference order of the penalty. Default to 3. |
by |
if different from |
ndx |
The number of intervals of the covariate range used to build the B-spline basis. Non-integer values are rounded by |
deg |
The degree of the spline polynomial. Default to 3. The B-spline basis is composed by |
knots |
The knots locations. If |
monotone |
Numeric value to set up monotonicity restrictions on the first derivative of fitted smooth function
|
concave |
Numeric value to set up monotonicity restrictions on the second derivative of fitted smooth function
|
var.pen |
A character indicating the varying penalty. See Details. |
pen.matrix |
if provided, a penalty matrix A, say, such that A'A is the penalty matrix actually used in the estimation process. It overwrites |
dropc |
logical. Should the first column of the B-spline basis be dropped for the basis identifiability? Default to |
center |
logical. If |
K |
A factor tuning selection of wiggliness of the smoothed curve. The larger |
ridge |
logical. If |
decompose |
logical. If |
When lambda
=0 an unpenalized fit is obtained. At 'middle' lambda values, the fitted curve is a piecewise polynomial of order d-1
.
The fit gets smoother as lambda increases, and for a very large value of lambda, it approaches to a polynomial of degree d-1
.
It is also possible to put a varying penalty to set a different amount of smoothing. Namely for a
constant smoothing (var.pen=NULL
) the penalty is lambda sum_k |Δ^d_k| where
Delta^d_k is the k-th difference (of order d
) of the spline coefficients. For instance if d=1,
|Δ^1_k|=|b_k-b_{k-1}| where the b_k are the spline coefficients.
When a varying penalty is set, the penalty becomes lambda sum_k |Δ^d_k| w_k.
The weights w_k depend on var.pen
; for instance var.pen="((1:k)^2)"
results in w_k=k^2. See model m5
in examples of gcrq
.
The function simply returns the covariate with added attributes relevant to smooth term.
Vito M. R. Muggeo
Muggeo VMR, Torretta F, Eilers PHC, Sciandra M, Attanasio M (2020). Multiple smoothing parameters selection in additive regression quantiles, Statistical Modelling, to appear.
For a general discussion on using B-spline and penalties in regression model see
Eilers PHC, Marx BD. (1996) Flexible smoothing with B-splines and penalties. Statistical Sciences, 11:89-121.
1 2 3 4 5 | ##see ?gcrq
##gcrq(y ~ ps(x),..) #it works (default: center = TRUE, dropc = TRUE)
##gcrq(y ~ 0 + ps(x, center = TRUE, dropc = FALSE)) #it does NOT work
##gcrq(y ~ 0 + ps(x, center = FALSE, dropc = FALSE)) #it works
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.