Forward pass adding the reflected hinge pair B_m(x) (x_j - t)+, B_m(x) (t -
x_j)+ that most reduces the residual sum of squares (knots at observed
values, at most degree factors, collinear hinges skipped), then backward
deletion keeping the model with the smallest GCV = RSS / (N (1 - M / N)^2), M
= r + c (r - 1) / 2 (ESL sec 9.4, eqs 9.19-9.20).
Usage
morie_esl_mars(
X,
y,
max_terms = 11,
degree = 1,
penalty = NULL,
thresh = 1e-08,
query = NULL
)
Arguments
- X
Predictors, N by p.
- y
Response.
- max_terms
Maximum forward terms including the constant.
- degree
Maximum interaction order.
- penalty
GCV knot cost (default 2 for degree 1, else 3).
- thresh
Relative RSS decrease below which the forward pass stops.
- query
Points to predict (default X).
Value
Named list: terms, coefficients, gcv, rss, fitted, prediction,
forward_terms.
References
Friedman, J. H. (1991). Annals of Statistics 19, 1-67.
Examples
i <- 1:60
X <- cbind(((7 * i) %% 59) / 59 * 3, ((11 * i) %% 61) / 61 * 2)
morie_esl_mars(X, pmax(X[, 1] - 1, 0) + 0.05 * cos(9 * i), max_terms = 5)$terms
#> [[1]]
#> list()
#>
#> [[2]]
#> [[2]][[1]]
#> [[2]][[1]]$j
#> [1] 1
#>
#> [[2]][[1]]$t
#> [1] 1.016949
#>
#> [[2]][[1]]$s
#> [1] 1
#>
#>
#>