Error using the reclassification table from predictABEL, arguments do not have the same length

Hi ,
im trying to compare different risk models with NRI categorical. using the predictABEL. When i run the reclassification table i get an error that the arguments do not have the same length. I checked the vectors for predrisk 1 and 2 , same as for the cOutcome which all have the same length. I don't see my error . So crazy, because a month ago the code worked on my data.

I posted the code, the error and the dput file below.I know type of event has NA but i don't use them in my codes.

library(PredictABEL)
### 1.1  versus 1.1 +CAC model

logistic.model.list <- 
  list(Basic_m = glm(Data$Event11 ~ gender + Age_at_scan + RF_currentsmoking  + RF_DM_combi + PTP_cat, data = Data, family = binomial), 
       New_m   = glm(Data$Event11 ~ gender + Age_at_scan + RF_currentsmoking  + RF_DM_combi + PTP_cat + CAC_cat, 
                 data = Data, family = binomial) )

reclassification(data = Data, cOutcome = 4, 
                 predrisk1 = fitted(logistic.model.list[["Basic_m"]]), 
                 predrisk2 = fitted(logistic.model.list[["New_m"]]), 
                 cutoff = c(0, 0.05, 0.15, 1)

Reclassification table


Error in table(c1, c2, data[, cOutcome]) : all arguments must have the same length`

dput(my_data)
structure(list(key = c(163, 315, 524, 553, 667, 724, 786, 1017,
1420, 1431, 1476, 1496, 1547, 1556, 1580, 1592, 1667, 1754, 1849,
2013, 2020, 2067, 2337, 2401, 2549, 2550, 2650, 2659, 2770, 2775,
2836, 2851, 3034, 3099, 3102, 3152, 3268, 3517, 3656, 3807, 3854,
4143, 4215, 4224, 4311, 4363, 4384, 4483, 4597, 4649), Event11 = c(0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0), Event12 = c(0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
time_event_11 = c(10.0056468172485, 3.1170431211499, 5.91786447638604,
2.12183436002738, 11.7794984409461, 1.06639288158795, 12.318769488174,
7.8014525819454, 11.2014677922275, 9.01704502243517, 7.28678986995209,
1.22381930184805, 10.6984941820671, 11.5482546201232, 10.2110997033996,
8.07118412046543, 7.45106091718001, 8.04011521788735, 8.68040915658985,
5.33196440793977, 2.39014373716632, 10.9803216974675, 9.50444900752909,
10.6848619666894, 11.4203874819377, 10.868210510305, 8.39536656779983,
3.15537303216975, 6.34360027378508, 6.22724161533196, 4.02076203513569,
7.77960301163587, 8.68306525211037, 7.41683778234086, 2.45037645448323,
9.48208989276745, 11.937029431896, 2.68789451669322, 0.0602327173169062,
7.38827857631765, 10.7583941744619, 6.17014601870859, 7.0403832991102,
10.555226633204, 7.63997262149213, 8.93474788957341, 11.709787816564,
10.848733744011, 8.34933264887064, 9.66636246102359), time_event_12 = c(10.0056468172485,
3.1170431211499, 5.91786447638604, 2.12183436002738, 11.7794984409461,
1.06639288158795, 12.318769488174, 7.8014525819454, 11.2014677922275,
9.01704502243517, 7.19104114381328, 1.22381930184805, 10.6984941820671,
11.5482546201232, 10.2110997033996, 8.07118412046543, 7.45106091718001,
8.04011521788735, 8.68040915658985, 5.33196440793977, 2.39014373716632,
10.9803216974675, 9.50444900752909, 2.63381245722108, 11.4203874819377,
10.868210510305, 8.39536656779983, 3.15537303216975, 6.34360027378508,
6.22724161533196, 4.02076203513569, 7.77960301163587, 8.68306525211037,
7.41683778234086, 2.45037645448323, 9.48208989276745, 11.937029431896,
2.68789451669322, 0.0602327173169062, 7.38827857631765, 10.7583941744619,
6.17014601870859, 7.0403832991102, 10.555226633204, 7.63997262149213,
8.93474788957341, 11.709787816564, 10.848733744011, 8.34933264887064,
9.66636246102359), Age_at_scan = c(36.9185489390828, 60.9077116130504,
85.0199263568839, 70.9418206707734, 69.0443759981748, 73.9480568864553,
62.0630846452202, 80.0781056861105, 66.2409308692676, 59.158224960073,
60.6913073237509, 65.4525439196897, 45.8741729409081, 46.4271047227926,
77.8631843993206, 60.6365503080082, 67.0294318959617, 54.84610997034,
63.5168834131873, 61.8466803559206, 61.1157882728725, 47.8124572210815,
58.1972393337896, 74.2273185540092, 76.9761207442898, 55.2951174994296,
42.1342687656856, 72.570841889117, 53.7659137577002, 79.9822809085609,
80.026086521155, 68.732489162674, 59.738649326945, 40.8036732831394,
72.7132870687251, 63.3771389459274, 57.5675336527493, 54.5668491900525,
74.2081527112329, 47.9576773899156, 58.684462696783, 58.1067761806982,
82.6216831444723, 59.4537987679671, 73.5921371713945, 63.2867898699521,
65.2169746748802, 59.2650011407712, 53.7591832078485, 59.9823180469998
), gender = structure(c(1L, 2L, 1L, 2L, 2L, 2L, 1L, 2L, 1L,
1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 2L, 1L, 1L, 2L, 1L, 2L,
1L, 1L, 2L, 1L, 2L, 2L, 1L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 1L,
1L, 2L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L), levels = c("men",
"women"), class = "factor"), BMI = c(23.0577256944444, 22.4058769513315,
23.9868703446535, 37.7777777777778, 24.1588179685585, 28.0557057869118,
23.9389897746315, 25.4028160836116, 29.8027757487217, 23.9590942293645,
22.038567493113, 27.4725274725275, 26.8809349890431, 27.4238227146814,
28.515625, 25.8477682188187, 29.0547520661157, 36.9321237763993,
27.6360544217687, 41.6666666666667, 36.4197530864198, 33.802055164954,
22.2569083130998, 24.8015873015873, 34.1985568209022, 26.2975778546713,
22.8373702422145, 21.7180660897457, 31.25, 23.4375, 22.0931700542861,
24.8356464572681, 32.6530612244898, 22.3402970655718, 22.038567493113,
35.8782454380618, 27.1707711874205, 27.1731016154558, 26.0043827611395,
38.5343428880476, 30.1102788964583, 21.5450907971684, 23.0545624644993,
25.5102040816327, 25.2493372048984, 22.0931700542861, 28.0403781445281,
24.7842575173938, 26.7755102040816, 22.5308641975309), RF_currentsmoking = structure(c(2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L), levels = c("No", "Yes"), class = "factor"),
RF_DM_combi = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), levels = c("No",
"Yes"), class = "factor"), RF_hypercholesterolmia_combi = structure(c(1L,
1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L,
2L, 1L, 2L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L,
1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 1L, 1L,
2L, 2L, 2L, 1L), levels = c("No", "Yes"), class = "factor"),
RF_hypertension_combi = structure(c(1L, 1L, 1L, 1L, 1L, 1L,
2L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 1L, 2L,
1L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 2L,
1L, 2L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 2L, 1L, 2L, 2L, 2L), levels = c("No",
"Yes"), class = "factor"), RF_first_degree_CAD_combi = structure(c(2L,
1L, 2L, 1L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L,
2L, 2L, 2L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L,
1L, 2L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 1L, 2L, 2L, 1L, 1L, 1L,
1L, 1L, 2L, 1L), levels = c("No", "Yes"), class = "factor"),
Med_aspirin_combi = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 1L,
1L, 2L, 1L, 2L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L,
2L, 2L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, 1L,
2L, 2L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 1L, 2L), levels = c("No",
"Yes"), class = "factor"), Med_beta_combi = structure(c(1L,
1L, 2L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 1L,
1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L,
1L, 1L, 2L, 1L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 1L,
2L, 1L, 1L, 2L), levels = c("No", "Yes"), class = "factor"),
Med_stat_combi = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 1L,
1L, 2L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 1L,
1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L,
2L, 1L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 2L, 1L), levels = c("No",
"Yes"), class = "factor"), Med_ACE_combi = structure(c(1L,
1L, 1L, 1L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L,
1L, 1L, 1L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L,
2L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 1L,
1L, 2L, 1L, 1L), levels = c("No", "Yes"), class = "factor"),
new_RMcategories = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), levels = c("Normal scan",
"Irreversible", "Ischemia"), class = "factor"), New_combi = structure(c(4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L), levels = c("Normal scan", "moderate defect",
"Moderate ischemia", "small defect", "Small ischemia"), class = "factor"),
Isch_size = c("Normal", "Normal", "Normal", "Normal", "Normal",
"Normal", "Normal", "Normal", "Normal", "Normal", "Normal",
"Normal", "Normal", "Normal", "Normal", "Normal", "Normal",
"Normal", "Normal", "Normal", "Normal", "Normal", "Normal",
"Normal", "Normal", "Normal", "Normal", "Normal", "Normal",
"Normal", "Normal", "Normal", "Normal", "Normal", "Normal",
"Normal", "Normal", "Normal", "Normal", "Normal", "Normal",
"Normal", "Normal", "Normal", "Normal", "Normal", "Normal",
"Normal", "Normal", "Normal"), Complaints_2019 = structure(c(3L,
1L, 4L, 4L, 1L, 1L, 1L, 4L, 1L, 3L, 3L, 1L, 3L, 3L, 2L, 3L,
1L, 3L, 4L, 1L, 1L, 1L, 3L, 3L, 1L, 3L, 1L, 1L, 3L, 2L, 1L,
1L, 1L, 1L, 3L, 2L, 1L, 3L, 1L, 1L, 4L, 1L, 3L, 3L, 1L, 1L,
4L, 1L, 3L, 4L), levels = c("aspecific chestpain", "typical AP",
"atypical AP", "Dyspnea"), class = "factor"), PTP_cat = structure(c(1L,
2L, 3L, 2L, 2L, 2L, 3L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L,
3L, 2L, 2L, 3L, 3L, 1L, 3L, 3L, 3L, 3L, 1L, 3L, 2L, 3L, 3L,
3L, 1L, 1L, 3L, 3L, 2L, 3L, 3L, 1L, 2L, 2L, 3L, 2L, 3L, 3L,
2L, 2L, 3L, 3L), levels = c("5", "515", "15"), class = "factor"),
CAC_cat = structure(c(2L, 2L, 5L, 4L, 3L, 2L, 3L, 2L, 5L,
3L, 4L, 4L, 2L, 1L, 3L, 1L, 5L, 2L, 4L, 4L, 3L, 1L, 5L, 5L,
3L, 3L, 1L, 2L, 2L, 5L, 5L, 5L, 2L, 1L, 4L, 3L, 2L, 4L, 3L,
3L, 3L, 4L, 2L, 2L, 4L, 3L, 1L, 4L, 3L, 2L), levels = c("0",
"1", "2", "3", "4"), class = "factor"), Type_event12 = structure(c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_), levels = c("ACS",
"late revasc", "CD", "no event"), class = "factor"), Type_event11 = structure(c(3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, NA, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, NA, 3L, 3L, 3L, 3L, 3L, 3L, NA, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, NA, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L), levels = c("ACS", "cardiac death", "no event"
), class = "factor")), row.names = c(NA, -50L), class = c("tbl_df",
"tbl", "data.frame"))

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.