2

larsRのパッケージでなげなわ回帰の係数を取得する方法を教えてもらえますか?

たとえば、コードが次のような場合:

     test_lasso=lars(A,B)

ありがとうございました。

4

1 に答える 1

3
   #First get cross validation score: 
   test_lasso_cv=cv.lars(A,B)

   # Find the best one
   bestfraction = test_lasso_cv$index[which.min(test_lasso_cv$cv)]

   #Find Coefficients
   coef.lasso = predict(test_lasso,A),s=bestfraction,type="coefficient",mode="fraction")
于 2014-09-02T09:54:00.520 に答える