hputter / mstate

https://hputter.github.io/mstate/
7 stars 5 forks source link

Question about analyzing data containing time-dependent covariates #24

Closed clarinetrefle closed 5 months ago

clarinetrefle commented 1 year ago

I would like to do multi-state modeling using mstate package based on data containing time-dependent covariates. The data I would like to use are, for example, the attached data. The subject's BMI value changes over time, and are time-dependent covariates. Three types of subject status are assumed: "no disease", "with disease", and "death". With this data, I would like to evaluate the association between BMI and risk of transitioning to each status. Is it possible to analyze data containing such time-dependent covariates with the use of mstate package or can I use some other software to analyze the data?

Each column in the attached data means the following ・id:Subject’s ID ・stt:Time when the individual started to be followed, with the start of the follow-up to 0 (Unit : years) ・sts:Status at “stt” (0 : No disease, 1 : Disease, 2 : Death) ・illt:Time of transition to disease state or time of last follow-up, with the start of the follow-up to 0 (Unit : years) ・ills:Event occurrence at “illt” (0 : censoring, 1 : disease(transition)) ・dt:Time when the transition to the death state occurred or the last follow-up time, with the start of the follow-up set to 0 (Unit : years) ・ds:Event occurrence at “dt” (0 : censoring, 1 : death(transition)) ・BMIt_X:Time when BMI was measured (The number in X indicates how many times the measurement has been taken) (Unit : years) ・BMIs_X:Measured BMI values (The number in X indicates how many times the measurement has been taken) ・x1:sex (covariate)

スクリーンショット 2023-04-18 131809
stanleyrazor commented 8 months ago

@clarinetrefle , were you able to get a solution to your question ? I am stuck in a similar position. Kind regards, Stanley

edbonneville commented 5 months ago

@clarinetrefle really sorry for the delay in answering.. in your example, your time-dependent covariate (BMI) is endogenous (further reading here), so for transition-specific association estimation I think you should be using a joint model with a multi-state submodel. You should be able to do this using the {JMbayes2} package.

You can estimate transition-specific hazards with exogenous time-dependent continuous covariates using {mstate}, but this will need a little more data preparation and you will not be able to use probtrans(). I think at the moment this is easier to do with the {msm} package, see here.