# Methods_LASSO: LASSO methods In SFSI: Sparse Family and Selection Index

## Description

Predicted values for a provided matrix of predictors `X`

## Usage

 ```1 2``` ```## S3 method for class 'LASSO' fitted(object, ...) ```

## Arguments

 `object` An object of the class 'LASSO' returned either by the function 'lars2' or 'solveEN' `...` Other arguments: `X` (numeric matrix) scores for as many predictors there are in `ncol(object\$beta)` (in columns) for a desired number `n` of observations (in rows)

## Value

Returns a matrix that contains, for each value of lambda (in columns), the predicted values corresponding to each row of the matrix `X`

## Author(s)

Marco Lopez-Cruz (maraloc@gmail.com) and Gustavo de los Campos

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24``` ``` require(SFSI) data(wheatHTP) y = as.vector(Y[,"E1"]) # Response variable X = scale(X_E1) # Predictors # Training and testing sets tst = seq(1,length(y),by=3) trn = seq_along(y)[-tst] # Calculate covariances in training set XtX = var(X[trn,]) Xty = cov(y[trn],X[trn,]) # Run the penalized regression fm = solveEN(XtX,Xty,alpha=0.5) # Predicted values yHat1 = fitted(fm, X=X[trn,]) # training data yHat2 = fitted(fm, X=X[tst,]) # testing data # Penalization vs correlation plot(-log(fm\$lambda[-1]),cor(y[trn],yHat1[,-1]), main="training") plot(-log(fm\$lambda[-1]),cor(y[tst],yHat2[,-1]), main="testing") ```

SFSI documentation built on Oct. 1, 2021, 1:08 a.m.