Hello,
I have a dataset of 371 observations.
When I run coxph with numeric variables it works fine.
However, when I try to add factor variables it returns "Ran out of
iterations and the model did not converge"
There is something very strange with the factors - some of them should
actually be numeric and all have a category of (other) with many cases
falling into this category. However, when looking at the data there is no
(other) category, nor are there empty/NA values.
I have tried casting the numeric "factors" into numeric using
as.numeric(levels(dataset$ABS_BLST))[as.integer(dataset$ABS_BLST)] without
success.
Of note, when I restructure all factors to binary variables with dummy and
use glmnet-lasso the model converges.
Here are examples of the code and output (including summary description of
the variables):
> maxSTree.cox <- coxph (Surv(time,status)~Chemo_Simple, data=dataset)
Warning message:
In fitter(X, Y, strats, offset, init, control, weights = weights, :
Ran out of iterations and did not converge
> summary (dataset$Chemo_Simple)
Anthra-HDAC Anthra-Plus ArsenicAtra
ATRA ATRA-GO
0 163 2 12
0 2
ATRA_IDA Demeth-HistoneDAC Flu-HDAC Flu-HDAC-plus
HDAC-Clof HDAC-only
0 34 37 4
24 1
HDAC-Plus LowArac+/- LowDAC-Clof MYLO+IL11
No Rx in MDACC Phase1
4 8 30 5
1 5
SCT StdARAC-Anthra StdAraC-Plus Targeted
VNP40101M
0 0 0 13
23
Error 2:
> maxSTree.cox <- coxph (Surv(time,status)~ABS_BLST, data=dataset)
Error in fitter(X, Y, strats, offset, init, control, weights = weights, :
NA/NaN/Inf in foreign function call (arg 6)
-----------------> for some reason ABS_BLST is a factor and not numeric.
Tried to cast it with as.numeric (didn't work)
> summary (dataset$ABS_BLST)
0 195 153 160 17 192 25 26 2600
300 44 52 96 100
62 3 2 2 2 2 2 2 2
2 2 2 2 1
1020 1037 104 104076 10422 10441 106220 10887 111340
11154 1122 11250 1134 11388
1 1 1 1 1 1 1 1 1
1 1 1 1 1
1140 11427 1148 11577 11726 1176 11834 1188 1200
12012 1218 12222 1224 1232
1 1 1 1 1 1 1 1 1
1 1 1 1 1
128 1287 128860 129 130 132 1320 1326 13440
1347 136 136590 13728 13915
1 1 1 1 1 1 1 1 1
1 1 1 1 1
14 14112 1426 14406 14430 14712 148 1496 150
15184 152 15300 153538 156
1 1 1 1 1 1 1 1 1
1 1 1 1 1
1587 15884 1610 1617 16200 16300 16405 1680 168912
170520 171 17202 17340 1746
1 1 1 1 1 1 1 1 1
1 1 1 1 1
1750 1758 1767 17748 1800 180120 1813 18411 1860
18802 1900 1930 1950 19758
1 1 1 1 1 1 1 1 1
1 1 1 1 1
1980 (Other)
1 195
----------------------------> for some reason it ABS_BLST is a factor
listing (other) 195, but there are only numeric values (when I check the
dataset). as.numeric (dataset$ABS_BLST did not do anything).
HELP !!!!
[[alternative HTML version deleted]]