Learn R Programming

npbr (version 1.8)

cub_spline_kn: AIC and BIC criteria for choosing the number of inter-knot segments in cubic spline fits

Description

Computes the optimal number of inter-knot segments for the (un)constrained cubic spline fit proposed by Daouia, Noh and Park (2016).

Usage

cub_spline_kn(xtab, ytab, method, krange = 1:20, type = "AIC", 
 control = list("tm_limit" = 700))

Value

Returns an integer.

Arguments

xtab

a numeric vector containing the observed inputs \(x_1,\ldots,x_n\).

ytab

a numeric vector of the same length as xtab containing the observed outputs \(y_1,\ldots,y_n\).

method

a character equal to "u" (unconstrained estimator), "m" (under the monotonicity constraint) or "mc" (under simultaneous monotonicity and concavity constraints).

krange

a vector of integers specifying the range in which the optimal number of inter-knot segments is to be selected.

type

a character equal to "AIC" or "BIC".

control

a list of parameters to the GLPK solver. See *Details* of help(Rglpk_solve_LP).

Author

Hohsuk Noh.

Details

The implementation of the unconstrained cubic spline smoother \(\tilde\varphi_n\) (see cub_spline_est) is based on the knot mesh \(\{t_j\}\), with \(t_j = x_{[j n/k_n]}\) being the \(j/k_n\)th quantile of the distinct values of \(x_i\) for \(j=1,\ldots,k_n-1\). Because the number of knots \(k_n\) determines the complexity of the spline approximation, its choice may then be viewed as model selection through the minimization of the following two information criteria: $$ AIC(k) = \log \left( \sum_{i=1}^{n} (\tilde \varphi_n(x_i)- y_i) \right) + (k+2)/n,$$ $$BIC(k) = \log \left( \sum_{i=1}^{n} (\tilde \varphi_n(x_i) - y_i) \right) + \log n \cdot (k+2)/2n.$$ The first one (option type = "AIC") is similar to the famous Akaike information criterion (Akaike, 1973) and the second one (option type = "BIC") to the Bayesian information criterion (Schwartz, 1978). For the implementation of the concave cubic spline estimator, just apply the same scheme as for the unconstrained version.

References

Akaike, H. (1973). Information theory and an extension of the maximum likelihood principle, in Second International Symposium of Information Theory, eds. B. N. Petrov and F. Csaki, Budapest: Akademia Kiado, 267--281.

Daouia, A., Noh, H. and Park, B.U. (2016). Data Envelope fitting with constrained polynomial splines. Journal of the Royal Statistical Society: Series B, 78(1), 3-30. doi:10.1111/rssb.12098.

Schwartz, G. (1978). Estimating the dimension of a model, Annals of Statistics, 6, 461--464.

See Also

cub_spline_est.

Examples

Run this code
data("air")
# a. Unconstrained cubic spline fits
(kn.bic.air.u<-cub_spline_kn(air$xtab, air$ytab, 
 method="u", type="BIC"))
# b. Monotone cubic spline smoother
(kn.bic.air.m<-cub_spline_kn(air$xtab, air$ytab, 
 method="m", type="BIC")) 
# c. Monotone and Concave cubic spline smoother
(kn.bic.air.mc<-cub_spline_kn(air$xtab, air$ytab, 
 method="mc", type="BIC"))

Run the code above in your browser using DataLab