1

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)

David
  • 11
  • 2
  • 2
    You should provide a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) when asking for help. There's likely some problem with your data, but without knowing what the data is, it's hard to say for sure. – MrFlick Jun 29 '17 at 21:24

1 Answers1

1

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.

Jon
  • 70
  • 9