# How to predict the risk of an event?

I'm working on a medical problem, where I want to analyze the effect of taking cholesterol medications on the occurrence of heart attack. Once a medication with a specific dosage is prescribed, it'll be used by a patient for $k$ consecutive periods (i.e., refills periods).

Moreover, I have a retrospective data of several patients, where each patient

1. is prescribed with different dosages,
2. has the fixed $k$ periods of refill,
3. may have some instances of heart attack during those $k$ periods, and
4. has other risk factors (as confounding factors).

Now, if a patient takes a specific dosage of that medication for $k$ consecutive periods (in a prospective sense), how can I predict the risk of heart attack at any time during those $k$ periods? I guess there might be some relevance to Cox survival analysis, but I'm not quite sure. So, any comment/help is really appreciated!

Thanks.

Here is the formula for generating the probability of $Y_i = 1$
$P(Y_i = 1|\, x_{i1},\ldots,x_{ip}) = \frac{e^{\beta_0 + \beta_1 x_{i1} + \ldots + \beta_p x_{ip}}}{1+e^{\beta_0 + \beta_1 x_{i1} + \ldots + \beta_p x_{ip} }} = \pi_i$
• I'm familiar with the concept of logistic regression. The problem with this model is that it gives me the probability of a heart attack at a fixed time. However, as I explained above, I want a model that takes the data of $k$ periods and tells me the probability of this event happening once (or at least once) during the $k$ periods. – Alex Jul 25 '16 at 19:09
• @Alex I might be having trouble understanding your problem or the way your dataset looks but I wonder if it would be possible to take the mean of the predicted probabilities across $k$ periods. – dylanjm Jul 25 '16 at 20:14