I have a longitudinal retrospective data set of human medical records. They feature CONDITION and DRUG. There is no way of saying why a drug was prescribed other than observing the conditions/diseases present at the time.
I would like to know whether taking drug X has an outcome on a particular disease. The outcome will be the duration between repeated visits to the doctors. I have used a recurrent cox regression to classify whether a particular drug (as a covariant) is associated with a change in risk to the disease outcome.
I think I need a linear model where the predictor/independent could be time to a particular reoccurring disease record (remember, this is recurrent so a little bit like migraine so the patient sees the doctor often) and the dependent/outcome variable would be some measure of the disease outcome. If I take e.g., 1250,000 patient records, align them so that the index date is defined by the particular drug of interest, I could be able to get a before-after effect.
I would appreciate any links, papers, tutorials, on an approach similar to what I am trying to do.
Edit #1 1) The retrospective cohort is made up only from patients with a particular condition, however, e.g. migraine, it is a condition that will/can be recorded multiple times, so the duration between records is the only disease outcome to go by.
2) The drugs I am interested in are those not associated with a particular disease of interest.