ndCurveMaster

Scientific Solutions for Data Analysis and Curve Fitting

Table of Contents

Optimizing Complex Nonlinear Models Using Monte Carlo–Based Heuristic Search Sensitivity Analysis Enhanced Multicollinearity Detection Preventing Overfitting in Multivariable Models Standardized Residuals and Heteroscedasticity Tests Q-Q Plot and Normality Tests Bland-Altman Agreement Analysis Discover Equations from Data

Optimizing Complex Nonlinear Models Using Monte Carlo–Based Heuristic Search

Finding complex multivariable nonlinear models (3D, 4D, 5D, 6D, etc.) and selecting optimal functional forms leads to an extremely large combinatorial search space. An exhaustive (exact) search is computationally infeasible. Therefore, ndCurveMaster employs Monte Carlo–based heuristic optimization, in which randomized sampling and iterative evaluation are used to efficiently explore the solution space.

In this framework, all randomized searching implemented in the software can be interpreted as a Monte Carlo method. Randomized selection and transformation of base functions allow the algorithm to escape local minima and probabilistically identify near-optimal predictor structures with respect to RMSE and additional user-defined quality constraints.

The discovered models are optimized not only for prediction error minimization but also for satisfying multiple statistical and methodological criteria, including:

Within this Monte Carlo framework, ndCurveMaster implements two complementary randomized search strategies:

Due to the stochastic nature of Monte Carlo optimization, repeated runs may yield different—but comparably high-quality—solutions even for the same dataset. Performing multiple independent searches therefore increases the probability of identifying models that are very close to the global optimum, both in terms of predictive accuracy and statistical robustness.

Back to Top

Sensitivity Analysis

Sensitivity analysis is a technique used in data analysis and machine learning to assess the impact of individual input variables on forecast outcomes. It allows for the identification of input variables that are critical to prediction accuracy, as well as those that can be omitted without quality loss, especially when other significance measures, such as t-value, cannot be used. This situation occurs when the distribution of model residuals is not normal, making inference difficult.

The ndCurveMaster program determines the importance of a given variable based on the ratio of the estimation error (RMSE) for the model with the omitted variable (RMSEo) to the estimation error for the model with all input variables (RMSEf), as follows:

SA = (RMSEo/RMSEf - 1) * 100

where:

A higher value of this coefficient indicates a greater impact of the given variable on the prediction outcome. The removed variable causing the largest increase in error achieves the highest RMSER value and can be considered the most significant. Based on SA values, a ranking of variables by importance can be developed, and non-significant variables can be eliminated.

The "SA %" column in the Statistics window displays the results of the sensitivity analysis:

ndCurveMaster Sensitivity

Values of SA that are too low indicate that the predictor is not statistically significant and are highlighted in red.

Back to Top

Enhanced Multicollinearity Detection in ndCurveMaster

ndCurveMaster provides a multicollinearity detection feature to enhance the quality of the models created through the use of:

Variance Inflation Factor (VIF) for Multicollinearity Detection

The VIF index is widely used for detecting multicollinearity (more information can be found on Wikipedia). There's no strict VIF value to determine the presence of multicollinearity. VIF values above 10 are often considered an indication of multicollinearity, but values above 2.5 in weaker models may cause concern. ndCurveMaster calculates the VIF values for each model, which are displayed in the last column of the regression analysis table for each predictor, as shown below:

ndCurveMaster Variance Inflation Factor VIF

In addition, ndCurveMaster offers a search option for models with a VIF limit value. The user can select the "VIF cannot exceed" checkbox to only display models that do not exceed the selected VIF value. The default VIF limit value is 10, as shown below:

ndCurveMaster VIF button

The user can adjust the limit as needed.

Utilizing the Pearson Correlation Matrix in ndCurveMaster

The Pearson Correlation Matrix window displays Pearson Correlation coefficients between each pair of variables, as shown below:

ndCurveMaster Pearson Correlation matrix

