# Pointwise Nonparametric Estimation of Odds Ratio Curves with R: Introducing the flexOR Package
## 4 Examples of Application
### Acute Coronary Syndrome Data
The log-odds ratio (LnOR) is presented alongside 80% and 95% confidence bands, all referenced to a reference value of 100 for fasting blood glucose levels. It is imperative to note that normal fasting blood glucose concentrations typically fall within the range of 70 mg/dL (3.9 mmol/L) to 100 mg/dL (5.6 mmol/L). Notably, individuals with fasting blood glucose concentrations near 114 mg/dL exhibit a lower odds of death. The log-odds of death, as depicted in the figures, exhibits a distinctive spoon-shaped pattern, with a rapid escalation beyond this threshold until reaching a value of 200 mg/dL. These findings shed light on the critical interplay between fasting blood glucose levels and mortality odds among ACS patients, emphasizing the nuanced nature of this relationship and its implications for clinical understanding and management. Furthermore, it is important to highlight that both Figures 1 and 2 present the same estimates while employing different plotting techniques. Figure 1 utilizes the conventional plotting method, while Figure 2 leverages the plotly R package. The utilization of the plotly R package in Figure 2 introduces notable advantages, particularly its dynamic and interactive visualization capabilities. Plotly enables real-time interactivity, allowing users to explore the data in loco--providing a more immersive and detailed understanding of the fasting blood glucose level and its association with the odds of death among ACS patients. The incorporation of such interactivity improves the interpretability and utility of the presented findings in a practical and user-friendly manner. It is important to note that while the functional form of the odds ratio (OR) for a particular predictor remains consistent regardless of the chosen reference point, the actual values of the odds ratio can be influenced by the selection of this reference point. This consideration must be taken into account when interpreting OR values. The flexOR package also enables users to generate predictions based on the object _or1_ obtained from the flexOR function. The output provides predicted values along with confidence intervals for the log-odds ratio at different levels of the predictor variable _fasting_. The reference value is set at 100, and the confidence level is specified as 95%. The resulting table displays the reference value, log-odds ratios, and corresponding lower and upper bounds for the given prediction values. > pdval <- c (70, 80, 90, 100, 110, 120, 140, 180, 250, 400) > predict(or1, predictor = \"fasting\", ref.value = 100, conf.level = 0.95, prediction.values = pdval, ref.label = \"Ref.\")  
Ref. LnOR lower.95 upper.95  70 0.48905582 0.3837869 0.59432470  80 0.31326688 0.2430876 0.38344614  90 0.14227425 0.1071846 0.17736388  100 0.0000000 0.0000000 0.000000000  110 -0.07323341 -0.1083230 -0.03814378  120 -0.06143541 -0.1316147 0.00874384  140 0.16943030 0.0290718 0.30978881  180 0.81032300 0.5296060 1.09104001  
Figure 2: Interactive plot illustrating the relation between fasting blood glucose level and log-odds of death among ACS patients. The log-odds ratio (LnOR), depicted by a solid line, is accompanied by 80% and 95% confidence bands represented by dashed lines. These visuals are presented for a reference value of 100 for fasting blood glucose level. 250 1.07569430 0.5493499 1.60203870  
400 1.89278576 0.8400970 2.94547454  
Table 2 presents the degrees of freedom obtained for the multivariable logistic model incorporating smoothing splines for fasting, creatinine, and age, using data from acute coronary syndrome. Additional predictors in the model include anemia, sex, and smoking. The results indicate that the AIC-based method yields a higher number of degrees of freedom compared with GCV.Cp, particularly when compared with the REML method. Similar results were observed for AICc and BIC. The observed discrepancy between AIC and REML was anticipated, as the REML method may tend to oversmooth in certain instances.