0

我在 R 中使用 MASS 包。我在下面的值上使用 polr 运行有序 logit。但是,所有预测值都聚集在第 6 类中。我做错了吗?

x = rbind(
cbind(rep(1,1), runif(1,8.81,8.81)),
cbind(rep(2,63), runif(63,-2.25,12.84)),
cbind(rep(3,117), runif(117,0.11,15.87)),
cbind(rep(4,204), runif(204,-6.56,12.28)),
cbind(rep(5,291), runif(291,-4.05,26.97)),
cbind(rep(6,498), runif(498,-12.04,21.22)),
cbind(rep(7,69), runif(69,-13.94,11.5))
)

x=x[sort.list(x[,1]),]    
colnames(x) = c("y","x1")

p = polr(as.factor(y)~., x1)

table(predict(p))
4

0 回答 0