Skip to contents

beta by least squares, sigma^2 = RSS / N (or N - p) and se(mu(x)) = sqrt(h' (H'H)^-1 h) sigma with a normal pointwise band (ESL eqs 8.2-8.4).

Usage

morie_esl_basis_fit_se(
  H,
  y,
  Hnew = NULL,
  level = 0.95,
  divisor = c("N", "N-p")
)

Arguments

H

Basis at the training inputs, N by p.

y

Response.

Hnew

Basis at evaluation points (default H).

level

Band level.

divisor

"N" or "N-p".

Value

Named list: beta, sigma2, fit, se, lower, upper.

References

Hastie, Tibshirani & Friedman (2009), sec. 8.2.1.

Examples

x <- (1:30) / 10
morie_esl_basis_fit_se(cbind(1, x, x^2), sin(x), rbind(c(1, 1, 1)))$se
#> [1] 0.003564634