我正在尝试为概率模型获取混淆矩阵,但是,我得到了下一个错误!实际上,我知道length(Y)大于length(pprobit),但是我不知道如何解决这个问题。
**Probit model coefficients**
probit<- glm(Y ~ X, family=binomial (link="probit"))
**Probit model predicted probabilities**
pprobit<- predict(probit, type="response")
**Percent correctly predicted values**
table(true = Y, pred = round(fitted(probit)))
**Error in table(true = Y, pred = round(fitted(probit))) :
all arguments must have the same length**
我为修复错误所做的尝试:
1. na.omit(y)
2.
tab=table(true = Y[complete.cases(X)], pred = round( fitted(probit ))