Reputation: 11
I am trying to run a competing risk with the cmprsk package but keep getting errors. The last one that I can not solve is this one:
Error in solve.default(h, z[[2]]) : system is computationally singular: reciprocal condition number = 3.7676e-34
here is the code I used.
crr.matrix <- model.matrix(~ a + b + c + d + e -1, data=mydata)
crr(HV_pT1$time,HV_pT1$status,crr.matrix,failcode=2)
Upvotes: 1
Views: 599
Reputation: 70
I know this is an old question but this may be of help to others.
I suspect the issue is with the -1
after the e.
A [,-1]
is required after the covariates. Perhaps this is what you were aiming for with the -1
?.
The [,-1]
removes the constant term from the output of model.matrix e.g.
crr.matrix <- model.matrix(~ a + b + c + d + e, data=mydata)[,-1]
.
It is sensible to also add a cencode = y
after the failcode = x
term.
Upvotes: 1