n values marked y1,...,yn (collectively known as yi or as a vector y = [y1,...,yn]T), each associated with a fitted (or modeled, or predicted) value f1,...,fn (known as fi, or sometimes ŷi, as a vector f). Define the residuals as ei = yi − fi (forming a vector e). If is the mean of the observed data: then the variability of the data set can be measured with two sums of squares formulas: The sum of squares of residuals, also called the residual sum of squares: The total sum of squares (proportional to the variance of the data): The most general definition of the coefficient of determination is In the best case, the modeled values exactly match the observed values, which results in and . A baseline model, which always predicts , will have . Models that have worse predictions than this baseline will have a negative . Relation to unexplained variance In a general form, R2 can be seen to be related to the fraction of variance unexplained (FVU), since the second term compares the unexplained variance (variance of the model's errors) with the total variance (of the data): As explained variance Suppose R2 = 0.49. This implies that 49% of the variability of the dependent variable in the data set has been accounted for, and the remaining 51% of the variability is still unaccounted for. For regression models, the regression sum of squares, also called the explained sum of squares, is defined as In some cases, as in simple linear regression, the total sum of squares equals the sum of the two other sums of squares defined above: See Partitioning in the general OLS model for a derivation of this result for one case where the relation holds. When this relation does hold, the above definition of R2 is equivalent to where n is the number of observations (cases) on the variables. In this form R2 is expressed as the ratio of the explained variance (variance of the model's predictions, which is SSreg / n) to the total variance (sample variance of the dependent variable, which is SStot / n). This partition of the sum of squares holds for instance when the model values ƒi have been obtained by linear regression. A milder sufficient condition reads as follows: The model has the form where the qi are arbitrary values that may or may not depend on i or