I am trying to analyze the effect of air pollutant on health. First, I used the restricted cubic spline with three knots which were 25th, 50th, 75th percentiles of the pollutant and the result was Figure1: it looks a linear relationship. And then, I divided the data set into four parts by the 25th, 50th, 75th percentiles of the pollutant, and conducted logsitic regression for each part, the result was Figure2.
I am confused that why the trend in Figure2 is not a ascending line? Because in my opinion, it should be the same as Figure1.
And the restricted cubic spline model is :
k <- with(Data, quantile(Pollutant, c(.25, .50,.75)))
model_rcs <- lrm(disease~rcs(Pollutant,k)+temperature+humidity+age+gender+job,data=Data)
the logistic model is:
model_log <-glm(disease~Pollutant+temperature+humidity+as.factor(age)+as.factor(gender)+as.factor(job),family = binomial() ,data=Data_Q1) (or Data_Q2\Data_Q3\Data_Q4)