thresholdanalysis: An R Package for Detecting and Visualizing Threshold Effects in Logistic Regression, Linear Regression, and Cox Proportional Hazards Models | Research Square window.SnipcartSettings = { analytics: { enabled: false } }; (function() { var accessVector = localStorage.getItem('access_vector') || ''; window.dataLayer = window.dataLayer || []; if (accessVector) { window.dataLayer.push({ user: { profile: { profileInfo: { snid: accessVector } } } }); } })(); (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-K279D39R'); Browse Preprints In Review Journals COVID-19 Preprints AJE Video Bytes Research Tools Research Promotion AJE Professional Editing AJE Rubriq About Preprint Platform In Review Editorial Policies Our Team Advisory Board Help Center Sign In Submit a Preprint Cite Share Download PDF Article thresholdanalysis: An R Package for Detecting and Visualizing Threshold Effects in Logistic Regression, Linear Regression, and Cox Proportional Hazards Models Sheng Song, Zhang Yan-Hong, Zhang Lei, Ma Hang-Kun, Zhao Yang, and 1 more This is a preprint; it has not been peer reviewed by a journal. https://doi.org/ 10.21203/rs.3.rs-8841918/v1 This work is licensed under a CC BY 4.0 License Status: Under Review Version 1 posted 8 You are reading this latest preprint version Abstract When a dependent variable exceeds a certain threshold, a significant change in its magnitude and/or direction is called a threshold effect. As a statistical tool, threshold effect analysis can predict the occurrence, development, and prognosis of a disease, which is highly important. However, there is currently a lack of open-source, free, simple, and effective tools to implement threshold effect analysis. The process of determining thresholds is complex and labor intensive, requiring high programming skills. Therefore, this study demonstrates how to simplify this process and reduce programming skill requirements via the self-developed R package "thresholdanalysis", which enables nonstatistical professionals to conduct threshold effect analysis. First, smooth curve fitting is used to observe whether there is a nonlinear relationship between the dependent variable and the independent variable. If a threshold is visually observed, the maximum likelihood method, recursive method, piecewise linear model, and likelihood ratio test are used to determine the threshold, the effect sizes before and after the threshold, and whether the effect sizes of the two segments are significant. Physical sciences/Engineering Physical sciences/Mathematics and computing Threshold Effect Maximum Likelihood Method Recursive Method Piecewise Linear Regression R Software Figures Figure 1 Introduction When a dependent variable exceeds a clinically validated threshold, the magnitude and/or direction of its biological effect undergoes a nonlinear change, a phenomenon recognized as the threshold effect. This nonlinearity is particularly pervasive in biomedical research, where the dose‒response relationships between hormone levels [ 1 ] , drug dosages [ 2 ] , biomarkers [ 3 ] , clinical features [ 4 ] and disease status frequently demonstrate threshold-dependent behavior. Specifically, these relationships often exhibit discontinuous transitions, wherein incremental quantitative changes in the predictor variable trigger qualitative shifts in clinical outcomes. The identification of statistically robust threshold effects has significant translational implications. Once empirically validated, such thresholds enable prospective stratification of disease risk, dynamic monitoring of progression patterns, and personalized prognostication. This predictive capacity highlights the clinical utility of incorporating threshold effect modeling as an adjunctive analytical paradigm to conventional statistical approaches, thereby augmenting the actionable intelligence derived from biomedical research for evidence-based decision-making. Segmented linear regression and recursive partitioning methods represent two primary analytical frameworks for characterizing nonlinear relationships that have gained prominence in recent years for threshold effect modeling in large-scale observational studies [ 5 – 7 ] . While R remains the dominant computational platform for such analyses, the current implementation landscape lacks dedicated toolkits specifically designed for threshold effect detection. Existing workflows necessitate custom coding of threshold identification algorithms, which involves substantial programming effort and requires advanced statistical expertise. This methodological gap poses significant barriers to nonspecialist researchers seeking to incorporate threshold analyses into their research programs. To address these challenges, we developed the R package thresholdanalysis, which implements a standardized analytical pipeline for threshold effect detection through modular programming. The package integrates three core functionalities: automated threshold identification via optimized segmentation algorithms, visualization of threshold-dependent effect patterns, and comprehensive reporting of statistical metrics. By encapsulating complex computational procedures into user-friendly functions, our tool substantially reduces the technical barriers to threshold analysis while enhancing methodological rigor and resulting in reproducibility across diverse biomedical research applications. Materials and Methods This R package was constructed utilizing R (v4.2.0) and R Studio (v2025.9.2.418) as the integrated development ecosystem. Package initialization was performed via the usethis framework, enabling automated generation of foundational files, including the DESCRIPTION metadata manifest and the NAMESPACE function scoping declaration. Development environment validation and package deployment were executed through the devtools toolchain. Documentation automation was achieved through the roxygen2 package, which facilitated bidirectional synchronization between in-code annotations and rendered help files. The details of the program are divided into five key steps, and the specific contents of each step are described below. 1. Construction of the restricted cubic spline model The restricted cubic spline (RCS) is employed to capture the nonlinear association between the independent variable ( X ) and the dependent variable ( Y ). By default, four knots are strategically positioned to flexibly model the curvature of this relationship. Then, we observe whether there is a nonlinear relationship between the two. If there are apparent breakpoints in the visual inspection, the recursive method and the maximum likelihood method are used to identify the fitting model with the highest likelihood value. 2. Threshold search algorithm In the preliminary screening stage, we identify potential threshold candidates by considering the percentiles ranging from the 5th to the 95th percentiles of the X distribution. All percentiles within this specified range are treated as viable candidates for further evaluation. For each candidate threshold, we partition the dataset on the basis of this threshold and construct a segmented model accordingly. We subsequently compute the log-likelihood for each segmented model to evaluate its fit to the data. The percentile associated with the highest log-likelihood (LL) value is then selected as the preliminary threshold for subsequent refinement. Following the preliminary screening, we conduct a fine search to further refine the threshold selection. This involves examining candidate values within a narrow range of ± 4% around the preliminary threshold. For each of these refined candidate thresholds, we repeat the process of constructing segmented models and calculating their corresponding LLs. When the data volume within the range is greater than 5, the 25th, 50th, and 75th percentiles are calculated within this range. The quantile point with the maximum LL is selected as the candidate threshold, and the candidate threshold range is narrowed to the 25th percentile range before and after this quantile point. The recursive method is used to iteratively exclude 50% of X values in each recursion until the data volume within the 25th percentile range around the candidate threshold no longer exceeds 5. When the data volume within the range no longer exceeds 5, further determine the threshold in the following three cases: when the data volume in this range is 2–5, select the data point that gives the maximum model LL as the threshold; when the data volume is 1, use this unique value as the threshold; and when the data volume is empty, return to the previous iteration and use the obtained threshold as the final threshold. Ultimately, the threshold that yields the highest LL value during this fine search phase is designated the optimal threshold “ cut_off ”, representing the most suitable partition point for the given dataset. 3. Construction of Segmentation Models X “ var_name ” is divided into two segments on the basis of the optimal threshold “ cut_off ” as follows: X1 calculation : Define X 1 = max (0, cut _ off − var _ name ). When var_name is less than cut_off , the value is equal to cut _ off − var _ name ; when var_name is greater than or equal to cut_off , X1 takes a value of 0. X2 Calculation : Define X 2 = max (0, var _ name − cut _ off ). When var_name is greater than cut_off, the value is equal to var _ name − cut _ off ; when var_name is less than or equal to cut_off , X2 is set to 0. There are three models in total: the baseline model ( mdl0 ). This model includes the original form of X along with all the covariates. This model serves as a reference model for comparison with the subsequent segmented models. Segmented Model (mdl1) In this model, the original independent variable is replaced by the segmented variables X1 and X2 . This model is employed to investigate whether the influence of X on Y varies across different intervals. Threshold-Testing Model (mdl2) This model, which incorporates X2 and the original X , tests for a threshold effect and determines if the part of the variable exceeding the threshold ( X2 ) has an extra impact on Y , given the original target variable. 4. Model Comparison and Threshold Effect Assessment A comparative evaluation of the fit between mdl0 and mdl1 is conducted via the likelihood ratio test (LRT). The fundamental principle underlying the LRT is to juxtapose the likelihood function values of two nested models and compute the likelihood ratio statistic, which adheres to a chi-square (χ²) distribution. The likelihood ratio statistic is computed via the following formula: likelihood ratio = − 2×(logLik(mdl0) −logLik(mdl1)) . Here, logLik(mdl0) and logLik(mdl1) denote the log-likelihood values corresponding to mdl0 and mdl1, respectively. The P value is determined on the basis of the degrees of freedom associated with the χ² distribution. If the P value is less than 0.05, it can be concluded that, at a significance level of 0.05, mdl1 results in a significantly better fit than does mdl0. This finding provides evidence for the presence of a threshold effect. In other words, the influence of X on Y demonstrates substantial differences across different intervals. 5. Visualization and Output of the Results The ggplot2 package is employed to generate a trend plot depicting the effect size curve along with its corresponding 95% confidence interval ( CI ) as X changes. In the resulting graph, the effect size curve is represented by a solid blue line. The 95% CI is visualized as a light blue, semitransparent region surrounding the effect size curve. The optimal threshold position is marked on the graph with a red dashed line. Additionally, a rug plot is included at the bottom of the graph. A rug plot consists of short lines, each representing an individual observation from the original dataset. This approach helps in understanding the concentration and overall shape of the data distribution within the range of X values. All generated results are automatically stored in an Excel file. The outcomes of the three models are presented as follows: For each of mdl0, mdl1, and mdl2, the effect sizes are enumerated, together with their respective 95% CIs and corresponding P values. Other results also include the cutoff value, likelihood ratio statistic, degree of freedom, and P value. 6. Dataset The data of this study were derived from the online database DATADRYAD ( https://doi.org/10.5061/dryad.6v0j9 ) which is an open data publishing platform and a community committed to the open availability and routine re-use of all research data. According to the Terms of Service, we cited the data package Jung, Su-Young J et al. (2019), Data from: Phosphate is a potential biomarker of disease severity and predicts adverse outcomes in acute kidney injury patients undergoing continuous renal replacement therapy, Dryad, Dataset, https://doi.org/10.5061/dryad.6v0j9 [ 8 ] . This study included medical records of 1,145 patients who received continuous renal replacement therapy in the Intensive Care Units of Health System Severance Hospital affiliated with Yonsei University and Ilsan Hospital of the National Health Insurance Service Medical Center in South Korea from January 2009 to September 2016 [ 8 ] . The original study was approved by the Yonsei University Health System Severance Hospital Institutional Review Board (No. 4-2016-1073) and research involving human research participants have been performed in accordance with the Declaration of Helsinki. All patient data in this study are anonymous and the requirement of the informed consent was waived because of the nature of the study [ 9 , 10 ] . As this study involved the mining of the public database, formal permission and informed consent from the ethical review board were not required for this study [ 11 , 12 ] . In this study, we demonstrated threshold analysis via linear regression (LinR), logistic regression (LR), and Cox proportional hazards (Cox) as examples. Results The data file was stored in the xlsx format under the path "C:\Users\74736\Desktop\r", and the data file "CRRTstudy_1144patients_revised.xlsx" was read and stored in the data object. The threshold analysis package was downloaded and installed from GitHub, and the threshold analysis and readxl packages were loaded. Samples with missing values were removed. The code is as follows: #set working directory setwd("C:\\Users\\74736\\Desktop\\r") #load clinical dataset data<- read_excel("CRRTstudy_1144patients_revised.xlsx") #download, install, and load the R package devtools::install_github("XiyuanEM-DrSheng/thresholdanalysis",force = TRUE) library(thresholdanalysis) library(readxl) #remove samples with missing values data<-na.omit(data) For LinR, X was SOFA, and Y was CRP. For LR, X was SOFA, and Y was Death_28D. Additionally, for Cox with a follow-up time of time_to_death_28D, X was the SOFA, and Y was Death_28D. All three regression models were adjusted for the confounding factors of Age and Sex. First, threshold analysis is demonstrated using LinR as an example. In the specified modeling framework, the formula CRP~SOFA + Age+Sex defines a multivariate regression structure wherein the data represents the data frame encompassing all the variables included in the formula. var_name denotes the X SOFA subjected to threshold effect analysis, and rcs_nodes specifies the number of knots (default = 4) for restricted cubic splines applied to this focal variable to capture potential nonlinear relationships. The code is as follows: result_linear <- linear_threshold(CRP~SOFA + Age+Sex, data = data, rcs_nodes = 4, var_name = "SOFA") Upon execution of the linear_threshold command, an Excel file named linear_threshold_results.xlsx is automatically generated in the path. The first worksheet, Cutoff , displays a cutoff value of 8. The second, third, and fourth worksheets mdl0_Results , mdl1_Results , and mdl2_Results correspond to the results of mdl0, mdl1, and mdl2, respectively, and the fifth worksheet LRTest presents the results of the LRT, including the P value and χ² value. After adjusting for Age and Sex, the results of the mdl0 score revealed that each 1-point increase in SOFA was associated with a 4.73 mg/dL increase in CRP level (95% CI : 1.97–7.49, P 8, each 1-point increase in SOFA was associated with a 6.64 mg/dL increase in CRP level (95% CI : 3.11–10.16, P 8 was 10.52 mg/dL ( 95% CI : -1.62–22.65, P = 0.090). The LRT comparing mdl0 and mdl1 yielded a P value of 0.055 and a χ² value of 2.91, indicating that at the threshold SOFA value of 8, there was insufficient evidence to conclude a significant difference in the effect of SOFA on CRP between the two segments (Table 1 ). The relationship plot between SOFA and CRP after adjusting for Age and Sex is also automatically generated in the path, as shown in Fig. 1 . Table 1 Results of mdl0, mdl1, and mdl2 mdl0 Beta std. error statistic P value Lower CI Upper CI Intercept 21.63 31.76 0.68 0.496 -40.62 83.88 SOFA 4.73 1.41 3.36 < 0.001 1.97 7.49 Age 0.57 0.32 1.75 0.080 -0.07 1.20 Sex 1.00 9.55 0.10 0.917 -17.72 19.72 mdl1 Beta std. error statistic P value Lower CI Upper CI Intercept 49.29 26.73 1.84 0.066 -3.09 101.67 X1 3.88 5.26 0.74 0.461 -6.43 14.19 X2 6.64 1.80 3.69 < 0.001 3.11 10.16 Age 0.59 0.32 1.83 0.068 -0.04 1.23 Sex 0.27 9.54 0.03 0.977 -18.43 18.97 mdl2 Beta std. error statistic P value Lower CI Upper CI Intercept 80.34 46.90 1.71 0.087 -11.58 172.26 X2 10.52 6.19 1.70 0.090 -1.62 22.65 SOFA -3.88 5.26 -0.74 0.461 -14.19 6.43 Age 0.59 0.32 1.83 0.068 -0.04 1.23 Sex 0.27 9.54 0.03 0.977 -18.43 18.97 std. error: standard error, CI: confidence interval The threshold effect analysis functions for LR and Cox are named logistic_threshold and cox_threshold, respectively. The specific usage methods of these functions are as follows. The outputs of the tables and figures, as well as their explanations, are similar to those of LinR. Thus, it will not be elaborated here. result_logistic <- logistic_threshold(Death_28D ~ SOFA + Age+Sex, data = data, rcs_nodes = 4, var_name = "SOFA") result_cox <- cox_threshold( Surv(time_to_death_28D, Death_28D) ~ SOFA + Age+Sex, data = data, rcs_nodes = 4, var_name = "SOFA") Discussion Threshold effect analysis was initially used to study the activation and inhibition processes of biological phenomena. With the development of medical research and clinical practice, threshold analysis has been introduced into the medical field to determine disease diagnostic criteria, formulate treatment plans, and develop preventive measures. It plays an important role in helping medical workers formulate more scientific and personalized diagnosis, treatment, and prevention strategies. For example, in an early study by the research group, a national multicenter retrospective registration cohort study based on the Chunbo Wanxiang platform used threshold effects to explore the range of traditional Chinese medicine applications in the treatment of diarrhea [ 13 ] . However, when threshold effect analysis is conducted, nonstatistical professionals usually encounter challenges because certain professional knowledge and programming skills are needed. In response to the complexity and heavy workload of threshold effect analysis, there is currently no dedicated R package that can fully implement this analysis. Therefore, this study simplifies the process and reduces the requirement for programming skills by writing code, enabling nonstatistical professionals to conduct threshold effect analysis. In addition to LinR, this study provides R functions for threshold analysis of three commonly used regression models: LR and Cox. Through preset code, researchers only need to define independent variables, covariates to be adjusted, and dependent variables to quickly implement threshold effect analysis and visualization, which greatly improves researchers' data analysis capabilities and efficiency. Of course, it should be acknowledged that there are still some limitations and challenges in current threshold analysis. First, due to individual differences in biological characteristics, thresholds may be unstable and uncertain. This may require large-scale clinical trials and practical application verification for specific disease types or clinical scenarios, considering the integration of multiple biological characteristic data, such as genomics, proteomics, and metabolomics data, to establish a more comprehensive and personalized threshold-setting model. Second, the thresholds of certain medical phenomena may change over time. For example, the sensitivity of pathogens to antibiotics may gradually decrease over time, leading to changes in treatment thresholds. Therefore, it is necessary to consider dynamic changes in the time dimension. However, relevant medical time-dependent threshold effect models are currently lacking. In the future, experts from multiple fields, such as medicine, statistics, and computer science, need to jointly participate in the establishment and optimization of mathematical models. Declarations Acknowledgments Sheng Song : Conceptualization : Designed the package’s core framework and threshold detection algorithms. Software : Developed the R package codebase, which includes functions for smooth curve fitting and likelihood ratio tests. Validation : Conducted simulations and clinical data analyses to verify statistical robustness. Writing Original Draft : Prepared the initial manuscript and package documentation. Zhang Yan-Hong , Zhang Lei Revised the statistical methods and clinical interpretation sections. Ma Hang-Kun Designed diagnostic plots for threshold effect visualization. Zhao Yang The recursive threshold-searching algorithm was optimized for computational efficiency. Huang Ye The final version of the manuscript and package release have been approved. Funding None Supplementary material None. Conflict of interest All the authors disclosed no relevant relationships. Data availability The datasets analyzed during the current study are available in the DATADRYAD (https://doi.org/10.5061/dryad.6v0j9). References WEI C X, ZHANG J W, X. I. A. N. G. S. et al. Reproductive outcomes in fresh transfer cycles and antagonists with premature luteinizing and/or progesterone surge: a single center retrospective cohort study [J]. Front. Endocrinol. 15 , 1411106 (2024). TIAN, J. et al. Antipsychotic drug dosing and study discontinuation in schizophrenia: A systematic review and dose-response meta-analysis [J]. Eur. neuropsychopharmacology: J. Eur. Coll. Neuropsychopharmacol. 94 , 51–58 (2025). CHEN, Q. et al. Serum anion gap on admission predicts intensive care unit mortality in patients with aortic aneurysm [J]. Experimental therapeutic Med. 16 (3), 1766–1777 (2018). XU F Q, S. H. E. N. G. S. et al. Charlson Comorbidity Index is correlated with all-cause readmission within six months in patients with heart failure: a retrospective cohort study in China [J]. BMC Cardiovasc. Disord. 23 (1), 111 (2023). PARK S Y et al. Association of Coffee Consumption With Total and Cause-Specific Mortality Among Nonwhite Populations [J]. Ann. Intern. Med. 167 (4), 228–235 (2017). SEIDELMANN, S. B. & CLAGGETT, B. Dietary carbohydrate intake and mortality: a prospective cohort study and meta-analysis [J]. Lancet Public. health . 3 (9), e419–e28 (2018). SHENG, S. et al. Albumin levels predict mortality in sepsis patients with acute kidney injury undergoing continuous renal replacement therapy: a secondary analysis based on a retrospective cohort study [J]. BMC Nephrol. 23 (1), 52 (2022). JUNG S Y, KWON, J. et al. Phosphate is a potential biomarker of disease severity and predicts adverse outcomes in acute kidney injury patients undergoing continuous renal replacement therapy [J]. PloS one . 13 (2), e0191290 (2018). GELERIS, J. et al. Observational Study of Hydroxychloroquine in Hospitalized Patients with Covid-19 [J]. N. Engl. J. Med. 382 (25), 2411–2418 (2020). LUO, Y. & SUN, X. A DWI-based radiomics-clinical machine learning model to preoperatively predict the futile recanalization after endovascular treatment of acute basilar artery occlusion patients [J]. Eur. J. Radiol. 161 , 110731 (2023). HE, R. et al. Cuproptosis-related genes score and its hub gene GCSH: A novel predictor for cholangiocarcinomas prognosis based on RNA seq and experimental analyses [J]. J. Cancer . 15 (6), 1551–1567 (2024). WANG, J. et al. Development and Validation of a Competitive Risk Model in Elderly Patients With Chromophobe Cell Renal Carcinoma: A Population-Based Study [J]. Front. public. health . 10 , 840525 (2022). SHENG, S. et al. An analysis of the association and threshold effect between treatment course of acupoint application and diarrheal recovery in community hospitals nationwide: a multicenter retrospective cohort study [J]. Chin. J. Integr. Traditional Western Med. Digestion (Chin) . 29 (11), 757–761 (2021). Additional Declarations No competing interests reported. Cite Share Download PDF Status: Under Review Version 1 posted Reviews received at journal 14 May, 2026 Reviewers agreed at journal 13 May, 2026 Reviewers agreed at journal 05 May, 2026 Reviewers invited by journal 19 Feb, 2026 Editor assigned by journal 19 Feb, 2026 Editor invited by journal 17 Feb, 2026 Submission checks completed at journal 16 Feb, 2026 First submitted to journal 16 Feb, 2026 You are reading this latest preprint version Research Square lets you share your work early, gain feedback from the community, and start making changes to your manuscript prior to peer review in a journal. As a division of Research Square Company, we’re committed to making research communication faster, fairer, and more useful. We do this by developing innovative software and high quality services for the global research community. Our growing team is made up of researchers and industry professionals working together to solve the most critical problems facing scientific publishing. Also discoverable on Platform About Our Team In Review Editorial Policies Advisory Board Help Center Resources Author Services Accessibility API Access RSS feed Manage Cookie Preferences © Research Square 2026 | ISSN 2693-5015 (online) Privacy Policy Terms of Service Do Not Sell My Personal Information {"props":{"pageProps":{"initialData":{"identity":"rs-8841918","acceptedTermsAndConditions":true,"allowDirectSubmit":false,"archivedVersions":[],"articleType":"Article","associatedPublications":[],"authors":[{"id":595144896,"identity":"3a9961cf-6d5b-4b11-8a8b-9f2d8bdfedb1","order_by":0,"name":"Sheng Song","email":"","orcid":"","institution":"China Academy of Chinese Medical Science","correspondingAuthor":false,"prefix":"","firstName":"Sheng","middleName":"","lastName":"Song","suffix":""},{"id":595144897,"identity":"6f44b6da-01f7-454c-b48e-a05517d2fcd8","order_by":1,"name":"Zhang Yan-Hong","email":"","orcid":"","institution":"China Academy of Chinese Medical Science","correspondingAuthor":false,"prefix":"","firstName":"Zhang","middleName":"","lastName":"Yan-Hong","suffix":""},{"id":595144898,"identity":"c868c8c3-d843-42a9-850b-9289df696321","order_by":2,"name":"Zhang Lei","email":"","orcid":"","institution":"China Academy of Chinese Medical Science","correspondingAuthor":false,"prefix":"","firstName":"Zhang","middleName":"","lastName":"Lei","suffix":""},{"id":595144899,"identity":"d6a35b3b-ff73-4d02-bd2e-c634427d7ae1","order_by":3,"name":"Ma Hang-Kun","email":"","orcid":"","institution":"China Academy of Chinese Medical Science","correspondingAuthor":false,"prefix":"","firstName":"Ma","middleName":"","lastName":"Hang-Kun","suffix":""},{"id":595144900,"identity":"0bf827c1-9cb8-48f6-a86b-75f6a47b7cd0","order_by":4,"name":"Zhao Yang","email":"","orcid":"","institution":"China Academy of Chinese Medical Science","correspondingAuthor":false,"prefix":"","firstName":"Zhao","middleName":"","lastName":"Yang","suffix":""},{"id":595144901,"identity":"8dd7ae55-1d1f-4980-a2c1-7d593ed1874d","order_by":5,"name":"Huang Ye","email":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyAQMAAABI0h/eAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAA20lEQVRIiWNgGAWjYFAC5sYDQFKOn735wIEPP4jSwtgA0mIs2XMs8eDMHhK0JG644WN8mIONCA0GxxsbDnxsY0hsuMHz4TADD4M8v9gBAlrOHGw4OLONwbhxdu+GwwUWDIYzZycQ0HIjseEw7zYG2WaZsxsOz+BhSDC4TUjL/YdgLYxtEjkPDvOwEaPlBiNYi2KPRA4DcVokzyQC/fKPwViC55gBMJAlCPuF7/jhgw8+nGGQsz/e/PjDhx828vzSBLQoHABT/2F8CfzKQUC+gbCaUTAKRsEoGOkAAMJ4UM8cEUsQAAAAAElFTkSuQmCC","orcid":"","institution":"China Academy of Chinese Medical Science","correspondingAuthor":true,"prefix":"","firstName":"Huang","middleName":"","lastName":"Ye","suffix":""}],"badges":[],"createdAt":"2026-02-10 14:08:49","currentVersionCode":1,"declarations":"","doi":"10.21203/rs.3.rs-8841918/v1","doiUrl":"https://doi.org/10.21203/rs.3.rs-8841918/v1","draftVersion":[],"editorialEvents":[],"editorialNote":"","failedWorkflow":false,"files":[{"id":103356700,"identity":"684255ec-3632-4bca-9532-1c0033355a10","added_by":"auto","created_at":"2026-02-24 18:45:16","extension":"png","order_by":1,"title":"Figure 1","display":"","copyAsset":false,"role":"figure","size":88588,"visible":true,"origin":"","legend":"\u003cp\u003eRelationships between the SOFA score and CRP level\u003c/p\u003e","description":"","filename":"floatimage1.png","url":"https://assets-eu.researchsquare.com/files/rs-8841918/v1/8f617b3c6cb1508476af935d.png"},{"id":103507175,"identity":"81318d8d-40ed-46de-8a5a-2b3da24bdf2d","added_by":"auto","created_at":"2026-02-26 13:40:39","extension":"pdf","order_by":0,"title":"","display":"","copyAsset":false,"role":"manuscript-pdf","size":741145,"visible":true,"origin":"","legend":"","description":"","filename":"manuscript.pdf","url":"https://assets-eu.researchsquare.com/files/rs-8841918/v1/1c76292d-0b7a-424f-b67a-ce0664c4e263.pdf"}],"financialInterests":"No competing interests reported.","formattedTitle":"thresholdanalysis: An R Package for Detecting and Visualizing Threshold Effects in Logistic Regression, Linear Regression, and Cox Proportional Hazards Models","fulltext":[{"header":"Introduction","content":"\u003cp\u003eWhen a dependent variable exceeds a clinically validated threshold, the magnitude and/or direction of its biological effect undergoes a nonlinear change, a phenomenon recognized as the threshold effect. This nonlinearity is particularly pervasive in biomedical research, where the dose‒response relationships between hormone levels \u003csup\u003e[\u003cspan citationid=\"CR1\" class=\"CitationRef\"\u003e1\u003c/span\u003e]\u003c/sup\u003e, drug dosages \u003csup\u003e[\u003cspan citationid=\"CR2\" class=\"CitationRef\"\u003e2\u003c/span\u003e]\u003c/sup\u003e, biomarkers \u003csup\u003e[\u003cspan citationid=\"CR3\" class=\"CitationRef\"\u003e3\u003c/span\u003e]\u003c/sup\u003e, clinical features \u003csup\u003e[\u003cspan citationid=\"CR4\" class=\"CitationRef\"\u003e4\u003c/span\u003e]\u003c/sup\u003e and disease status frequently demonstrate threshold-dependent behavior. Specifically, these relationships often exhibit discontinuous transitions, wherein incremental quantitative changes in the predictor variable trigger qualitative shifts in clinical outcomes. The identification of statistically robust threshold effects has significant translational implications. Once empirically validated, such thresholds enable prospective stratification of disease risk, dynamic monitoring of progression patterns, and personalized prognostication. This predictive capacity highlights the clinical utility of incorporating threshold effect modeling as an adjunctive analytical paradigm to conventional statistical approaches, thereby augmenting the actionable intelligence derived from biomedical research for evidence-based decision-making.\u003c/p\u003e \u003cp\u003eSegmented linear regression and recursive partitioning methods represent two primary analytical frameworks for characterizing nonlinear relationships that have gained prominence in recent years for threshold effect modeling in large-scale observational studies\u003csup\u003e[\u003cspan additionalcitationids=\"CR6\" citationid=\"CR5\" class=\"CitationRef\"\u003e5\u003c/span\u003e\u0026ndash;\u003cspan citationid=\"CR7\" class=\"CitationRef\"\u003e7\u003c/span\u003e]\u003c/sup\u003e.\u003c/p\u003e \u003cp\u003eWhile R remains the dominant computational platform for such analyses, the current implementation landscape lacks dedicated toolkits specifically designed for threshold effect detection. Existing workflows necessitate custom coding of threshold identification algorithms, which involves substantial programming effort and requires advanced statistical expertise. This methodological gap poses significant barriers to nonspecialist researchers seeking to incorporate threshold analyses into their research programs. To address these challenges, we developed the R package thresholdanalysis, which implements a standardized analytical pipeline for threshold effect detection through modular programming. The package integrates three core functionalities: automated threshold identification via optimized segmentation algorithms, visualization of threshold-dependent effect patterns, and comprehensive reporting of statistical metrics. By encapsulating complex computational procedures into user-friendly functions, our tool substantially reduces the technical barriers to threshold analysis while enhancing methodological rigor and resulting in reproducibility across diverse biomedical research applications.\u003c/p\u003e"},{"header":"Materials and Methods","content":"\u003cp\u003eThis R package was constructed utilizing R (v4.2.0) and R Studio (v2025.9.2.418) as the integrated development ecosystem. Package initialization was performed via the usethis framework, enabling automated generation of foundational files, including the DESCRIPTION metadata manifest and the NAMESPACE function scoping declaration. Development environment validation and package deployment were executed through the devtools toolchain. Documentation automation was achieved through the roxygen2 package, which facilitated bidirectional synchronization between in-code annotations and rendered help files. The details of the program are divided into five key steps, and the specific contents of each step are described below.\u003c/p\u003e\n\u003ch3\u003e1. Construction of the restricted cubic spline model\u003c/h3\u003e\n\u003cp\u003eThe restricted cubic spline (RCS) is employed to capture the nonlinear association between the independent variable (\u003cem\u003eX\u003c/em\u003e) and the dependent variable (\u003cem\u003eY\u003c/em\u003e). By default, four knots are strategically positioned to flexibly model the curvature of this relationship. Then, we observe whether there is a nonlinear relationship between the two. If there are apparent breakpoints in the visual inspection, the recursive method and the maximum likelihood method are used to identify the fitting model with the highest likelihood value.\u003c/p\u003e\n\u003ch3\u003e2. Threshold search algorithm\u003c/h3\u003e\n\u003cp\u003eIn the preliminary screening stage, we identify potential threshold candidates by considering the percentiles ranging from the 5th to the 95th percentiles of the X distribution. All percentiles within this specified range are treated as viable candidates for further evaluation. For each candidate threshold, we partition the dataset on the basis of this threshold and construct a segmented model accordingly. We subsequently compute the log-likelihood for each segmented model to evaluate its fit to the data. The percentile associated with the highest log-likelihood (LL) value is then selected as the preliminary threshold for subsequent refinement. Following the preliminary screening, we conduct a fine search to further refine the threshold selection. This involves examining candidate values within a narrow range of \u0026plusmn;\u0026thinsp;4% around the preliminary threshold. For each of these refined candidate thresholds, we repeat the process of constructing segmented models and calculating their corresponding LLs. When the data volume within the range is greater than 5, the 25th, 50th, and 75th percentiles are calculated within this range. The quantile point with the maximum LL is selected as the candidate threshold, and the candidate threshold range is narrowed to the 25th percentile range before and after this quantile point. The recursive method is used to iteratively exclude 50% of X values in each recursion until the data volume within the 25th percentile range around the candidate threshold no longer exceeds 5. When the data volume within the range no longer exceeds 5, further determine the threshold in the following three cases: when the data volume in this range is 2\u0026ndash;5, select the data point that gives the maximum model LL as the threshold; when the data volume is 1, use this unique value as the threshold; and when the data volume is empty, return to the previous iteration and use the obtained threshold as the final threshold. Ultimately, the threshold that yields the highest LL value during this fine search phase is designated the optimal threshold \u0026ldquo;\u003cem\u003ecut_off\u003c/em\u003e\u0026rdquo;, representing the most suitable partition point for the given dataset.\u003c/p\u003e\n\u003ch3\u003e3. Construction of Segmentation Models\u003c/h3\u003e\n\u003cp\u003e \u003cem\u003eX\u003c/em\u003e \u0026ldquo;\u003cem\u003evar_name\u003c/em\u003e\u0026rdquo; is divided into two segments on the basis of the optimal threshold \u0026ldquo;\u003cem\u003ecut_off\u003c/em\u003e\u0026rdquo; as follows: \u003cb\u003eX1\u003c/b\u003e \u003cb\u003ecalculation\u003c/b\u003e: Define \u003cem\u003eX\u003c/em\u003e1\u0026thinsp;=\u0026thinsp;max (0, \u003cem\u003ecut\u003c/em\u003e_\u003cem\u003eoff\u003c/em\u003e\u0026minus;\u003cem\u003evar\u003c/em\u003e_\u003cem\u003ename\u003c/em\u003e). When var_name is less than \u003cem\u003ecut_off\u003c/em\u003e, the value is equal to \u003cem\u003ecut\u003c/em\u003e_\u003cem\u003eoff\u003c/em\u003e\u0026minus;\u003cem\u003evar\u003c/em\u003e_\u003cem\u003ename\u003c/em\u003e; when \u003cem\u003evar_name\u003c/em\u003e is greater than or equal to \u003cem\u003ecut_off\u003c/em\u003e, \u003cem\u003eX1\u003c/em\u003e takes a value of 0. \u003cb\u003eX2 Calculation\u003c/b\u003e: Define \u003cem\u003eX\u003c/em\u003e2\u0026thinsp;=\u0026thinsp;max (0, \u003cem\u003evar\u003c/em\u003e_\u003cem\u003ename\u003c/em\u003e\u0026minus;\u003cem\u003ecut\u003c/em\u003e_\u003cem\u003eoff\u003c/em\u003e). When \u003cem\u003evar_name\u003c/em\u003e is greater than cut_off, the value is equal to \u003cem\u003evar\u003c/em\u003e_\u003cem\u003ename\u003c/em\u003e\u0026minus;\u003cem\u003ecut\u003c/em\u003e_\u003cem\u003eoff\u003c/em\u003e; when \u003cem\u003evar_name\u003c/em\u003e is less than or equal to \u003cem\u003ecut_off\u003c/em\u003e, \u003cem\u003eX2\u003c/em\u003e is set to 0.\u003c/p\u003e \u003cp\u003eThere are three models in total: the baseline model \u003cb\u003e(\u003c/b\u003emdl0\u003cb\u003e).\u003c/b\u003e This model includes the original form of \u003cem\u003eX\u003c/em\u003e along with all the covariates. This model serves as a reference model for comparison with the subsequent segmented models. Segmented Model (mdl1) In this model, the original independent variable is replaced by the segmented variables \u003cem\u003eX1\u003c/em\u003e and \u003cem\u003eX2\u003c/em\u003e. This model is employed to investigate whether the influence of \u003cem\u003eX\u003c/em\u003e on \u003cem\u003eY\u003c/em\u003e varies across different intervals. Threshold-Testing Model (mdl2) This model, which incorporates \u003cem\u003eX2\u003c/em\u003e and the original \u003cem\u003eX\u003c/em\u003e, tests for a threshold effect and determines if the part of the variable exceeding the threshold (\u003cem\u003eX2\u003c/em\u003e) has an extra impact on \u003cem\u003eY\u003c/em\u003e, given the original target variable.\u003c/p\u003e\n\u003cdiv class=\"Heading\"\u003e4. \u003cb\u003eModel Comparison and Threshold Effect Assessment\u003c/b\u003e\u003c/div\u003e \u003cp\u003eA comparative evaluation of the fit between mdl0 and mdl1 is conducted via the likelihood ratio test (LRT). The fundamental principle underlying the LRT is to juxtapose the likelihood function values of two nested models and compute the likelihood ratio statistic, which adheres to a chi-square (χ\u0026sup2;) distribution. The likelihood ratio statistic is computed via the following formula: \u003cem\u003elikelihood ratio\u003c/em\u003e\u0026thinsp;=\u0026thinsp;\u0026minus;\u0026thinsp;\u003cem\u003e2\u0026times;(logLik(mdl0) \u0026minus;logLik(mdl1))\u003c/em\u003e. Here, \u003cem\u003elogLik(mdl0)\u003c/em\u003e and \u003cem\u003elogLik(mdl1)\u003c/em\u003e denote the log-likelihood values corresponding to mdl0 and mdl1, respectively.\u003c/p\u003e \u003cp\u003eThe \u003cem\u003eP\u003c/em\u003e value is determined on the basis of the degrees of freedom associated with the χ\u0026sup2; distribution. If the \u003cem\u003eP\u003c/em\u003e value is less than 0.05, it can be concluded that, at a significance level of 0.05, mdl1 results in a significantly better fit than does mdl0. This finding provides evidence for the presence of a threshold effect. In other words, the influence of X on Y demonstrates substantial differences across different intervals.\u003c/p\u003e\n\u003ch3\u003e5. Visualization and Output of the Results\u003c/h3\u003e\n\u003cp\u003eThe ggplot2 package is employed to generate a trend plot depicting the effect size curve along with its corresponding \u003cem\u003e95%\u003c/em\u003e confidence interval (\u003cem\u003eCI\u003c/em\u003e) as \u003cem\u003eX\u003c/em\u003e changes.\u003c/p\u003e \u003cp\u003eIn the resulting graph, the effect size curve is represented by a solid blue line. The \u003cem\u003e95% CI\u003c/em\u003e is visualized as a light blue, semitransparent region surrounding the effect size curve. The optimal threshold position is marked on the graph with a red dashed line. Additionally, a rug plot is included at the bottom of the graph. A rug plot consists of short lines, each representing an individual observation from the original dataset. This approach helps in understanding the concentration and overall shape of the data distribution within the range of \u003cem\u003eX\u003c/em\u003e values.\u003c/p\u003e \u003cp\u003eAll generated results are automatically stored in an Excel file. The outcomes of the three models are presented as follows: For each of mdl0, mdl1, and mdl2, the effect sizes are enumerated, together with their respective 95% CIs and corresponding \u003cem\u003eP\u003c/em\u003e values. Other results also include the cutoff value, likelihood ratio statistic, degree of freedom, and \u003cem\u003eP\u003c/em\u003e value.\u003c/p\u003e\n\u003ch3\u003e6. Dataset\u003c/h3\u003e\n\u003cp\u003eThe data of this study were derived from the online database DATADRYAD (\u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://doi.org/10.5061/dryad.6v0j9\u003c/span\u003e\u003cspan address=\"10.5061/dryad.6v0j9\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e) which is an open data publishing platform and a community committed to the open availability and routine re-use of all research data. According to the Terms of Service, we cited the data package Jung, Su-Young J et al. (2019), Data from: Phosphate is a potential biomarker of disease severity and predicts adverse outcomes in acute kidney injury patients undergoing continuous renal replacement therapy, Dryad, Dataset, \u003cspan class=\"ExternalRef\"\u003e\u003cspan class=\"RefSource\"\u003ehttps://doi.org/10.5061/dryad.6v0j9\u003c/span\u003e\u003cspan address=\"10.5061/dryad.6v0j9\" targettype=\"DOI\" class=\"RefTarget\"\u003e\u003c/span\u003e\u003c/span\u003e\u003csup\u003e[\u003cspan citationid=\"CR8\" class=\"CitationRef\"\u003e8\u003c/span\u003e]\u003c/sup\u003e. This study included medical records of 1,145 patients who received continuous renal replacement therapy in the Intensive Care Units of Health System Severance Hospital affiliated with Yonsei University and Ilsan Hospital of the National Health Insurance Service Medical Center in South Korea from January 2009 to September 2016\u003csup\u003e[\u003cspan citationid=\"CR8\" class=\"CitationRef\"\u003e8\u003c/span\u003e]\u003c/sup\u003e. The original study was approved by the Yonsei University Health System Severance Hospital Institutional Review Board (No. 4-2016-1073) and research involving human research participants have been performed in accordance with the Declaration of Helsinki. All patient data in this study are anonymous and the requirement of the informed consent was waived because of the nature of the study \u003csup\u003e[\u003cspan citationid=\"CR9\" class=\"CitationRef\"\u003e9\u003c/span\u003e, \u003cspan citationid=\"CR10\" class=\"CitationRef\"\u003e10\u003c/span\u003e]\u003c/sup\u003e. As this study involved the mining of the public database, formal permission and informed consent from the ethical review board were not required for this study \u003csup\u003e[\u003cspan citationid=\"CR11\" class=\"CitationRef\"\u003e11\u003c/span\u003e, \u003cspan citationid=\"CR12\" class=\"CitationRef\"\u003e12\u003c/span\u003e]\u003c/sup\u003e. In this study, we demonstrated threshold analysis via linear regression (LinR), logistic regression (LR), and Cox proportional hazards (Cox) as examples.\u003c/p\u003e"},{"header":"Results","content":"\u003cp\u003eThe data file was stored in the xlsx format under the path \"C:\\Users\\74736\\Desktop\\r\", and the data file \"CRRTstudy_1144patients_revised.xlsx\" was read and stored in the data object. The threshold analysis package was downloaded and installed from GitHub, and the threshold analysis and readxl packages were loaded. Samples with missing values were removed. The code is as follows:\u003c/p\u003e \u003cp\u003e#set working directory\u003c/p\u003e \u003cp\u003esetwd(\"C:\\\\Users\\\\74736\\\\Desktop\\\\r\")\u003c/p\u003e \u003cp\u003e#load clinical dataset\u003c/p\u003e \u003cp\u003edata\u0026lt;- read_excel(\"CRRTstudy_1144patients_revised.xlsx\")\u003c/p\u003e \u003cp\u003e#download, install, and load the R package\u003c/p\u003e \u003cp\u003edevtools::install_github(\"XiyuanEM-DrSheng/thresholdanalysis\",force\u0026thinsp;=\u0026thinsp;TRUE)\u003c/p\u003e \u003cp\u003elibrary(thresholdanalysis)\u003c/p\u003e \u003cp\u003elibrary(readxl)\u003c/p\u003e \u003cp\u003e#remove samples with missing values\u003c/p\u003e \u003cp\u003edata\u0026lt;-na.omit(data)\u003c/p\u003e \u003cp\u003eFor LinR, X was SOFA, and Y was CRP. For LR, X was SOFA, and Y was Death_28D. Additionally, for Cox with a follow-up time of time_to_death_28D, X was the SOFA, and Y was Death_28D. All three regression models were adjusted for the confounding factors of Age and Sex.\u003c/p\u003e \u003cp\u003eFirst, threshold analysis is demonstrated using LinR as an example. In the specified modeling framework, the formula \u003cem\u003eCRP~SOFA\u0026thinsp;+\u0026thinsp;Age+Sex\u003c/em\u003e defines a multivariate regression structure wherein the data represents the data frame encompassing all the variables included in the formula. \u003cem\u003evar_name\u003c/em\u003e denotes the \u003cem\u003eX\u003c/em\u003e SOFA subjected to threshold effect analysis, and \u003cem\u003ercs_nodes\u003c/em\u003e specifies the number of knots (default\u0026thinsp;=\u0026thinsp;4) for restricted cubic splines applied to this focal variable to capture potential nonlinear relationships. The code is as follows:\u003c/p\u003e \u003cp\u003eresult_linear \u0026lt;- linear_threshold(CRP~SOFA\u0026thinsp;+\u0026thinsp;Age+Sex,\u003c/p\u003e \u003cp\u003edata\u0026thinsp;=\u0026thinsp;data,\u003c/p\u003e \u003cp\u003ercs_nodes\u0026thinsp;=\u0026thinsp;4,\u003c/p\u003e \u003cp\u003evar_name = \"SOFA\")\u003c/p\u003e \u003cp\u003eUpon execution of the linear_threshold command, an Excel file named \u003cem\u003elinear_threshold_results.xlsx\u003c/em\u003e is automatically generated in the path. The first worksheet, \u003cem\u003eCutoff\u003c/em\u003e, displays a cutoff value of 8. The second, third, and fourth worksheets \u003cem\u003emdl0_Results\u003c/em\u003e, \u003cem\u003emdl1_Results\u003c/em\u003e, and \u003cem\u003emdl2_Results\u003c/em\u003e correspond to the results of mdl0, mdl1, and mdl2, respectively, and the fifth worksheet \u003cem\u003eLRTest\u003c/em\u003e presents the results of the LRT, including the \u003cem\u003eP\u003c/em\u003e value and χ\u0026sup2; value.\u003c/p\u003e \u003cp\u003eAfter adjusting for Age and Sex, the results of the mdl0 score revealed that each 1-point increase in SOFA was associated with a 4.73 mg/dL increase in CRP level \u003cem\u003e(95% CI\u003c/em\u003e: 1.97\u0026ndash;7.49, \u003cem\u003eP\u003c/em\u003e\u0026thinsp;\u0026lt;\u0026thinsp;0.001). For mdl1, when SOFA was \u0026le;\u0026thinsp;8, each 1-point increase in SOFA was associated with a 3.88 mg/dL increase in CRP level \u003cem\u003e(95% CI\u003c/em\u003e: -6.43\u0026ndash;14.19, \u003cem\u003eP\u003c/em\u003e\u0026thinsp;=\u0026thinsp;0.461); when SOFA was \u0026gt;\u0026thinsp;8, each 1-point increase in SOFA was associated with a 6.64 mg/dL increase in CRP \u003cem\u003elevel (95% CI\u003c/em\u003e: 3.11\u0026ndash;10.16, \u003cem\u003eP\u003c/em\u003e\u0026thinsp;\u0026lt;\u0026thinsp;0.001). The difference in regression coefficients between SOFA\u0026thinsp;\u0026le;\u0026thinsp;8 and SOFA\u0026thinsp;\u0026gt;\u0026thinsp;8 was 10.52 mg/dL (\u003cem\u003e95% CI\u003c/em\u003e: -1.62\u0026ndash;22.65, \u003cem\u003eP\u003c/em\u003e\u0026thinsp;=\u0026thinsp;0.090). The LRT comparing mdl0 and mdl1 yielded a \u003cem\u003eP\u003c/em\u003e value of 0.055 and a \u003cem\u003eχ\u0026sup2;\u003c/em\u003e value of 2.91, indicating that at the threshold SOFA value of 8, there was insufficient evidence to conclude a significant difference in the effect of SOFA on CRP between the two segments (Table\u0026nbsp;\u003cspan refid=\"Tab1\" class=\"InternalRef\"\u003e1\u003c/span\u003e). The relationship plot between SOFA and CRP after adjusting for Age and Sex is also automatically generated in the path, as shown in Fig.\u0026nbsp;\u003cspan refid=\"Fig1\" class=\"InternalRef\"\u003e1\u003c/span\u003e.\u003c/p\u003e \u003cp\u003e \u003cdiv class=\"gridtable\"\u003e\u003ctable float=\"Yes\" id=\"Tab1\" border=\"1\"\u003e \u003ccaption language=\"En\"\u003e \u003cdiv class=\"CaptionNumber\"\u003eTable 1\u003c/div\u003e \u003cdiv class=\"CaptionContent\"\u003e \u003cp\u003eResults of mdl0, mdl1, and mdl2\u003c/p\u003e \u003c/div\u003e \u003c/caption\u003e \u003ccolgroup cols=\"7\"\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c1\" colnum=\"1\"\u003e\u003c/div\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c2\" colnum=\"2\"\u003e\u003c/div\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c3\" colnum=\"3\"\u003e\u003c/div\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c4\" colnum=\"4\"\u003e\u003c/div\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c5\" colnum=\"5\"\u003e\u003c/div\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c6\" colnum=\"6\"\u003e\u003c/div\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c7\" colnum=\"7\"\u003e\u003c/div\u003e \u003cthead\u003e \u003ctr\u003e \u003cth align=\"left\" colname=\"c1\"\u003e \u003cp\u003emdl0\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c2\"\u003e \u003cp\u003eBeta\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c3\"\u003e \u003cp\u003estd. error\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c4\"\u003e \u003cp\u003estatistic\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c5\"\u003e \u003cp\u003e\u003cem\u003eP\u003c/em\u003e value\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c6\"\u003e \u003cp\u003eLower \u003cem\u003eCI\u003c/em\u003e\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c7\"\u003e \u003cp\u003eUpper \u003cem\u003eCI\u003c/em\u003e\u003c/p\u003e \u003c/th\u003e \u003c/tr\u003e \u003c/thead\u003e \u003ctbody\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eIntercept\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003e21.63\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c3\"\u003e \u003cp\u003e31.76\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c4\"\u003e \u003cp\u003e0.68\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c5\"\u003e \u003cp\u003e0.496\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c6\"\u003e \u003cp\u003e-40.62\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c7\"\u003e \u003cp\u003e83.88\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eSOFA\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003e4.73\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c3\"\u003e \u003cp\u003e1.41\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c4\"\u003e \u003cp\u003e3.36\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c5\"\u003e \u003cp\u003e\u0026lt;\u0026thinsp;0.001\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c6\"\u003e \u003cp\u003e1.97\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c7\"\u003e \u003cp\u003e7.49\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eAge\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003e0.57\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c3\"\u003e \u003cp\u003e0.32\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c4\"\u003e \u003cp\u003e1.75\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c5\"\u003e \u003cp\u003e0.080\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c6\"\u003e \u003cp\u003e-0.07\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c7\"\u003e \u003cp\u003e1.20\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eSex\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003e1.00\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c3\"\u003e \u003cp\u003e9.55\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c4\"\u003e \u003cp\u003e0.10\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c5\"\u003e \u003cp\u003e0.917\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c6\"\u003e \u003cp\u003e-17.72\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c7\"\u003e \u003cp\u003e19.72\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003emdl1\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003eBeta\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c3\"\u003e \u003cp\u003estd. error\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c4\"\u003e \u003cp\u003estatistic\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c5\"\u003e \u003cp\u003e\u003cem\u003eP\u003c/em\u003e value\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c6\"\u003e \u003cp\u003eLower \u003cem\u003eCI\u003c/em\u003e\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c7\"\u003e \u003cp\u003eUpper \u003cem\u003eCI\u003c/em\u003e\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eIntercept\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003e49.29\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c3\"\u003e \u003cp\u003e26.73\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c4\"\u003e \u003cp\u003e1.84\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c5\"\u003e \u003cp\u003e0.066\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c6\"\u003e \u003cp\u003e-3.09\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c7\"\u003e \u003cp\u003e101.67\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003e\u003cem\u003eX1\u003c/em\u003e\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003e3.88\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c3\"\u003e \u003cp\u003e5.26\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c4\"\u003e \u003cp\u003e0.74\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c5\"\u003e \u003cp\u003e0.461\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c6\"\u003e \u003cp\u003e-6.43\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c7\"\u003e \u003cp\u003e14.19\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003e\u003cem\u003eX2\u003c/em\u003e\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003e6.64\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c3\"\u003e \u003cp\u003e1.80\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c4\"\u003e \u003cp\u003e3.69\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c5\"\u003e \u003cp\u003e\u0026lt;\u0026thinsp;0.001\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c6\"\u003e \u003cp\u003e3.11\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c7\"\u003e \u003cp\u003e10.16\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eAge\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003e0.59\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c3\"\u003e \u003cp\u003e0.32\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c4\"\u003e \u003cp\u003e1.83\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c5\"\u003e \u003cp\u003e0.068\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c6\"\u003e \u003cp\u003e-0.04\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c7\"\u003e \u003cp\u003e1.23\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eSex\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003e0.27\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c3\"\u003e \u003cp\u003e9.54\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c4\"\u003e \u003cp\u003e0.03\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c5\"\u003e \u003cp\u003e0.977\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c6\"\u003e \u003cp\u003e-18.43\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c7\"\u003e \u003cp\u003e18.97\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003emdl2\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003eBeta\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c3\"\u003e \u003cp\u003estd. error\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c4\"\u003e \u003cp\u003estatistic\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c5\"\u003e \u003cp\u003e\u003cem\u003eP\u003c/em\u003e value\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c6\"\u003e \u003cp\u003eLower \u003cem\u003eCI\u003c/em\u003e\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c7\"\u003e \u003cp\u003eUpper \u003cem\u003eCI\u003c/em\u003e\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eIntercept\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003e80.34\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c3\"\u003e \u003cp\u003e46.90\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c4\"\u003e \u003cp\u003e1.71\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c5\"\u003e \u003cp\u003e0.087\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c6\"\u003e \u003cp\u003e-11.58\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c7\"\u003e \u003cp\u003e172.26\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003e\u003cem\u003eX2\u003c/em\u003e\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003e10.52\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c3\"\u003e \u003cp\u003e6.19\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c4\"\u003e \u003cp\u003e1.70\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c5\"\u003e \u003cp\u003e0.090\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c6\"\u003e \u003cp\u003e-1.62\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c7\"\u003e \u003cp\u003e22.65\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eSOFA\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003e-3.88\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c3\"\u003e \u003cp\u003e5.26\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c4\"\u003e \u003cp\u003e-0.74\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c5\"\u003e \u003cp\u003e0.461\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c6\"\u003e \u003cp\u003e-14.19\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c7\"\u003e \u003cp\u003e6.43\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eAge\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003e0.59\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c3\"\u003e \u003cp\u003e0.32\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c4\"\u003e \u003cp\u003e1.83\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c5\"\u003e \u003cp\u003e0.068\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c6\"\u003e \u003cp\u003e-0.04\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c7\"\u003e \u003cp\u003e1.23\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eSex\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003e0.27\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c3\"\u003e \u003cp\u003e9.54\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c4\"\u003e \u003cp\u003e0.03\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c5\"\u003e \u003cp\u003e0.977\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c6\"\u003e \u003cp\u003e-18.43\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c7\"\u003e \u003cp\u003e18.97\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003c/tbody\u003e \u003c/colgroup\u003e \u003ctfoot\u003e \u003ctr\u003e\u003ctd colspan=\"7\"\u003estd. error: standard error, CI: confidence interval\u003c/td\u003e\u003c/tr\u003e \u003c/tfoot\u003e \u003c/table\u003e\u003c/div\u003e \u003c/p\u003e \u003cp\u003e \u003c/p\u003e \u003cp\u003eThe threshold effect analysis functions for LR and Cox are named logistic_threshold and cox_threshold, respectively. The specific usage methods of these functions are as follows. The outputs of the tables and figures, as well as their explanations, are similar to those of LinR. Thus, it will not be elaborated here.\u003c/p\u003e \u003cp\u003eresult_logistic \u0026lt;- logistic_threshold(Death_28D\u0026thinsp;~\u0026thinsp;SOFA\u0026thinsp;+\u0026thinsp;Age+Sex,\u003c/p\u003e \u003cp\u003edata\u0026thinsp;=\u0026thinsp;data,\u003c/p\u003e \u003cp\u003ercs_nodes\u0026thinsp;=\u0026thinsp;4,\u003c/p\u003e \u003cp\u003evar_name = \"SOFA\")\u003c/p\u003e \u003cp\u003eresult_cox \u0026lt;- cox_threshold(\u003c/p\u003e \u003cp\u003eSurv(time_to_death_28D, Death_28D) ~ SOFA\u0026thinsp;+\u0026thinsp;Age+Sex,\u003c/p\u003e \u003cp\u003edata\u0026thinsp;=\u0026thinsp;data,\u003c/p\u003e \u003cp\u003ercs_nodes\u0026thinsp;=\u0026thinsp;4,\u003c/p\u003e \u003cp\u003evar_name = \"SOFA\")\u003c/p\u003e"},{"header":"Discussion","content":"\u003cp\u003eThreshold effect analysis was initially used to study the activation and inhibition processes of biological phenomena. With the development of medical research and clinical practice, threshold analysis has been introduced into the medical field to determine disease diagnostic criteria, formulate treatment plans, and develop preventive measures. It plays an important role in helping medical workers formulate more scientific and personalized diagnosis, treatment, and prevention strategies. For example, in an early study by the research group, a national multicenter retrospective registration cohort study based on the Chunbo Wanxiang platform used threshold effects to explore the range of traditional Chinese medicine applications in the treatment of diarrhea \u003csup\u003e[\u003cspan citationid=\"CR13\" class=\"CitationRef\"\u003e13\u003c/span\u003e]\u003c/sup\u003e. However, when threshold effect analysis is conducted, nonstatistical professionals usually encounter challenges because certain professional knowledge and programming skills are needed.\u003c/p\u003e \u003cp\u003eIn response to the complexity and heavy workload of threshold effect analysis, there is currently no dedicated R package that can fully implement this analysis. Therefore, this study simplifies the process and reduces the requirement for programming skills by writing code, enabling nonstatistical professionals to conduct threshold effect analysis. In addition to LinR, this study provides R functions for threshold analysis of three commonly used regression models: LR and Cox. Through preset code, researchers only need to define independent variables, covariates to be adjusted, and dependent variables to quickly implement threshold effect analysis and visualization, which greatly improves researchers' data analysis capabilities and efficiency.\u003c/p\u003e \u003cp\u003eOf course, it should be acknowledged that there are still some limitations and challenges in current threshold analysis. First, due to individual differences in biological characteristics, thresholds may be unstable and uncertain. This may require large-scale clinical trials and practical application verification for specific disease types or clinical scenarios, considering the integration of multiple biological characteristic data, such as genomics, proteomics, and metabolomics data, to establish a more comprehensive and personalized threshold-setting model. Second, the thresholds of certain medical phenomena may change over time. For example, the sensitivity of pathogens to antibiotics may gradually decrease over time, leading to changes in treatment thresholds. Therefore, it is necessary to consider dynamic changes in the time dimension. However, relevant medical time-dependent threshold effect models are currently lacking. In the future, experts from multiple fields, such as medicine, statistics, and computer science, need to jointly participate in the establishment and optimization of mathematical models.\u003c/p\u003e"},{"header":"Declarations","content":"\u003cp\u003eAcknowledgments\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eSheng Song\u003c/strong\u003e:\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eConceptualization\u003c/strong\u003e: Designed the package’s core framework and threshold detection algorithms. \u003cstrong\u003eSoftware\u003c/strong\u003e: Developed the R package codebase, which includes functions for smooth curve fitting and likelihood ratio tests. \u003cstrong\u003eValidation\u003c/strong\u003e: Conducted simulations and clinical data analyses to verify statistical robustness. \u003cstrong\u003eWriting Original Draft\u003c/strong\u003e: Prepared the initial manuscript and package documentation.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eZhang Yan-Hong\u003c/strong\u003e, \u003cstrong\u003eZhang Lei\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eRevised the statistical methods and clinical interpretation sections.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eMa Hang-Kun\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eDesigned diagnostic plots for threshold effect visualization.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eZhao Yang\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eThe recursive threshold-searching algorithm was optimized for computational efficiency.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eHuang Ye\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eThe final version of the manuscript and package release have been approved.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eFunding\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eNone\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eSupplementary material\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eNone.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eConflict of interest\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eAll\u0026nbsp;the authors\u0026nbsp;disclosed\u0026nbsp;no\u0026nbsp;relevant\u0026nbsp;relationships.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eData availability\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eThe datasets analyzed during the current study are available in the DATADRYAD (https://doi.org/10.5061/dryad.6v0j9).\u003c/p\u003e"},{"header":"References","content":"\u003col\u003e\u003cli\u003e\u003cspan\u003eWEI C X, ZHANG J W, X. I. A. N. G. S. et al. Reproductive outcomes in fresh transfer cycles and antagonists with premature luteinizing and/or progesterone surge: a single center retrospective cohort study [J]. \u003cem\u003eFront. Endocrinol.\u003c/em\u003e \u003cb\u003e15\u003c/b\u003e, 1411106 (2024).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eTIAN, J. et al. Antipsychotic drug dosing and study discontinuation in schizophrenia: A systematic review and dose-response meta-analysis [J]. \u003cem\u003eEur. neuropsychopharmacology: J. Eur. Coll. Neuropsychopharmacol.\u003c/em\u003e \u003cb\u003e94\u003c/b\u003e, 51\u0026ndash;58 (2025).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eCHEN, Q. et al. Serum anion gap on admission predicts intensive care unit mortality in patients with aortic aneurysm [J]. \u003cem\u003eExperimental therapeutic Med.\u003c/em\u003e \u003cb\u003e16\u003c/b\u003e (3), 1766\u0026ndash;1777 (2018).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eXU F Q, S. H. E. N. G. S. et al. Charlson Comorbidity Index is correlated with all-cause readmission within six months in patients with heart failure: a retrospective cohort study in China [J]. \u003cem\u003eBMC Cardiovasc. Disord.\u003c/em\u003e \u003cb\u003e23\u003c/b\u003e (1), 111 (2023).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003ePARK S Y et al. Association of Coffee Consumption With Total and Cause-Specific Mortality Among Nonwhite Populations [J]. \u003cem\u003eAnn. Intern. Med.\u003c/em\u003e \u003cb\u003e167\u003c/b\u003e (4), 228\u0026ndash;235 (2017).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eSEIDELMANN, S. B. \u0026amp; CLAGGETT, B. Dietary carbohydrate intake and mortality: a prospective cohort study and meta-analysis [J]. \u003cem\u003eLancet Public. health\u003c/em\u003e. \u003cb\u003e3\u003c/b\u003e (9), e419\u0026ndash;e28 (2018).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eSHENG, S. et al. Albumin levels predict mortality in sepsis patients with acute kidney injury undergoing continuous renal replacement therapy: a secondary analysis based on a retrospective cohort study [J]. \u003cem\u003eBMC Nephrol.\u003c/em\u003e \u003cb\u003e23\u003c/b\u003e (1), 52 (2022).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eJUNG S Y, KWON, J. et al. Phosphate is a potential biomarker of disease severity and predicts adverse outcomes in acute kidney injury patients undergoing continuous renal replacement therapy [J]. \u003cem\u003ePloS one\u003c/em\u003e. \u003cb\u003e13\u003c/b\u003e (2), e0191290 (2018).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eGELERIS, J. et al. Observational Study of Hydroxychloroquine in Hospitalized Patients with Covid-19 [J]. \u003cem\u003eN. Engl. J. Med.\u003c/em\u003e \u003cb\u003e382\u003c/b\u003e (25), 2411\u0026ndash;2418 (2020).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eLUO, Y. \u0026amp; SUN, X. A DWI-based radiomics-clinical machine learning model to preoperatively predict the futile recanalization after endovascular treatment of acute basilar artery occlusion patients [J]. \u003cem\u003eEur. J. Radiol.\u003c/em\u003e \u003cb\u003e161\u003c/b\u003e, 110731 (2023).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eHE, R. et al. Cuproptosis-related genes score and its hub gene GCSH: A novel predictor for cholangiocarcinomas prognosis based on RNA seq and experimental analyses [J]. \u003cem\u003eJ. Cancer\u003c/em\u003e. \u003cb\u003e15\u003c/b\u003e (6), 1551\u0026ndash;1567 (2024).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eWANG, J. et al. Development and Validation of a Competitive Risk Model in Elderly Patients With Chromophobe Cell Renal Carcinoma: A Population-Based Study [J]. \u003cem\u003eFront. public. health\u003c/em\u003e. \u003cb\u003e10\u003c/b\u003e, 840525 (2022).\u003c/span\u003e\u003c/li\u003e \u003cli\u003e\u003cspan\u003eSHENG, S. et al. An analysis of the association and threshold effect between treatment course of acupoint application and diarrheal recovery in community hospitals nationwide: a multicenter retrospective cohort study [J]. \u003cem\u003eChin. J. Integr. Traditional Western Med. Digestion (Chin)\u003c/em\u003e. \u003cb\u003e29\u003c/b\u003e (11), 757\u0026ndash;761 (2021).\u003c/span\u003e\u003c/li\u003e\u003c/ol\u003e"}],"fulltextSource":"","fullText":"","funders":[],"hasAdminPriorityOnWorkflow":false,"hasManuscriptDocX":true,"hasOptedInToPreprint":true,"hasPassedJournalQc":"","hasAnyPriority":false,"hideJournal":false,"highlight":"","institution":"","isAcceptedByJournal":false,"isAuthorSuppliedPdf":false,"isDeskRejected":"","isHiddenFromSearch":false,"isInQc":false,"isInWorkflow":false,"isPdf":false,"isPdfUpToDate":true,"isWithdrawnOrRetracted":false,"journal":{"display":true,"email":"
[email protected]","identity":"scientific-reports","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":false,"externalIdentity":"scirep","sideBox":"Learn more about [Scientific Reports](http://www.nature.com/srep/)","snPcode":"","submissionUrl":"","title":"Scientific Reports","twitterHandle":"","acdcEnabled":true,"dfaEnabled":true,"editorialSystem":"stoa","reportingPortfolio":"Scientific Reports","inReviewEnabled":true,"inReviewRevisionsEnabled":true},"keywords":"Threshold Effect, Maximum Likelihood Method, Recursive Method, Piecewise Linear Regression, R Software","lastPublishedDoi":"10.21203/rs.3.rs-8841918/v1","lastPublishedDoiUrl":"https://doi.org/10.21203/rs.3.rs-8841918/v1","license":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"},"manuscriptAbstract":"\u003cp\u003eWhen a dependent variable exceeds a certain threshold, a significant change in its magnitude and/or direction is called a threshold effect. As a statistical tool, threshold effect analysis can predict the occurrence, development, and prognosis of a disease, which is highly important. However, there is currently a lack of open-source, free, simple, and effective tools to implement threshold effect analysis. The process of determining thresholds is complex and labor intensive, requiring high programming skills. Therefore, this study demonstrates how to simplify this process and reduce programming skill requirements via the self-developed R package \"thresholdanalysis\", which enables nonstatistical professionals to conduct threshold effect analysis. First, smooth curve fitting is used to observe whether there is a nonlinear relationship between the dependent variable and the independent variable. If a threshold is visually observed, the maximum likelihood method, recursive method, piecewise linear model, and likelihood ratio test are used to determine the threshold, the effect sizes before and after the threshold, and whether the effect sizes of the two segments are significant.\u003c/p\u003e","manuscriptTitle":"thresholdanalysis: An R Package for Detecting and Visualizing Threshold Effects in Logistic Regression, Linear Regression, and Cox Proportional Hazards Models","msid":"","msnumber":"","nonDraftVersions":[{"code":1,"date":"2026-02-24 18:45:12","doi":"10.21203/rs.3.rs-8841918/v1","editorialEvents":[{"type":"communityComments","content":0},{"type":"editorInvitedReview","content":"","date":"2026-05-14T08:29:47+00:00","index":"hide","fulltext":""},{"type":"reviewerAgreed","content":"294810253764086816848555255245494478546","date":"2026-05-13T16:37:47+00:00","index":"hide","fulltext":""},{"type":"reviewerAgreed","content":"69169243889539682944006904137507252532","date":"2026-05-05T16:13:46+00:00","index":"hide","fulltext":""},{"type":"reviewersInvited","content":"","date":"2026-02-19T11:57:50+00:00","index":"","fulltext":""},{"type":"editorAssigned","content":"","date":"2026-02-19T11:54:06+00:00","index":"","fulltext":""},{"type":"editorInvited","content":"","date":"2026-02-17T12:57:36+00:00","index":"","fulltext":""},{"type":"checksComplete","content":"","date":"2026-02-16T10:40:46+00:00","index":"","fulltext":""},{"type":"submitted","content":"Scientific Reports","date":"2026-02-16T10:36:39+00:00","index":"","fulltext":""}],"status":"published","journal":{"display":true,"email":"
[email protected]","identity":"scientific-reports","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":false,"externalIdentity":"scirep","sideBox":"Learn more about [Scientific Reports](http://www.nature.com/srep/)","snPcode":"","submissionUrl":"","title":"Scientific Reports","twitterHandle":"","acdcEnabled":true,"dfaEnabled":true,"editorialSystem":"stoa","reportingPortfolio":"Scientific Reports","inReviewEnabled":true,"inReviewRevisionsEnabled":true}}],"origin":"","ownerIdentity":"62f56d7a-481e-44ed-8c21-8bfe9071ea3e","owner":[],"postedDate":"February 24th, 2026","published":true,"recentEditorialEvents":[{"type":"editorInvitedReview","content":"","date":"2026-05-14T08:29:47+00:00","index":56,"fulltext":""},{"type":"reviewerAgreed","content":"294810253764086816848555255245494478546","date":"2026-05-13T16:37:47+00:00","index":55,"fulltext":""},{"type":"reviewerAgreed","content":"69169243889539682944006904137507252532","date":"2026-05-05T16:13:46+00:00","index":48,"fulltext":""}],"rejectedJournal":[],"revision":"","amendment":"","status":"under-review","subjectAreas":[{"id":63331133,"name":"Physical sciences/Engineering"},{"id":63331134,"name":"Physical sciences/Mathematics and computing"}],"tags":[],"updatedAt":"2026-02-24T18:45:12+00:00","versionOfRecord":[],"versionCreatedAt":"2026-02-24 18:45:12","video":"","vorDoi":"","vorDoiUrl":"","workflowStages":[]},"version":"v1","identity":"rs-8841918","journalConfig":"researchsquare"},"__N_SSP":true},"page":"/article/[identity]/[[...version]]","query":{"redirect":"/article/rs-8841918","identity":"rs-8841918","version":["v1"]},"buildId":"XKTyCvWXoU3ODBz1xrDgd","isFallback":false,"isExperimentalCompile":false,"dynamicIds":[84888],"gssp":true,"scriptLoader":[]}
Text is read by the "Ask this paper" AI Q&A widget below.
Extraction quality varies by source — PMC NXML preserves structure
cleanly, OA-HTML may include some navigation residue, and OA-PDF can
have broken hyphenation. The publisher copy
(via DOI)
is the canonical version.