| RAP {rRAP} | R Documentation | 
Initialization of a RAP object
Description
This function initializes and RAP object. This contains a Lasso regression model together with methods to iteratively update the regularization parameter.
Usage
RAP(X, y, r = 0.95, eps = 0.01, l0 = 0.1, Approx = FALSE)
Arguments
| 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. | 
Details
See Monti et al, "A framework for adaptive regularization in streaming Lasso models", 2016
Value
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 | 
Note
Warning that this implementation uses the shooting algorithm (co-ordinate gradient descent) to update regression coefficients. A more efficient implementation would employ stochastic gradient descent.
Author(s)
Ricardo Pio Monti
References
Monti et al, "A framework for adaptive regularization in streaming Lasso models", 2016
See Also
Examples
  # 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)