I have a set of data (from 2011-2020). I want to test when event X happened for user A in a certain month (the first time, first X for A), whether this event X will happen again in the following 3 months. I have a lot of users in this dataset. The data format is yyyy-mm-dd h-m-s. I did not need to account for the situations that event X may happen multiple times in the next 3 months. I just want to see if it happens within the next 3 months (90 days). This is my dependent variable.
I want to run a one-time discrete hazard model and the unit of analysis is every user's 3-month activity (if event X happen).
Here is the data sample. (3-month sample)
Username | Event time | if another X happened within 3 months for this user after his/her first X |
A | 2020-01-01 (this is the first time when X happened for A) | |
2020-01-28 | Yes | |
B | 2020-01-03 (first X for B) | |
2020-05-06 | No | |
2020-05-08 | In another 3 months (started from 05-06), it is a Yes but in this 3-month sample, it does not matter | |
C | 2020-01-06 (first X for C) | |
2020-02-01 | Yes | |
2020-02-03 | (I do not need to count this one) | |
How can I split my 10-year dataset into many 3-month (90days) units and run a hazard model as I explained above?
How to add other interactions in this model?
How can I control each user in this model (I have all the usernames) ?
Thank you very much!
Best regards,
Iris Ru
0 Response to Survival analysis (hazard model): how to set up the 10-year data in a three-month window
Post a Comment