Function crr from cmprsk package with categorical variable
0
0
Entering edit mode
15 months ago
Bine ▴ 60

Dear Community,

I would be really happy if you could help me with this:

I have built a "Fine & Grey"(crr) - model and I would like to double check if it makes sense since I found only one example online.

I have the variables sex (female/male), age(continuous variable), site (site a, site b, site c), stage(1,2,3,4) and expr (continuous variable).

In order to take care of the categorical variables I am creating dummy variables via [,-1] [from ?cmprsk::crr the model.matrix function can be used to generate suitable matrices of covariates from factors, eg model.matrix(~factor1+factor2)[,-1] will generate the variables for the factor coding of the factors factor1 and factor2. The final [,-1] removes the constant term from the output of model.matrix] https://stats.stackexchange.com/questions/212312/add-categorical-variable-in-crr-of-package-cmprsk ].

crr(
    ftime = pheno$survalltime,
    fstatus = pheno$event_status,
    cov1 = model.matrix(~ factor(sex) + age  +factor(Site) + factor(stage) + expr , data = pheno)[, -1],   
    failcode =1, cencode = 0)

Thank you for any feedback!!

crr R • 539 views
ADD COMMENT

Login before adding your answer.

Traffic: 2411 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6