# LARS vs LASSO and Cross-validation

I would like to apply lars algorithm to some datadset.

First, I fitted the model to the training set and then examined it on test set.

My questions:

1- After I used cross validation "cv.lars" I dont know how to choose the minimum cross validation error in order to choose best model. while it is clear when I used glmnet by writing in R program cv$lambda.min then after getting the minimum value I fitted the model on this value. So How do I select the minimum value based on cross validation. E.g coef<- predict(lar, type="coef",s=?? mode="norm",newx=x[testset,])  I want to choose the best value of s (we can also called it$\lambda\$) based on cross-validation.

This is the cross validation plot

2- I also plotted lars and lasso, but i did not see any differences.

Could you clarify the differences between them please?

3- By using glmnet function, I can plot lambda values on the x-axis. Does this work with lars function?

4-How to calculate the mean squared error on the test set?

1- You can choose the minimum based on the CP values or you can use "which.min".

2- I have no idea about it.

3- I do not think that you can plot lambda on the x-axis.

4- Computing the MSE of any regression model on some test set: $$\frac{1}{N}\sum\limits_{i=1}^N(\hat{y}_i-y_i)^2,$$ where $$\hat{y}_i$$ are the predicted values and $$y_i$$ are the observed values. Thus, you can write this formula in R program manually.

mean((predicted(y_i)-observed(y_i))^2)