I have a large medical retrospective longitudinal dataset of electronic health records. An individual is identified by an ID. A medical event or drug prescription event is identified using a code and a date.
Every patient has a migraine. I am looking at assessing the efficacy of current migraine medication (preventatives e.g., topiramate). I have a number of recurrent Cox regression models I will eventually turn to, until then, I am just assessing the trajectory of a patient's migraine history before and after they a prescribed the drug of interest. This is quite messy, as patient records aren't the same length and drugs are not prescribed at the same time, nor is drug prescription persistent or regular.
I took all patients with the drug and I divided that cohort into a before drug cohort and after drug cohort. I would expect to see the migraine burden increase prior to drug exposure, after which there should either be a decrease in migraine frequency (fewer reports of migraines) or a regular pattern of migraine diagnosis (it is not getting any worse, but it isn't getting any better).
The before (red) is definitely showing an increase in headache burden as the population approaches their first drug exposure. Now whether the after (blue) is linear, in that there is no curve to the slope, I'm not sure.
My questions: 1) is this an appropriate quantitative measure of whether a drug halts the increase in migraine progression (keyword being increase)? 2) Would a calculation of the curve off a straight line make any sense if there is an error? 3) Is there a linear model approach I could use instead?
Edit: The complete electronic healthcare record is approximately 580,000 patients. Of those, 10,000 are taking the drug of interest.
Every medical record begins from 01/01/2000 and will continue until the patient has either died, left the clinic (but there is no indication, just a lack of record) or, in most cases, the record continues to 01/01/2016.
Each patient is unique, exposure to the drug won't be happening at the same time. Neither will the follow up time from initial drug exposure. Drug dosage is not recorded, only the drug ID and the date of prescription and repeat prescription. Patients can come off drugs at any time.
Migraines are tracked by their dd/mm/yyyy event record in the patient record. Although, in the MCF above they have been binned into weeks.
An increase in migraine burden is measured as a decrease in time between migraine recorded events (dates). I think it's important to remember that this is real-world clinical data, totally uncontrolled and very messy.