View source: R/experiment_utils.R
ridge_update | R Documentation |
Given previous matrices and a new observation, updates the matrices for ridge regression.
ridge_update(R_A, b, xs, t, yobs, alpha)
R_A |
Matrix. Current matrix |
b |
Numeric vector. Current vector |
xs |
Matrix. Covariates of shape |
t |
Integer. Current time or instance. |
yobs |
Numeric vector. Observed outcomes, length |
alpha |
Numeric. Ridge regression regularization parameter. Default is 1. |
A list containing updated matrices R_A
, R_Ainv
, b
, and theta
.
set.seed(123)
p <- 3
K <- 5
init <- ridge_init(p, K)
R_A <- init$R_A[[1]]
b <- init$b[1, ]
xs <- matrix(runif(10 * p), nrow = 10, ncol = p)
yobs <- runif(10)
t <- 1
alpha <- 1
updated <- ridge_update(R_A, b, xs, t, yobs[t], alpha)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.