Skip to content
Prev 266251 / 398502 Next

Error: bad index in plotmo functions for MARS model (package earth)

On 2011-07-28 12:14:32, Cleber N.Borges wrote:

            
The plotmo function is understandably confused by the fact that the class of
gasoline$NIR is "AsIs".  Here is a work around:

g <- data.frame(octane=gasoline$octane, as.matrix(data.frame(gasoline$NIR)))
colnames(g) <- sub("gasoline.NIR.", "", colnames(g))
mars <- earth(octane ~ ., data=g, degree=2)
plotmo(mars, clip=F)

Earth is not suited to highly collinear data like this.  Note that
summary(lm(octane ~ ., data=g)) gives
"ALL 60 residuals are 0: no residual degrees of freedom"

I will issue a new version of plotmo with better error handling for this
problem.  I have cc'ed this email to the maintainer of the pls package to
let them know that the gasoline data has a strange class.  Cleber, per the
posting guide you should have sent your email directly to me, the author of
the plotmo package, and not to r-help, so let's continue any further
discussion off the list.  Feel free to contact me if you have further
questions.

Regards,
Steve Milborrow
www.milbo.users.sonic.net