E(beta | Z) = (H'H + sigma^2 / tau Sigma^-1)^-1 H'y with covariance (...)^-1
sigma^2, and the posterior mean and sd of mu(x) = h(x)' beta (ESL eqs
8.25-8.28).
Usage
morie_esl_bayes_basis_posterior(H, y, sigma2, tau, Sigma = NULL, Hnew = NULL)
Arguments
- H
Basis, N by p.
- y
Response.
- sigma2
Noise variance.
- tau
Prior scale.
- Sigma
Prior correlation (default identity).
- Hnew
Basis at evaluation points (default H).
Value
Named list: mean, cov, mu_mean, mu_sd.
References
Hastie, Tibshirani & Friedman (2009), sec. 8.3.
Examples
x <- (1:30) / 10
morie_esl_bayes_basis_posterior(cbind(1, x, x^2), sin(x), 0.09, 2)$mean
#> [1] -0.0338170 1.2842951 -0.4098339