Rstudent () for nnet object
I'm trying to estimate the residual normality for three objects: one lm () object, one nnet (), and one randomForest (). For lm () using code:
> qqnorm(rstudent(lmodel)); qqline(rstudent(lmodel))"
it worked fine. But for nnet () and RandomForest () I had no success:
> Error in UseMethod("rstudent") :
no applicable method for 'rstudent' applied to an object of class "nnet"
Does anyone have any suggestions on how to solve this problem?
source to share
rstudent
is a so-called generic function, which means it rstudent
will call another function for different input objects. In computer science, this is known as polymorphism , i.e. rstudent
is a polymorphic function. For example, it rstudent(lm())
will call a function rstudent.lm
.
This particular implementation of a generic function must be written for every object type the function supports and is not automatically generated. The error you get indicates that there is no specific implementation to output your neural network function rstudent
, i.e. No rstudent.nnet
.
The solution is to write this particular implementation yourself or provide an implementation for the maintainer.
source to share