Problem context: model response variable 'status' for prediction. Help context: Error in UseMethod("predict"). My thinking is that the field 'status' factor is the issue. Need help in detecting issue in predict.
R code:
model.predict <- predict(model.fit, newdata = loans_train_data, type="response")
structure data:
str(loans_train_data)
'data.frame:
$amount:num...
$...
$status: factor w/2 levels "Good", "Bad": 2, 1, 2, 1, 1, 1, 1 ...
Error in UseMethod("predict")
Error in UseMethod("predict") :
no applicable method for 'predict' applied to an object of class "c('double', 'numeric')"
Things that work:
model.lm <- glm2(formula, data=loans_train_data, family="binomial")
model.fit <- fitted(model.lm)
Fails on predict, with Error in UseMethod("predict").
model.predict <- predict(model.fit, newdata=loans_train_data, type="response")
predict
uses, happens on the first argument, not newdata. What isclass(model.fit)
? – smingerson