Examining the correlations between variables is the simplest way to detect multicollinearity. In general, an absolute correlation coefficient of more than 0.7 between two or more variables indicates the presence of multicollinearity.

Back to Top

Preventing Overfitting in Multivariable Nonlinear Models

Overfitting occurs when a statistical model has too many parameters compared to the sample size used to build it. This is a common problem in machine learning, but it is not usually applicable to regression models. However, ndCurveMaster's advanced algorithms make it possible to build complex multi-variable models, which can also be susceptible to overfitting.

In regression analysis with one independent variable, overfitting can be easily detected by examining the graph:

ndCurveMaster Overfitting Curve

But in regression analysis of many variables it is not possible to detect overfitting in this way. Therefore, ndCurveMaster has implemented an overfitting detection technique using the test set method. The software randomly selects part of the data for the test set:

ndCurveMaster Overfitting Program Option

and uses the remaining data for regression analysis. Overfitting is detected by comparing the root mean square (RMS) errors of the test set and the entire dataset.

The following example shows a multi-variable regression model: Y = a0 + a1*exp(x1) + a2*x2-8 + a3*x35.6 + a4*x4-1 + a5*x59 + a6*x64.1 + a7*exp(x6)3 + a8*x516 + a9*(1/2)x4 + a10*x2-6 + a11*x11.9 + a12*x35.2 + a13*x1-11 + a14*(ln(x3))8 + a15*exp(x5)-1 + a16*x41.9 + a17*x616 + a18*x210 + a19*exp(x3)5 + a20*(ln(x6))2 + a21*x4-4 + a22*exp(x5)2 + a23*x44.2 + a24*x515 + a25*x615 + a26*x312

Standard statistical analysis of the entire dataset may not detect overfitting. However, ndCurveMaster can also check the RMS errors of the test set and the entire dataset. In the example below, the test set RMS error is 9.55 and the dataset RMS error is 0.138. ndCurveMaster detects overfitting because the test set error is 68.775 times the dataset error.

ndCurveMaster Overfitting Detect

The overfitting is clearly demonstrated in the graph below, where blue points represent the entire dataset and yellow points represent the test set:

ndCurveMaster Overfitting Detect Chart

The graph shows that the fit of the entire dataset looks perfect, but the test set points do not fit well.

Back to Top

Standardized Residuals and Heteroscedasticity Tests

In ndCurveMaster, heteroscedasticity can be assessed by examining the distribution of standardized residuals and performing statistical tests. Heteroscedasticity occurs when the variance of regression errors is not constant across predicted values. Detecting it is important because it may affect the reliability of standard errors, significance tests, and confidence intervals.

The following methods are implemented:

To assess heteroscedasticity, select the Standardized Residuals option in the "Graph" menu. The resulting plot and statistical test results are shown below:

ndCurveMaster standardized residuals plot with Koenker and White special heteroscedasticity tests

The horizontal axis represents predicted values, while the vertical axis shows standardized residuals. A random scatter of residuals around zero, without a systematic pattern or noticeable changes in spread, suggests approximately constant error variance (homoscedasticity). A funnel-shaped pattern or increasing or decreasing spread may indicate heteroscedasticity.

Both statistical tests evaluate the null hypothesis of constant error variance (homoscedasticity). Their results are expressed as p-values and compared with the selected significance level (α):

When a separate test set is available, the plot displays residuals for both the dataset and test data using different colors. The Koenker and White special tests are also performed and reported separately for each set.

The significance level (α) is displayed together with the test results. The absence of statistically significant heteroscedasticity does not guarantee constant error variance, particularly for small datasets. Therefore, statistical test results should be interpreted together with the residual plot.

Back to Top

Q-Q Plot and Normality Tests

In ndCurveMaster, it is possible to test the normality of residuals from the discovered equations. This allows for assessing the significance of predictors in the calculated regression equations. The following methods are implemented:

To perform normality tests, select the Q-Q Plot & Normality option in the "Graph" menu, as shown below:

ndCurveMaster Q-Q Plot

