Dear list,

I have been trying to apply a simple lasso regression on a 10-element
vector, just to see how this method works so as to later implement it on
larger datasets. I thus create an input vector x:
*         x=rnorm(10)*
I add some noise
*        noise=runif(n=10, min=-0.1, max=0.1)*
and I create a simple linear model which calculates my output vector y
*        y=2*x+1+noise*

I then do
       * my_data <- data.matrix(x)
        model = lars(my_data, y, type = 'lasso')*

I then calculate the coefficients (type="coefficients") based on the created
*model **
        preds=predict.lars(model)
        for(i in 1:10){
            est[i]=preds$coef[2]*x[i]
            }

        y.estimated=est+1+noise


*Then, I apply the same function, predict.lars, but this time with
type="fit".
*        preds2=predict.lars(model,my_data)*

When I compare the *y.estimated *to *preds2$fit[,2] *I see that they are not
equal...
I provide you with the returned results:

*y.estimated:*
[2.855597  1.259374  1.673388  1.625999  0.337993 -1.672998
-1.055416 2.423278  4.092116 -1.595545]

*preds2$fit[,2]:*
[2.9120115  1.1790466  1.7452670  1.7239429  0.2893512 -1.6682459
-1.1500982  2.4364527  4.1511509 -1.6098748]

I think they should be equal...Does anyone have an explanation about that?

Thanks a lot for your time!
Eleni C.

	[[alternative HTML version deleted]]


