私は本当にこれに固執してきました、誰もが私を助けることができる願っています!私は54列のデータセットを持っており、リッジ回帰のあるテストセットについて予測したいと考えています。 (また、rsquaredやMAEとしての評価指標で)働くリッジ回帰と予測を行うための別の方法かもしれない何リッジ回帰の予測R
Error in UseMethod("predict") :
no applicable method for 'predict' applied to an object of class "ridgelm"
:私はこれを行うと
nn <-nrow(longley)
index <- 1:nrow(longley)
testindex <- sample(index, trunc(length(index)/3))
testset <- longley[testindex,]
trainset <-longley[-testindex,]
trainset1 <- trainset[,-7]
# Fit the ridge regression model:
mod <- lm.ridge(y ~., data = trainset, lambda = 0.661)
# Predict and evaluate it by using MAE function:
mae <- function(model) {
y = trainset$Employed
y.pred <- predict(model, trainset)
return(mean(abs(y-y.pred)))
}
私は、次のエラーメッセージが表示されますか?