看板 R_Language 關於我們 聯絡資訊
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://www.ptt.cc/bbs/R_Language/M.1507431994.A.4B0.html ※ 編輯: ciuhkimo (111.254.60.115), 10/08/2017 11:06:59
andrew43: 沒用過,但看help中例子你是不是少了predRisk()的過程? 10/11 16:27
ciuhkimo: 它是利用predRisk去建立二組model,但是我用另外的方法 10/11 21:22
ciuhkimo: 建立以及用它的範例建立,會出現如上結果 10/11 21:22
andrew43: 其實length(m1)不是你想的那樣。 10/11 22:05
andrew43: 你應該檢查 m1$model 的 nrow,之類的。 10/11 22:07
andrew43: 但你說你看length(m1)是149... 真的嗎? 10/11 22:08
andrew43: 照理說 length(m1) 是 glm/lm 物件的 list 格數 10/11 22:10