[R] Error with caret model

javed khan j@vedbtk111 @end|ng |rom gm@||@com
Fri Dec 25 13:14:25 CET 2020


Thank you  Rui Barradas for your feedback.

I will look into it further based on your suggestion.

Regards
Javed

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Fri, Dec 25, 2020 at 10:08 AM Rui Barradas <ruipbarradas using sapo.pt> wrote:

> Hello,
>
> There are several things wrong with your code and they come from copying
> code found online without really understanding what it is doing.
>
> 1. To rbind NULL with any object will give that object, the NULL object
> will not matter. Therefore, rbind is doing pratically nothing. If the
> second object is a numeric vector, the return value will be that numeric
> vector coerced to matrix.
>
>
> importance <- NULL
> rbind(importance, <any numeric vector>)
>
>
> 2. As for the error message, it's saying that there are no methods
>
> anova.train
> anova.train.formula
>
>
> To see the methods for 'anova' run
>
> methods("anova")
>
>
> Hope this helps,
>
> Rui Barradas
>
> Às 22:36 de 24/12/20, javed khan escreveu:
> > Greetings to everyone
> >
> > I read online about this code:
> >
> >   importance=NULL
> > m= glm (......)
> >   imp= rbind(importance, anova(m, type="2", test="LR"))$"LR Chisq")
> >
> > but I am using caret:
> > model <- train(act_effort ~ ., data = tr,
> >                       method = "rpart",
> >                       tuneLength = 15,
> >                       metric = "RMSE",
> >                       trControl = ctrl)
> > And when I am using like the following,
> >
> > importance=NULL
> > m= glm (......)
> >   imp= rbind(importance, anova(model, type="2", test="LR"))$"LR Chisq")
> >
> > It gives me the error:
> >
> > Error in UseMethod("anova") :
> >    no applicable method for 'anova' applied to an object of class
> > "c('train', 'train.formula')"
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list