Abstract
Background
It is long known within the mathematical literature that the coefficient of determination R^{2 }is an inadequate measure for the goodness of fit in nonlinear models. Nevertheless, it is still frequently used within pharmacological and biochemical literature for the analysis and interpretation of nonlinear fitting to data.
Results
The intensive simulation approach undermines previous observations and emphasizes the extremely low performance of R^{2 }as a basis for model validity and performance when applied to pharmacological/biochemical nonlinear data. In fact, with the 'true' model having up to 500 times more strength of evidence based on Akaike weights, this was only reflected in the third to fifth decimal place of R^{2}. In addition, even the biascorrected R^{2}_{adj }exhibited an extreme bias to higher parametrized models. The biascorrected AICc and also BIC performed significantly better in this respect.
Conclusion
Researchers and reviewers should be aware that R^{2 }is inappropriate when used for demonstrating the performance or validity of a certain nonlinear model. It should ideally be removed from scientific literature dealing with nonlinear model fitting or at least be supplemented with other methods such as AIC or BIC or used in context to other models in question.
Background
Fitting nonlinear models to data is frequently applied within all fields of pharmaceutical and biochemical assay quantification. A plethora of nonlinear models exist, and chosing the right model for the data at hand is a mixture of experience, knowledge about the underlying process and statistical interpretation of the fitting outcome. While the former are of somewhat individual nature, there is a need in quantifying the validity of a fit by some measure which discriminates a 'good' from a 'bad' fit. The most common measure is the coefficient of determination R^{2 }used in linear regression when conducting calibration experiments for samples to be quantified [1]. In the linear context, this measure is very intuitive as values between 0 and 1 give a quick interpretation of how much of the variance in the data is explained by the fit. Although it is known now for some time that R^{2 }is an inadequate measure for nonlinear regression, many scientists and also reviewers insist on it being supplied in papers dealing with nonlinear data analysis. Several initial and older descriptions for R^{2 }being of no avail in nonlinear fitting had pointed out this issue but have probably fallen into oblivion [28]. This observation might be due to differences in the mathematical background of trained statisticians and biochemists/pharmacologists who often apply statistical methods but lack detailed statistical insight.
We made the observation that R^{2 }is still frequently being used in the context of performance or validity of a certain model when fit to nonlinear data. R^{2 }is not an optimal choice in a nonlinear regime as the the total sumofsquares (TSS) is not equal to the regression sumofsquares (REGSS) plus the residual sumofsquares (RSS), as is the case in linear regression, and hence it lacks the above interpretation (see Additional File 1, paragraphs 1 & 2). To our observation, there is still a high occurrence in the present literature of all biomedical fields where the validity of nonlinear models is based solely on R^{2 }values, which might be a result of authors or reviewers not being aware of this fallacy. Additionally, almost all of the commercially available statistical software packages (i.e. Prism, Origin, Matlab, SPSS, SAS) calculate R^{2 }values for nonlinear fits, which is bound to unintentionally corroborate its frequent use. A further example is the TableCurve2 D software (Systat, USA) which can fit hundreds of nonlinear models to a given dataset automatically and then rank these by means of R^{2}. Noted 25 years ago by Kvalseth [8], the user is usually not able to identify which of the eight different definitions of R^{2 }that are commonly being used in the literature is chosen for the analysis output in statistical software (see Additional File 1, Remark 4).
Additional File 1. Mathematical derivation and concise discussion of features and pitfalls in the use of R^{2 }in nonlinear regression and description of the simulation setup.
Format: PDF Size: 53KB Download file
This file can be viewed with: Adobe Acrobat Reader
We thus aimed to point out the low performance of R^{2 }and its inappropriateness for nonlinear data analysis by basing our analysis on an extensive Monte Carlo simulation approach. This approach has fundamental advantages in the analysis of nonlinear data analysis [9] and can reveal tendencies within statistical methods by supplying the models and measures in question with thousands of generated datasets.
Methods
Creation of the 'true' model
In a first step, we fitted a threeparameter loglogistic model (L3, see Formula 3 below) by nonlinear leastsquares to sigmoidal data that was taken from quantitative realtime polymerase chain reaction (qPCR). This yielded a sigmoidal model with the parameters b = 9.90, d = 11.07 and e = 24.75. We used the fitted values of this model and xvalues from 1035 as the 'true' model with sample size n = 26 for the following Monte Carlo simulation. This essentially gave a sigmoidal curve that can be encountered in many different areas of pharmacological/biochemical analysis. Specific to qPCR data, the xvalues ("Cycles") are equidistant and not on a logscale, as often encountered in doseresponse analysis. For mathematical details, see Remark 7 in Additional File 1.
Perturbation of data (Monte Carlo Simulation)
Using the fitted values as above, all datapoints were perturbed 2000 times by adding six different magnitudes (very low to high) of homoscedastic noise from a gaussian distribution with mean = 0 and standard deviations = 0.01, 0.02, 0.05, 0.1, 0.2 or 0.4. The noise of the data was therefore between 0.1% and 4% of the data range. This way, for each of six different settings (determined by different standard deviations), we obtained 2000 new data sets of sample size n = 26 with true model L3. For each of these data sets, nine different sigmoidal models differing in model type and number of parameters (Formulas 19) were fit. For mathematical details, see Remark 7 in Additional File 1.
Formula 1: Five parameter loglogistic model (L5):
Formula 2: Fourparameter loglogistic model (L4):
Formula 3: Threeparameter loglogistic model (L3):
Formula 4: Five parameter logistic model (B5):
Formula 5: Fourparameter logistic model (B4):
Formula 6: Threeparameter logistic model (B3):
Formula 7: Fourparameter Weibull model (W4):
Formula 8: Threeparameter Weibull model (W3):
Formula 9: Fiveparameter baroreflex model (baro5):
Calculation of measures for goodnessoffit
For each simulation, we calculated the following measures for goodnessoffit:
R^{2}, using the most general definition [5,8]:
Formula 10:
with RSS = residual sumofsquares, TSS = total sumofsquares, y = response values, = fitted values and = the mean of response values. For a more detailed description see Remarks 16 in Additional File 1.
We chose to use the adjusted R^{2 }to compensate for possible bias due to different number of parameters:
Formula 11:
with n = sample size and p = number of parameters.
The Akaike Information Criterion (AIC, [1012]), a measure that is widely accepted for measuring the validity within a cohort of nonlinear models and frequently used for model selection [13].
Formula 12:
with p = number of parameters and ln(L) = maximum loglikelihood of the estimated model. The latter, in the case of a nonlinear fit with normally distributed errors [13], is calculated by
Formula 13:
with x_{1}, ..., x_{n }= the residuals from the nonlinear leastsquares fit and N = their number.
To provide a fair playing ground, we employed an AIC variant that corrects for small sample sizes, the biascorrected AIC (AICc):
Formula 14:
with n = sample size and p = number of parameters.
In order to obtain values for the validity of a fit, we used Akaike weights which calculate the weight of evidence for each model within a cohort of models in question [1214]:
Formula 15:
with i, k = model numbers, Δ_{i}(AIC) = the difference in AIC of each model in comparison to the model with the lowest AIC, subsequently normalized to their sum (denominator).
Also here, we used the biascorrected AICc for calculating the Akaike weights.
We also chose to employ the Bayesian Information Criterion (BIC), which gives a higher penalty on the number of parameters [15]:
Formula 16:
with p = number of parameters, n = sample size and L = maximum likelihood of the estimated model.
Furthermore, the residual variance as the part of the variance that cannot be accounted for by the model:
Formula 17:
with RSS = residual sumofsquares, n = sample size and p = number of parameters.
The variance of a leastsquares fit is also characterized by the chisquare statistic defined as Formula 18:
where y_{i }= response values, f(x_{i}) = the fitted values and = the uncertainty in the individual measurements y_{i}. We further define the reduced chisquare as a useful measure [16] by
Formula 19:
with ν = n  p (degrees of freedom). If the fitting function is a good approximation to the parent function, then the variances of both should agree well, and the reduced chisquare should be approximately unity. If the reduced chisquare is much larger than 1 (i.e. 10 or 100), it means that one is either overly optimistic about the measurement errors or that one selected an inappropriate fitting function. If reduced chisquare is too small (i.e. 0.1 or 0.01) it may mean that one has been too pessimistic about measurement errors. For this work, models were selected based on reduced chisquare by being closest to 1.
Analysis of the simulation data
Two different approaches were pursued within the Monte Carlo simulated data. To reveal general tendencies, we averaged the values of R^{2}_{adj}, AICc, BIC, residual variance and reduced chisquare from all 2000 simulated data sets (for each noise magnitude and each of the 9 models). To permit a more detailed insight for each simulation and to compare the measures on the single model level, we selected the best model in each iteration based on the highest R^{2}_{adj}, lowest AICc, lowest BIC, lowest residual variance and smallest difference to unity for reduced chisquare. For the latter, we used as the measurement uncertainty the a priori known squared standard deviation from the homoscedastic noise that was applied to produce the random data of the Monte Carlo simulations.
Finally, we calculated the percentage of selecting the 'true' model L3 in all iterations.
Code for the simulations
All simulations were conducted using R, a well reputed and opensource statistical programming language [17]. Nonlinear curve fitting was done by using functionality from the R package qpcR [18]. The commented code for the simulations can be obtained from Additional File 2.
Additional File 2. R code used for conducting the simulations. 'pcrsim' of package 'qpcR' is the workhorse function that creates simulated data starting from the fitted value, adding a desired noise structure and testing different sigmoidal models on the perturbed data. 'code' collects the results and summarizes the data as shown in this manuscript. R script file for the R statistical environment.
Format: ZIP Size: 1KB Download file
Results and Discussion
Figure 1 illustrates the simulated data that was used as the basis of our analysis. Starting from the fitted values of a threeparameter loglogistic model (L3), different amounts of homoscedastic gaussian noise were added to the fitted values resulting in the point clouds as shown. We analyzed six different magnitudes of gaussian noise in total, from low noise (s.d. = 0.01, 0.02), medium noise (s.d. = 0.05, 0.1) to high noise (s.d. = 0.2, 0.4; see Figure 1) with a total of 2000 simulations per noise setup.
Figure 1. Graph illustrating the noise model used for the simulations. 2000 simulations of random gaussian noise with mean = 0 and s.d. = 0.4 were added to the fitted values of a threeparameter loglogistic model (L3) fit to realtime quantitative PCR data. This resulted in the point cloud (black dots) of response values and the band of red lines reflecting the fitted curves of all simulations with the same model L3 applied.
Fitting all nine different sigmoidal models to the fitted values of the 'true' model (L3) is depicted in Figure 2A, demonstrating the differences against this model when noise is completely lacking. All logistic models fit well in this context, which tallies with the observation of fiveparameter models exhibiting increased performance due to accomodating asymmetrical structures [19]. Visualized also by a residuals plot that delivers higher resolution of the residuals (Figure 2B), the loglogistic models (L3, L4, L5) provide very small residual values, the logistic models (B3, B4, B5) have higher residual values and the Weibull models (W3, W4) are significantly inferior. This is evident especially in the upper and lower region from the point of inflection.
Figure 2. Performance of the nine different sigmoidal models on the fitted values from a threeparameter loglogistic model. (A) The nine different sigmoidal models were fit by nonlinear leastsquares to the fitted data from the L3 model. (B) Residual plot depicting the performance of each of the nine models in respect to fitting to the data from the L3 model. As expected, model L3 (light green, reference curve) has zero residual value as having been fit to the data obtained from the same model. Several other models also fit the data exceptionally well (L5, L4, baro5) and are not visible due to being overlayed by the L3 curve. Descriptions for the abbreviated models can be found under Formulas 19.
AICc and adjusted R^{2}_{adj }were compared by averaging the output of all 2000 simulations and for three different magnitudes (low, middle, high) of homoscedastic gaussian noise (Figure 3). Not surprisingly, the R^{2}_{adj }values decrease and the AICc values increase with higher noise (left to right). But the major problem in the use of R^{2 }is clearly evident within the simulation setup: the AIC differences (deltaAIC) between some models can be 78 (compare L3 and B3 models at s.d. = 0.02), which when transferred to Akaike weights result in a weight of evidence 16 (!) orders of magnitude in favor of L3. One might be inclined to say that this is major evidence for the first model being in favor of the second one, but in respect to the corresponding R^{2}_{adj }values, only the fourth decimal place is affected. This tendency is also found for higher noise, despite AICc values increasing and R^{2}_{adj }values decreasing. Even in the presence of relatively high noise (s.d. = 0.4), at least for the simulation setup in this work, R^{2}_{adj }would hardly drop below 0.99. Comparing the Akaike weight of the models with the R^{2}_{adj }values in Table 1 shows the strong discrepancy in scale changes of these two measures when comparing a cohort of different models.
Table 1. Summary of the MonteCarlo simulation study.
Figure 3. Analysis of adjusted R^{2 }and corrected AIC of nine different sigmoidal models on fitted data from a threeparameter loglogistic model (L3). Three different magnitudes of homoscedastic gaussian noise (low: 0.02; medium: 0.1; high: 0.4) were added to the fitted data (2000 simulations), each of the nine sigmoidal model fit by nonlinear leastsquares and the two measures collected for each simulation. Finally, the measures were averaged and displayed as point graphs. Upper panel: AICc, lower panel: R^{2}_{adj}. Descriptions for the abbreviated models can be found under Formulas 19. Coefficients of variation for all simulations were below 5% and hence omitted. More detailed data for the measures can be found in Table 1.
However, differences in scale changes would be unimportant if the direction of change is always reciprocally (i.e. a lower AICc always corresponding with a higher R^{2}_{adj}). As can be deduced from Table 1, this is not always the case. Using the averaged measures from the simulations, R^{2}_{adj }and AICc did not always behave reciprocally. For instance, at s.d. = 0.05, 0.2 and 0.4 the 'true' model L3 has a lower AICc than L5 (and ~ 8 times more weight of evidence by Akaike weights), but R^{2}_{adj }values are also lower in the fifth to eighth decimal place. Using R^{2}_{adj }for model selection would therefore have resulted in a model which is clearly not in favor based on Akaike weights.
On the averaged values, BIC essentially shows the same characteristics as AICc. Interestingly, the residual variance is higher in the 'true' model L3 than L5 for most noise regimes (although also only in the third to eighth decimal place), indicating this to be a relatively unfavorable measure. Likewise, the reduced chisquare exhibited a tendency to be closest to unity for higher parameter models (L4, L5, B5) with increasing noise, here also only affected in the third decimal place.
To acquire more detailed insight into the performance of the different measures in respect to the selection of the best model and in dependence of different noise magnitudes, we selected the best model of each iteration by each of the measures. This approach can reveal features that are not evident when calculating the averaged measures of all simulations. We summarized the outcome of this analysis as a heatmap display in Figure 4 and as 'model selection frequency' in Table 2. Within each image plot, the selected models are shown with the same colour coding as in Figures 1, 2 and 3. For the low (s.d. = 0.02) and medium (s.d. = 0.1) setup, R^{2}_{adj}, residual variance (resVar) and reduced chisquare performed not optimally, selecting the true model L3 only in 2843% of the iterations. Both measures exhibited a severe bias in the selection of models with a higher number of parameters (L4, L5, B5, baro5). It is interesting to note that although R^{2}_{adj }and the residual variance 'correct' against the number of parameters, there is no positive effect on the ability to select the 'true' model. This may be due largely to the setup in this work which features a relatively high sample size (n = 26) compared to the number of parameters (p = 35) and leaves the denominator n  p in both measures relatively unaffected. In contrast, both AICc and BIC performed superior in the selection of the 'true' model L3 at these magnitudes of noise with over 80% of all iterations, but with a slight bias to models with a lower number of parameters at medium noise. At high noise (s.d. = 0.4, corresponding to 4% noise of the data range) the performance of all measures decreased markedly, most probably from the effect of the simulated data losing the structural features typical of the L3 model when high noise is added. Despite this negative trend, AICc and BIC displayed increased performance even at high noise. The two measures selected also a significant number of iterations (about 40%) of other models with the same number of parameters (B3, W3), which might be an indication for a small bias to lower parametrized models. Consequently, and based on the analysis of a sigmoidal nonlinear setup as described here, we feel compelled to give the following summary:
Table 2. Model selection frequency for the different measures of goodnessoffit.
Figure 4. Analysis of model selection bias between for different measures of goodnessoffit. Three different magnitudes of homoscedastic gaussian noise (0.02%; 0.1%; 0.4%) were added to the fitted data of model L3. The nine different sigmoidal models were fit and the different measures for goodnessoffit collected at each iteration. The best model was selected for each measure and displayed for all iterations as a coloured selection heatmap. Light green reflects the 'true' model L3.
1) The use of highly inferior nonlinear models is reflected only in the third or fourth decimal place of R^{2 }and thus the description of single models when using R^{2 }is not meaningful, as this measure tends to be uniformly high when a set of models is inspected. This has also been noted by others [20]. Additionally, R^{2 }and even its 'biascorrected' counterpart R^{2}_{adj }are severely biased in favor of models with more parameters when it comes to model selection. The same accounts for the residual variance, which is also commonly used. AICc and BIC do not exhibit this bias and provide a much clearer picture and improved performance when it comes to selecting the 'true' model. The Akaike weights are especially useful in obtaining an overview of the weight of evidence of one model over the other, which is impossible with the per se high R^{2 }values. This approach requires anyhow that it is mandatory to supply several models in question.
2) In a background of low and medium experimental noise, R^{2}_{adj }and AICc selected different models with AICc selecting the 'true model' twice as often (82.2% versus 43%). This finding emphasizes the importance of this measure in nonlinear model selection. At a high noise level rarely encountered in the modelling of pharmacological/biochemical data (4% of data range), AICc still performed superior to R^{2}_{adj}. These results tempt us to conclude that the degree of freedom term n  p in the denominator of the residual variance and R^{2}_{adj }is not sufficient alone to compensate the effect of the number of increasing parameters. The same seems to be the case for the reduced chisquare, which is also frequently used for model selection purposes.
In this work we show that R^{2 }is an inappropriate measure when used in the field of nonlinear fitting. Efforts have been made to develop R^{2}like measures for the most common nonlinear regression models [21], but here we focused on the inadequateness of its use by using a data perturbation approach and comparing its performance in comparison to AICc, BIC, residual variance and reduced chisquare. Model selection in nonlinear statistical literature is usually divided into the frequentist methods, for example Ftests on the residual variance that are restricted to nested models [13], or measures from information theory such as AIC which are often used to compare nonnested models. Indeed, it has been shown that the latter approach can often perform better than Ftests [22]. In the field of biochemical and pharmacological literature there is a reasonably high occurrence in the use of R^{2 }as the basis of arguing against or in favor of a certain model. As a result from this work, we would like to advocate that R^{2 }should not be reported or demanded in phamacological/biochemical literature when discussing nonlinear data analysis. Authors as well as reviewers should be aware that demonstrating the validity of single nonlinear models by using solely R^{2 }is not stateoftheart and should be replaced or supplemented by AIC/AICc/BIC values (or their corresponding weights of evidence) of several possible models that are in question. The latter will give the dedicated reader the possibility to obtain information about how much a certain model is in favor over others, a feature that will not be evident by minor changes in R^{2 }which tends to be uniformly high and is rarely affected more than in the third or fourth decimal place.
Conclusions
Although frequently being used in the present pharmocological/biochemical literature for describing the validity of a nonlinear fit, R^{2 }is an unfavorable measure that is rarely affected more than in the third or fourth decimal place, even in scenarios with highly inferior models. Our Monte Carlo simulations have shown that AIC, AICc or BIC perform significantly better in this respect so that authors as well as reviewers should be aware of this issue and refrain from using or asking for R^{2 }values when nonlinear models are under investigation.
Competing interests
The authors declare that they have no competing interests.
Authors' contributions
ANS conducted the simulations and wrote the manuscript. NN helped in drafting the manuscript and developed the statistical workflow. All authors read and approved the final manuscript.
Acknowledgements
ANS is supported by grant Sp721/13 of from the German Research Foundation (DFG). We thank Dr. Heike CappalloObermann for fruitful discussions and Dr. Caroline Feig for supplying the quantitative realtime PCR data. Many thanks also to the four reviewers whose comments helped to improve the manuscript substantially.
References

