JasperHof / SPARE

2 stars 0 forks source link

Is Recurrence mandatory? #3

Closed lucavd closed 10 months ago

lucavd commented 10 months ago

Hi @JasperHof , I know your article and pkg are about expanding the GWAS survival to recurrent events, but here's my thing. I literally spent a full week of work making SAIGE and GATE just work, even using Docker, in which I am quite fluent. I'm quite frustrated with the results.

Your pkg looks like a light in the dark for me. A simple R package that does the work, that is well maintained, and personalizable (and I actually see what it does).

I'd like to use it in an GWAS dataset (mine, original 682 patients) with a time-to-event survival model with frailty (i.e. the center in which they were recruited). Do you think I can use your pkg to analyze it even if I don't have a recurrence?

Is the variable mandatory or I can just fit a normal GWAS + frailty? Are the results going to be trustworthy?

Thank you from an exhausted colleague (and long live the CRAN)

lucavd commented 10 months ago

BTY, the SPARE.bed function on page 2 of the manual is misspelled as "SPACE.bed" and "SPACE.bgen"

JasperHof commented 10 months ago

Dear Luca,

Thanks for your comment. I do think the package can be used for frailty models, since the method is mostly centered around the martingale residuals, which can be obtained from any Cox-type survival model. However, a large part of the code currently requires the user to fit a frailty model, in which the subject ID equals the frailty ID, and is called 'subject'.

I would be happy to adjust the code so that it is possible to also include a frailty term that does not have to be the subject ID, and in theory, this should work fine. However, I should note that while I expect the outcomes to be valid, I have not tested them.

Finally, I'm sure you are aware that it is also possible to run survival analyses using SPACox. I am not sure whether it is possible to include frailties in their Software? I will try to include an option to include a 'normal' frailty model around the end of this week.

Kind regards,

Jasper

lucavd commented 10 months ago

Thank you!

I wrote to the SPAcox author to see if it supports frailty models since there is no example in the documentation.

The question is here https://github.com/WenjianBI/SPACox/issues/9

JasperHof commented 10 months ago

Dear Luca,

I have checked the code, and now I believe that SPARE can indeed also be used for frailty models. I previously thought that parts of the code were specific to individual-level frailties, but this does not seem the case. So it is possible to run a frailty model. Instead of using:

fitme = coxme(Surv(tstart, tstop, Status) ~ X1 + X2 + X3 + (1|subject), data = data, ties = 'breslow')

It would be possible to include a frailty based on the group/hospital of the subject:

fitme = coxme(Surv(tstart, tstop, Status) ~ X1 + X2 + X3 + (1|Center), data = data, ties = 'breslow')

Here, 'Center' is a variable in the data frame containing the Group IDs of the subjects. However, one important note is that the estimated log Hazard ratios are no longer accurate, because they assume individual level frailties. I will try to work out out if this can also be computed for normal frailty models. Hope this helps!

Best,

Jasper

lucavd commented 10 months ago

Thank you! I did it run with the (1|Center) in the NULL last night and it worked fine (computationally). Since I used Center as random effects, should I substitute the gIDs in the SPARE.bed function with the centers IDs or I have to keep the subjects IDs?

JasperHof commented 10 months ago

Dear Luca,

The 'gIDs' variable stand for the genotype IDs, so should still be used for the subject IDs. The input gIDs should be in the same order as the samples in the genotype data, which can for example be found in the .fam file in plink format.

Best,

Jasper

lucavd commented 10 months ago

Hi @JasperHof , should I try the frailty model now?

I have a doubt that if HR are not accurate, also p-values will not be accurate.

Thank you

JasperHof commented 10 months ago

Hi Luca,

Yes, you can indeed run the frailty model with the current software. The reported P values are based on a score test (using the Beta and SE in the output), and are not based on the estimated log HRs. Thefefore SPARE can be used for association analysis and computing P values, however the estimated log HRs cannot be used.

Best,

Jasper

lucavd commented 10 months ago

I'll run it and let you know how it went...

JasperHof commented 10 months ago

Good luck! Happy to hear how it went :-)

JasperHof commented 9 months ago

Dear @lucavd ,

I was curious to hear about your experience with the SPARE package. It is a relatively new application, that I want to make as user-friendly as possible. Please feel free to let me know if there is anything to be improved!

Kind regards,

Jasper Hof

lucavd commented 7 months ago

Hi Jasper, I used the package and it is indeed very user-friendly. The manual is simple and nice with all the information needed to use the package. A plus is that it is quite fast implementing even large models. I definitely recommend it