If the residuals do not follow a normal distribution, this may affect the validity of statistical results and inferences. In such cases, the significance of individual predictors can be assessed using the sensitivity analysis (SA %) in the "Statistics" window. SA % indicates the percentage increase in the RMSE (Root Mean Square Error) of the entire equation after removing a given variable/predictor from the regression model. The higher the percentage, the more significant the predictor, as shown below:

ndCurveMaster Statistics Regression

The critical values for the Shapiro-Wilk Test are determined as follows:

The approximation equations for the Shapiro-Wilk Test critical values were derived from exact Monte Carlo simulations with 10,000 iterations. These equations were developed using ndCurveMaster and are characterized by 100% accuracy, with the sum of squared residuals across all data points being zero.

Below are the approximation equations created with ndCurveMaster, which are also implemented in the software, for various significance levels (α):

The complete table, containing all exact critical values for the Shapiro-Wilk Test, calculated using the Monte Carlo method and approximations generated with ndCurveMaster for sample sizes (N) ranging from 51 to 5000, can be downloaded in Excel format from the following link: Shapiro_Wilk_Critical_Values_Table_5000.xlsx.

Back to Top

Bland-Altman Agreement Analysis

In ndCurveMaster, the Bland-Altman method is used to assess agreement between observed and predicted values of regression models. The analysis helps identify systematic bias, proportional bias, and the magnitude of differences between model predictions and observations.

The Bland-Altman analysis includes:

To perform the analysis, select the Bland-Altman analysis option in the "Graph" menu, as shown below:

ndCurveMaster Bland-Altman plot showing agreement between observed and predicted values, limits of agreement, and proportional bias tests

The horizontal axis represents the mean of predicted and observed values, while the vertical axis shows their difference (predicted minus observed). The solid horizontal lines indicate the mean differences (bias), and the dashed lines represent the 95% limits of agreement (mean difference ± 1.96 SD).

A mean difference close to zero indicates low average systematic bias, while narrower limits of agreement indicate smaller variability in prediction errors. However, acceptable agreement depends on the intended application and the magnitude of errors considered acceptable.

Proportional bias is assessed by fitting a linear regression equation to the differences as a function of their means. The slope and its statistical significance (p-value) are reported together with the selected significance level (α):

When a separate test set is available, ndCurveMaster displays the dataset and test data using different colors. The mean differences, limits of agreement, regression equations, and proportional bias tests are calculated and reported separately for each set.

The Bland-Altman analysis complements conventional regression performance metrics by providing additional information about prediction bias and agreement across the range of observed values. The absence of significant proportional bias does not necessarily indicate good agreement, particularly when the limits of agreement are wide.

Back to Top

Discover Equations from Data

Equation discovery involves identifying mathematical relationships that best describe the behavior of a dataset. This process is crucial for understanding complex systems and uncovering the underlying laws governing data. By leveraging advanced curve fitting and model optimization techniques, researchers can develop predictive models and gain deeper insights.

ndCurveMaster is a powerful tool designed specifically for such tasks. Unlike traditional software like Excel, which may struggle with local optima, ndCurveMaster employs a randomized search algorithm to explore a broader solution space.

In this tutorial, both Excel and ndCurveMaster were used to discover the following equation:

Y = 3 + 3 · x12.5 + 4 · x23 + (-3.5) · x31/2.

Using only data and curve fitting techniques, ndCurveMaster successfully discovered this equation, while Excel provided a close approximation. The results are presented in the table below.

Software Discovered Equation RMSE Pearson Correlation Coefficient
Excel Y = 0.89 + 3.518 * x12.65 + 1.314 * x22.11 - 0.066 * x3-4.16 4.38 0.99999715
ndCurveMaster Y = 3 + 3 · x12.5 + 4 · x23 + (-3.5) · x31/2 0 1

Read the full tutorial here: Curve Fitting in Excel: A Tutorial on Fitting a Complex Nonlinear Regression Model to Your Data

Back to Top