Montgomery DC, Peck EA, Vining GG: Introduction to Linear Regression Analysis. Wiley & Sons, Hoboken; 2006.

Juliano SA, Williams FM: A comparison of methods for estimating the functional response parameters of the random predator equation.
J Anim Ecol 1987, 56:641653. Publisher Full Text

Miaou SP, Lu A, Lum HS: Pitfalls of using rsquared to evaluate goodness of fit of accident prediction models.
Transportation Research Record #1542 1996, 613. Publisher Full Text

Willet JB, Singer JD: Another cautionary note about Rsquare: Its use in weighted leastsquares regression analysis.
Amer Stat 1988, 42:236238. Publisher Full Text

AndersonSprecher R: Model comparisons and Rsquare.
Amer Stat 1994, 48:113117. Publisher Full Text

Nagelkerke NJD: A note on a general definition of the coefficient of determination.
Biometrika 1991, 78:691692. Publisher Full Text

Magee L: R2 measures based on Wald and likelihood ratio joint singnificance tests.
Amer Stat 1990, 44:250253. Publisher Full Text

Kvalseth TO: Cautionary note about R2.
Amer Stat 1985, 39:279285. Publisher Full Text

Bates DM, Watts DG: Nonlinear regression analysis and its applications. 1st edition. New York, John Wiley & Sons; 1988.

Akaike H: Information theory and an extension of the maximum likelihood principle.
Proc 2nd Inter Symposium on Information Theory 1973, 267281.

Akaike H: A new look at the statistical model identification.
IEEE Transaction on Automatic Control 1974, 19:716723. Publisher Full Text

Akaike H: On the likelihood of a time series model.
The Statistician 1978, 27:217235. Publisher Full Text

Burnham KP, Anderson DR: Model selection and inference: a practical informationtheoretic approach. 2nd edition. Springer Verlag, New York, USA; 2003.

Wagenmakers EJ, Farrell S: AIC model selection using Akaike weights.

Schwarz G: Estimating the dimension of a model.
Ann Stat 1978, 6:461464. Publisher Full Text

Bevington PR, Robinson DK: Data Reduction and Error Analysis for the Physical Sciences. Volume Chapter 11. 3rd edition. McGrawHill, New York; 2003.

The R project homepage [http://www.rproject.org] webcite

Ritz C, Spiess AN: qpcR: an R package for sigmoidal model selection in quantitative realtime polymerase chain reaction analysis.
Bioinformatics 2008, 24:15491551. PubMed Abstract  Publisher Full Text

Gottschalk PG, Dunn JR: The fiveparameter logistic: A characterization and comparison with the fourparameter logistic.
Anal Biochem 2005, 343:5465. PubMed Abstract  Publisher Full Text

Zeng QC, Zhang E, Tellinghuisen J: Univariate calibration by reversed regression of heteroscedastic data: a case study.
The Analyst 2008, 133:16491655. PubMed Abstract  Publisher Full Text

Cameron AC, Windmeijer FAG: An Rsquared measure of goodness of fit for some common nonlinear regression models.
J Econometrics 1997, 77:329342. Publisher Full Text

Glatting G, Kletting P, Reske SN, Hohl K, Ring C: Choosing the optimal fit function: comparison of the Akaike Information Criterion and the ftest.
Med Phys 2007, 34:42854292. PubMed Abstract  Publisher Full Text