aspline {aspline} | R Documentation |
Fit B-splines with automatic knot selection.
aspline(
x,
y,
knots = seq(min(x), max(x), length = 42)[-c(1, 42)],
pen = 10^seq(-3, 3, length = 100),
degree = 3L,
family = c("gaussian", "binomial", "poisson"),
maxiter = 1000,
epsilon = 1e-05,
verbose = FALSE,
tol = 1e-06
)
aridge_solver(
x,
y,
knots = seq(min(x), max(x), length = 42)[-c(1, 42)],
pen = 10^seq(-3, 3, length = 100),
degree = 3L,
family = c("gaussian", "binomial", "poisson"),
maxiter = 1000,
epsilon = 1e-05,
verbose = FALSE,
tol = 1e-06
)
x, y |
Input data, numeric vectors of same length |
knots |
Knots |
pen |
A vector of positive penalty values. The adaptive spline regression is performed for every value of pen |
degree |
The degree of the splines. Recommended value is 3, which corresponds to natural splines. |
family |
A description of the error distribution and link function to be used in the model. The "gaussian", "binomial", and "poisson" families are currently implemented, corresponding to the linear regression, logistic regression, and Poisson regression, respectively. |
maxiter |
Maximum number of iterations in the main loop. |
epsilon |
Value of the constant in the adaptive ridge procedure (see Frommlet, F., Nuel, G. (2016) An Adaptive Ridge Procedure for L0 Regularization.) |
verbose |
Whether to print details at each step of the iterative procedure. |
tol |
The tolerance chosen to diagnostic convergence of the adaptive ridge procedure. |
A list with the following elements:
sel
: list giving for each value of lambda
the vector of the knot selection weights (a knot is selected if its weight is equal to 1.)
knots_sel
: list giving for each value of lambda
the vector of selected knots.
model
: list giving for each value of lambda
the fitted regression model.
par
: parameters of the models for each value of lambda
.
sel_mat
: matrix of booleans whose columns indicate whether each knot is selected.
aic
, bic
, and ebic
: Akaike Information Criterion (AIC), Bayesian Information Criterion (BIC), and Extended BIC (EBIC) scores, for each value of lambda
.
dim
: number of selected knots for each value of lambda
.
loglik
: log-likelihood of the selected model, for each value of lambda
.
aridge_solver
: Alias for aspline
, for backwards compatibility.