我收到以下错误: $ operator对原子矢量无效。我在尝试计算逻辑回归模型的预测误差时遇到错误。
以下是我使用的代码和数据:
install.packages("ElemStatLearn")
library(ElemStatLearn)
# training data
train = vowel.train
# only looking at the first two classes
train.new = train[1:3]
# test data
test = vowel.test
test.new = test[1:3]
# performing the logistic regression
train.new$y <- as.factor(train.new$y)
mylogit <- glm(y ~ ., data = train.new, family = "binomial")
train.logit.values <- predict(mylogit, newdata=test.new, type = "response")
# this is where the error occurs (below)
train.logit.values$se.fit
我试图将其列入类型列表,但这似乎不起作用,我想知道是否有快速修复,以便我可以获得预测错误或错误分类率。