dd <- datadist(be) options(datadist='dd') fit8 <-lrm(O ~ rcs(uic, 5)+sex+age+edu+income+smoke+ethnic+BMI,data=be) an<-anova(fit8)b<-Predict(fit8, uic,fun=exp)plot(Predict(fit8, uic,fun=exp), anova=an, pval=T)dd$limits$uic[2] <-50fit9=update(fit8)OR4<-Predict(fit9, uic,fun=exp,ref.zero = TRUE,np=2000) p5<-ggplot()+geom_line(data=OR4, aes(uic,yhat),linetype=1,size=1,alpha = 0.9,colour="#5599FF")+geom_ribbon(data=OR4, aes(uic,ymin = lower, ymax = upper),alpha = 0.3,fill="#98F898")+geom_hline(yintercept=1, linetype=3,size=1,colour="#888888")+geom_vline(xintercept=2.34, linetype=2,size=0.5,colour="#888888")+geom_vline(xintercept=2.08, linetype=2,size=0.5,colour="#888888")+geom_density(data=be,aes(uic,y = ..count../sum(..count..)*500),fill="#FF4500", alpha = 0.2,linetype=3,colour="#A9A9A9") +theme_classic()+ labs(title = "O", x="U", y="OR(95%CI)")+scale_x_continuous(breaks = seq(0, 100, by = 0.5),limits = c(1,4.5))+ scale_y_continuous(name = "OR(95%CI)",sec.axis = sec_axis(~.x/500, name = "TS density"))