I'm kind of stuck on a simple question:

I have aggregated data over 15 years for each year how many people in a patient group have received a certain medication X (1105 with X from 2566 patients total in 2016...). The question is now is there a trend? In a similar paper, a logistic regression was calculated and an odds ratio reported. I'm not sure how to calculate a logistic regression from this aggregated data?!? I would have simply calculated a simple linear regression over the relative frequencies (the total number of patients treated varies from year to year)? What would be a correct handling of this kind of data?

| drug X .   | All Patients|     year     |
| 1394       |        1491 |     2001     |
| 1463       |        1544 |     2002     |
| 1492       |        1585 |     2003     |
| 1511       |        1587 |     2004     |
| 2041       |        2146 |     2005     |
| 2271       |        2383 |     2006     |

1 Answer 1


If the outcome is binary, category 1 did not receive medicine x and category 2 did receive medicine x. Then I do not understand why you cannot run a logistic regression. If the variable you want to predict is whether someone will receive the medicine, I think logistic regression is the most appropriate for the data. The question is do you have predictors? what are your predictors because regression models require at least one predictor and at least one outcome. I cannot see if you have a predictor or not in your question.

In any case logistic regression can handle both categorical and continuous predictors, however the outcome must always be binary.

  • $\begingroup$ Thanks for your quick answer. There are no predictors. I only have the data: year, total number of patients by year, patients treated with drug X by year. I have calculated logistic regressions so far only in such a way that I had single cases with predictors never with already aggregated numbers. $\endgroup$ Commented Jun 27, 2018 at 11:56
  • $\begingroup$ It might help if you clarify the question you're trying to answer -- are you just interested in determining whether the proportion of individuals receiving the treatment is increasing/decreasing by year? If so, it might be worth considering what other methods will best address that point -- perhaps a simple line plot with proportion on the Y axis and year on the X axis would ultimately be more useful. $\endgroup$
    – dlid
    Commented Jun 27, 2018 at 12:13
  • 1
    $\begingroup$ If there are no variables than can serve as predictors then I am not sure how I would proceed with this problem. I managed to see your dataset above and I can see that every year there is a different amount of patients. What I would do would be to standardize the values. i.e. determine the percentage of patients taking the drug and then I would proceed with time series analysis $\endgroup$ Commented Jun 27, 2018 at 12:56
  • 1
    $\begingroup$ A different solution is: Think your data as a graph on y axis you have the percentage of patients taking the drug and on x axis year. In that case time in years can be your predictor but now the outcome is a continuous variable so linear regression may be advised. If you are interested in a trend you may check the slope of the line y=a*x+b in that case a provides the trend $\endgroup$ Commented Jun 27, 2018 at 13:00
  • 1
    $\begingroup$ the predictor is the year, and in r you can input the counts of positive and negative examples as 'target variable'. in python scikit-learn, you may be able to use sample weights to specify counts of positive and negative examples $\endgroup$
    – seanv507
    Commented Jun 27, 2018 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.