My magelastbirth_pctl is a categorical variable with 5 levels. I want to calculate the hazard ratio of the 4 last categories compared to the first categories using Fine and Gray competing risk model.
This is easy to do with normal cox model using the following code
elcs.cox_CoD = coxph(Surv(fuptime, status_CoD==17) ~ factor(magelastbirth_pctl) + factor(magefirstbirth_pctl) + totchildren + prochildrendeceased_bef18 + byr_cat + factor(npses_husb_high_qtl), data = elcs6)
However, I don't know how to do it using crr command. It works if I treat the magelastbirth_pctl as a continuous variable per the following code
elcs.cmprsk = crr(ftime=elcs6$fuptime, fstatus=elcs6$status_CoD, failcode=1, cencode=0, cov1=elcs.cov)
I tried to use the FGR command of the riskRegressions package
test = FGR(Hist(fuptime,status_CoD)~factor(magelastbirth_pctl)+factor(magefirstbirth_pctl) + totchildren + prochildrendeceased_bef18 + byr_cat, data=elcs6)
but it kept giving me the error "Argument cause missing. Analyse cause: 1"
Anybody knows what I'm doing wrong? There are surprisingly limited examples in cmprsk and none of them mentioned categorical data.