I'm trying to fit a discrete-time model in R, but I'm not sure how to do it.
I've read that you can organize the dependent variable in different rows, one for each time-observation, and the use the glm
function with a logit or cloglog link. In this sense, I have three columns: ID
, Event
(1 or 0, in each time-obs) and Time Elapsed
(since the beginning of the observation), plus the other covariates.
How do I write the code to fit the model? Which is the dependent variable?
I guess I could use Event
as the dependent variable, and include the Time Elapsed
in the covariates. But what happens with the ID
? Do I need it?
Thanks.
self-study
tag.) $\endgroup$