376
Shalabh and S. S. Dhar
In practice, an experimenter would be more interested in finding out the value of
ˆ
β lasso and hence we extract the values of ˆ
β lasso by adding $beta in the lasso()
command as follows with following outcome:
> lasso(X, y, family = "gaussian", impl = "cpp", lambda.min.ratio =
1e-04, nlambda = 5, lambda = NULL, warm = "lambda")$beta
6.85140739126796 0.685140739126797 0.0685140739126797 0.00685140739126797 0.000685140739126797
[1,]
0
0.595512226
1.227395626
1.2858825615
1.2905954387
[2,]
0
0.403999981
0.453016174
0.4543377503
0.4561473537
[3,]
0
0.816642613
1.037961474
1.0652759794
1.0675364769
[4,]
0
0.000000000
-0.002455242
-0.0029920340
-0.0030376354
[5,]
0
0.000000000
0.000000000
0.0001125857
0.0001485722
[6,]
0
0.005371423
0.003811968
0.0036114497
0.0035890369
The screenshot of this outcome, when executed over the R software, is as follows:
The next question is how to draw conclusions and make a decision from this outcome. The rule is to look for those values in the columns, which are close to zero. The
variables corresponding to these zero values are ignored, and variables corresponding
to non-zero values are retained. The first row gives five values of λ corresponding to
nlambda = 5 as follows: 6.85140739126796, 0.685140739126797,
Shalabh and S. S. Dhar
In practice, an experimenter would be more interested in finding out the value of
ˆ
β lasso and hence we extract the values of ˆ
β lasso by adding $beta in the lasso()
command as follows with following outcome:
> lasso(X, y, family = "gaussian", impl = "cpp", lambda.min.ratio =
1e-04, nlambda = 5, lambda = NULL, warm = "lambda")$beta
6.85140739126796 0.685140739126797 0.0685140739126797 0.00685140739126797 0.000685140739126797
[1,]
0
0.595512226
1.227395626
1.2858825615
1.2905954387
[2,]
0
0.403999981
0.453016174
0.4543377503
0.4561473537
[3,]
0
0.816642613
1.037961474
1.0652759794
1.0675364769
[4,]
0
0.000000000
-0.002455242
-0.0029920340
-0.0030376354
[5,]
0
0.000000000
0.000000000
0.0001125857
0.0001485722
[6,]
0
0.005371423
0.003811968
0.0036114497
0.0035890369
The screenshot of this outcome, when executed over the R software, is as follows:
The next question is how to draw conclusions and make a decision from this outcome. The rule is to look for those values in the columns, which are close to zero. The
variables corresponding to these zero values are ignored, and variables corresponding
to non-zero values are retained. The first row gives five values of λ corresponding to
nlambda = 5 as follows: 6.85140739126796, 0.685140739126797,
