尝试在R中使用gains()函数时出现此错误:
“警告:与请求的组相比,不同的预测值要少”。我使用了summary()函数来确保要比较的两个数据帧的大小相同。
答案 0 :(得分:0)
if (num.groups < groups) { #Just return all distinct scores
warning("Warning: Fewer distinct predicted values than groups requested")
pred.group<-rank(-1*predicted,ties.method="min")
} else if (num.groups == groups) { #Just return all distinct scores
pred.group<-rank(-1*predicted,ties.method="min")
} else {
num.groups<-groups
pred.rank<-total.n+1-rank(predicted,ties.method=ties.method)
pred.group<-ceiling(pred.rank/(total.n/groups)) }