TransWikia.com

Need help with method="leapSeq"

Data Science Asked by 4Walk on March 7, 2021

Here is my code:

ctrl <- trainControl(method = "cv")
fm <- train(y=train.df$Price,x=train.df[,-1], method = "leapSeq", trControl = ctrl)
fm$results
coef(fm$finalModel)

What I get back is this:

      nvmax RMSE Rsquared  MAE RMSESD RsquaredSD MAESD
    1     2 1888    0.760 1315    266     0.0703   130
    2     3 1530    0.842 1171    221     0.0458   157
    3     4 1707    0.809 1231    244     0.0315   132
> coef(fm$finalModel)
Error in coef.regsubsets(fm$finalModel) : 
  argument "id" is missing, with no default

There is no Coefficients tab under finalModel. If I use “lm” for method instead of “leapSeq” the coefficients tab is there in finalModel.

Any guidance is appreciated.

One Answer

you can print the coefficients with:

coef(fm$finalModel,model No. e.g.1)

Answered by Ali Shaha on March 7, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP