What the Coefficient of information Tells You

The coefficient of information, written as R², is a number between 0 and 1 that tells you how well a line or curve fits your data. It answers the question: "What percentage of the variation in my data does my model explain?" If R² is 0.85, your model explains 85% of the variation. If R² is 0.30, it explains only 30%—meaning other factors you haven't measured are driving most of the change.

R² is useful because it gives you a single number to compare different models or to decide whether a model is worth using at all. A high R² doesn't mean your model is correct or that you should trust its predictions—it only means the line fits the points you have. A low R² means the line misses a lot, so predictions from it will be unreliable.

Key Takeaways

  • R² measures how much of the variation in your data a model explains, ranging from 0 (explains nothing) to 1 (explains everything).
  • You calculate R² by finding the sum of squared residuals (actual minus predicted), dividing by the total sum of squares, and subtracting from 1.
  • The formula is R² = 1 − (SS_res / SS_tot), where SS_res is the sum of squared errors and SS_tot is the total variation around the mean.
  • Most spreadsheet software and statistics programs calculate R² automatically, so you rarely compute it by hand unless you are learning the concept.
  • A high R² means the line fits well; a low R² means the line misses a lot and predictions will be unreliable.

The Formula and What Each Part Means

The formula for R² is:

R² = 1 − (SS_res / SS_tot)

Here is what each piece means. SS_res (sum of squared residuals) is the sum of all the squared differences between what your model predicted and what actually happened. A residual is the gap between a real data point and the line. If your model predicted 50 but the actual value was 48, the residual is −2, and you square it to get 4. You add up all those squared gaps.

SS_tot (total sum of squares) is the sum of all the squared differences between each actual data point and the average of all your data. This represents the total variation in your data before you fit any model to it. If your data points are 10, 20, 30, and the average is 20, then SS_tot includes (10−20)² + (20−20)² + (30−20)² = 100 + 0 + 100 = 200.

The ratio SS_res / SS_tot tells you what fraction of the total variation is left unexplained by your model. Subtracting that from 1 gives you the fraction that is explained. If SS_res is 20 and SS_tot is 100, then R² = 1 − (20/100) = 0.80, meaning your model explains 80% of the variation.

Step-by-Step Calculation by Hand

If you have a small dataset and want to calculate R² yourself, follow these steps. First, fit a line (or curve) to your data using the method your assignment or project specifies—usually least squares regression. Write down the equation of that line.

Second, for each data point, use the line's equation to predict the y-value. Subtract the predicted value from the actual value to get the residual. Square each residual and add them all up. This is SS_res.

Third, find the average (mean) of all your actual y-values. For each data point, subtract this mean from the actual y-value, square the result, and add them all up. This is SS_tot.

Fourth, divide SS_res by SS_tot. Subtract the result from 1. The answer is R².

Example: Suppose you have three data points: (1, 2), (2, 4), (3, 5). Your fitted line is y = 1.5x + 0.5. The mean of y-values is (2 + 4 + 5) / 3 = 3.67. For the first point, predicted y is 1.5(1) + 0.5 = 2, actual is 2, residual is 0, squared is 0. For the second, predicted is 3.5, actual is 4, residual is 0.5, squared is 0.25. For the third, predicted is 5, actual is 5, residual is 0, squared is 0. So SS_res = 0 + 0.25 + 0 = 0.25. For SS_tot: (2 − 3.67)² + (4 − 3.67)² + (5 − 3.67)² = 2.79 + 0.11 + 1.79 = 4.69. Then R² = 1 − (0.25 / 4.69) = 1 − 0.053 = 0.947.

Using Spreadsheet Software to Calculate R²

In Microsoft Excel, the function is RSQ. Type =RSQ(known_y's, known_x's) where known_y's is the range of your actual y-values and known_x's is the range of your x-values. Excel will return R² directly. You do not need to calculate SS_res or SS_tot yourself.

In Google Sheets, the function is also RSQ, with the same syntax. In LibreOffice Calc, it is RSQ as well. If you have already plotted your data and added a trendline, most spreadsheet programs will display R² on the chart itself if you check the "Display R-squared value" option in the trendline settings.

In Python, the scikit-learn library includes a function called r2_score in the metrics module. You pass it your actual y-values and your predicted y-values, and it returns R². In R (the statistics language), the function is summary() applied to a linear model object, which displays R² among other statistics.

What Different R² Values Mean in Practice

An R² of 0.90 or higher usually means your model fits the data very well and predictions from it are likely to be reliable. An R² between 0.70 and 0.90 is often considered good—the model explains most of the variation, though some scatter remains. An R² between 0.50 and 0.70 means the model captures a moderate amount of the pattern, but predictions will have noticeable error.

An R² below 0.50 usually signals that the model is not capturing the relationship well. This can happen if the relationship is not linear (the points follow a curve, not a straight line), if there are outliers pulling the fit off, or if the data is straightforward noisy and driven by many unmeasured factors. In such cases, you might try a different model, collect more data, or accept that prediction is not reliable.

Keep in mind that what counts as "good" R² depends on your field and purpose. In physics, R² of 0.95 might be expected. In social science or business, R² of 0.60 might be acceptable because human behavior is harder to predict. Always ask: does this R² make sense for what I am trying to do?

Common Mistakes When Interpreting R²

One common mistake is assuming that a high R² means your model is correct or that the relationship is causal. R² only measures fit—how well the line passes through the points. It says nothing about whether you chose the right variables, whether you measured them correctly, or whether one thing actually causes another. Two completely unrelated variables can have a high R² by pure chance, especially with small datasets.

Another mistake is comparing R² values across datasets with different scales or units. R² is unitless and depends on the spread of your data, so an R² of 0.80 on one dataset is not automatically "better" than an R² of 0.75 on another. Compare R² only when you are testing different models on the same data.

A third mistake is adding more variables to a model just to raise R². In multiple regression (fitting a model with many input variables), R² almost always increases when you add another variable, even if that variable is random noise. This is called overfitting. To avoid it, use adjusted R² instead, which penalizes you for adding variables that do not improve the fit enough to justify the added complexity.

R² Versus Adjusted R² and Correlation

Adjusted R² is a modified version that accounts for the number of variables in your model. It increases only if a new variable improves the fit enough to offset the penalty for adding complexity. If you are comparing models with different numbers of variables, adjusted R² is more honest than R².

Correlation (often written as r) is different from R². Correlation measures the strength and direction of a linear relationship between two variables, ranging from −1 to +1. R² is the square of the correlation coefficient when you have only one input variable. If correlation is 0.80, then R² is 0.64. With multiple input variables, R² is not straightforward the square of anything—it is calculated differently.

In practice, if someone gives you a correlation and asks you to find R², square the correlation. If someone gives you R² and asks for correlation, take the square root (and remember the sign: positive correlation gives positive r, negative gives negative r).

Frequently Asked Questions

Can R² be negative?

In theory, no—R² ranges from 0 to 1. In practice, some software will report a negative R² if your model fits worse than a horizontal line at the mean. This signals that your model is worse than useless; you would be better off just predicting the average every time. If you see negative R², your model is wrong for this data.

What is the difference between R² and R?

R is the correlation coefficient (between −1 and +1); R² is the coefficient of information (between 0 and 1). R² is literally R squared. With one input variable, if R = 0.80, then R² = 0.64. With multiple input variables, R² is calculated directly and is not the square of anything called R.

Does a high R² mean my predictions will be accurate?

Not necessarily. A high R² means your model fits the historical data well, but if the future is different from the past, predictions will fail. R² also does not account for measurement error, missing variables, or changes in the underlying system. Always test your model on new data before trusting its predictions.

Should I always aim for the highest possible R²?

No. Adding more variables or using a more complex model will raise R², but it may also lead to overfitting—fitting the noise in your data rather than the true pattern. A simpler model with slightly lower R² often predicts better on new data. Use adjusted R² or cross-validation to find the right balance.

How do I report R² in a paper or project?

Write it as "R² = 0.85" or "R-squared = 0.85". Some fields prefer "R² = 0.85 (p < 0.05)" to show that the fit is statistically significant. Always include the number of data points and the type of model (linear, polynomial, etc.) so readers know what you measured.