I have data on about 320 people. I am trying to predict their mortality before and after a certain event. I tried to apply a logistic regression model using dead or alive as dependent variable and age-as independent. The problem is that there are several people in some age groups, and out of these groups some survived and some died. Not sure how to combine ages and ratio of alive/dead on the x-axis if i use a logistic regression.
Assuming you are not predicting 0/1 mortality per se but are predicting time until death, it sounds like you want to assess the impact of an intervening event on the instantaneous risk of death. That can be dealt with using a time-dependent covariate in a Cox proportional hazards model. Alternatively you can set up a state transition model that is perhaps more interpretable. These are discussed in https://cran.r-project.org/web/packages/survival in the vignettes.