This function initializes and RAP object. This contains a Lasso regression model together with methods to iteratively update the regularization parameter.
1 
X 
Burn in training data. Can either be a single observation (in this case a matrix with 1 row) or several. This must be a matrix. 
y 
Burn in response data 
r 
Fixed forgetting factor used to update 
eps 
Fixed stepsize used to update regularization parameter 
l0 
Initial guess for regularization parameter 
Approx 
Boolean indicating whether exact or approximate gradient should be calculated when updating regularization parameter. 
See Monti et al, "A framework for adaptive regularization in streaming Lasso models", 2016
A RAP object is returned with the following elements:
r 
Fixed forgetting factor 
eps 
Stepsize used to update regularization parameter 
w 
Current measure of effective sample size 
xbar 

St 

regParam 
Current estimate of regularization parameter 
l1Track 
Vector storing all past estimates of regularization parameter 
beta 
Current estimate of regression coefficients 
Approx 
Boolean indicating if exact or approximate gradients where employed 
The object has the following methods:
update 
Update regularization parameters and regression coefficients based on new data 
predict 
Predict based on current model 
Warning that this implementation uses the shooting algorithm (coordinate gradient descent) to update regression coefficients. A more efficient implementation would employ stochastic gradient descent.
Ricardo Pio Monti
Monti et al, "A framework for adaptive regularization in streaming Lasso models", 2016
1 2 3 4 5 6 7 8 9 10 11 12 13  # Recreate Figure 1 from
library(lars)
data(diabetes)
Data = cbind(diabetes$y, diabetes$x)
# initialize RAP object
R = RAP(X = matrix(diabetes$x[1,], nrow=1), y = diabetes$y[1], r = .995, eps = 0.0005, l0 = .1)
# iteratively update:
## Not run:
for (i in 2:nrow(Data)){
R = update.RAP(RAPobj=R, Ynew = diabetes$y[i], Xnew=matrix(diabetes$x[i,], nrow=1))
}
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.