作者ciuhkimo (羽化新生)
看板R_Language
标题[问题] PredeictABEL coding
时间Sun Oct 8 11:06:27 2017
ctrl + y 可以删除一整行,请将不需要的内容删除
使用PredictABEL package时,出现
Error in table(c1, c2, data[, cOutcome]) :
all arguments must have the same length
但是我分别用length(c1), length(c2), length(cOutcome),结果都是相同的
想请问问题可能在哪里?
[问题类型]:
请把以下不需要的部份删除
经验谘询:IDI_NRI计算作表格
[软体熟悉度]:
新手入门
[问题叙述]:
使用PredictABEL跑IDI_NRI统计评估model
[程式范例]:
请把以下不需要的部份删除
coding:
library(PredictABEL)
m1 <- glm(d ~ va1, family=binomial(logit), data=dt)$fitted
m2 <- glm(d ~ va1 + GM, family=binomial(logit), data=dt)$fitted
value<-as.vector(quantile(m1))
cutoff <- c(0,value[2],value[3],value[4],1)
length(m1) # 确定length是否一样:149
length(m2) # 确定lenght:149
length(dt$va1) #length: 149
reclassification(predrisk1 = m1, predrisk2=m2,cOutcome = 3,
data = dt, cutoff = cutoff) # cOutcome =3, 第3栏为va1
Output:
_________________________________________
Reclassification table
_________________________________________
Error in table(c1, c2, data[, cOutcome]) :
all arguments must have the same length
length不是都一样?我也有用na.omit()去把可能的NA值去掉了,
但是仍然无法
[关键字]:
PredictABEL, IDI, NRI, model
选择性,也许未来有用
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 111.254.60.115
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/R_Language/M.1507431994.A.4B0.html
※ 编辑: ciuhkimo (111.254.60.115), 10/08/2017 11:06:59
1F:→ andrew43: 没用过,但看help中例子你是不是少了predRisk()的过程? 10/11 16:27
2F:→ ciuhkimo: 它是利用predRisk去建立二组model,但是我用另外的方法 10/11 21:22
3F:→ ciuhkimo: 建立以及用它的范例建立,会出现如上结果 10/11 21:22
4F:→ andrew43: 其实length(m1)不是你想的那样。 10/11 22:05
5F:→ andrew43: 你应该检查 m1$model 的 nrow,之类的。 10/11 22:07
6F:→ andrew43: 但你说你看length(m1)是149... 真的吗? 10/11 22:08
7F:→ andrew43: 照理说 length(m1) 是 glm/lm 物件的 list 格数 10/11 22:10