S3-SA3-0390
What is the Coefficient of Determination (R-squared)?
Grade Level:
Class 9
AI/ML, Data Science, Physics, Economics, Cryptography, Computer Science, Engineering
Definition
What is it?
The Coefficient of Determination, also known as R-squared, tells us how well our predictions match the actual data. It's a number between 0 and 1 (or 0% and 100%) that shows the proportion of variation in the dependent variable that can be predicted from the independent variable(s). Simply put, a higher R-squared means our model is better at explaining what's happening.
Simple Example
Quick Example
Imagine you're trying to predict how many runs a cricket team will score based on how many boundaries (fours and sixes) they hit. If your R-squared is 0.80, it means 80% of the variation in runs scored can be explained by the number of boundaries. The remaining 20% is due to other factors like singles, dot balls, or dropped catches.
Worked Example
Step-by-Step
Let's say we're trying to predict a student's final exam marks based on their study hours. We have some actual marks and our model's predicted marks.
Actual Marks (Y): 60, 70, 80, 90
Predicted Marks (Y_pred): 65, 72, 78, 88
Average Actual Marks (Y_mean): (60+70+80+90)/4 = 75
Step 1: Calculate the Total Sum of Squares (SST). This measures the total variation in actual marks from their average.
SST = (60-75)^2 + (70-75)^2 + (80-75)^2 + (90-75)^2
SST = (-15)^2 + (-5)^2 + (5)^2 + (15)^2
SST = 225 + 25 + 25 + 225 = 500
---Step 2: Calculate the Residual Sum of Squares (SSR). This measures the variation in actual marks that our model FAILED to explain (the errors).
SSR = (60-65)^2 + (70-72)^2 + (80-78)^2 + (90-88)^2
SSR = (-5)^2 + (-2)^2 + (2)^2 + (2)^2
SSR = 25 + 4 + 4 + 4 = 37
---Step 3: Calculate R-squared using the formula: R-squared = 1 - (SSR / SST)
R-squared = 1 - (37 / 500)
R-squared = 1 - 0.074
R-squared = 0.926
---Step 4: Convert to percentage if needed.
R-squared = 92.6%
Answer: The R-squared is 0.926, meaning 92.6% of the variation in final exam marks can be explained by study hours according to our model.
Why It Matters
R-squared is crucial in AI/ML and Data Science because it helps us check how good our prediction models are. Engineers use it to design better systems, and economists use it to understand market trends. Learning this helps you build strong foundations for careers in AI, data analysis, and scientific research, helping you solve real-world problems like predicting stock prices or disease spread.
Common Mistakes
MISTAKE: Thinking a high R-squared always means the model is perfect or the cause-effect relationship is proven. | CORRECTION: A high R-squared only shows how much variation is explained, not necessarily that the model is correct or that one variable directly causes another. Other factors could be at play, and the model might be 'overfitting' (too good for the specific data, but bad for new data).
MISTAKE: Believing a low R-squared means the model is useless. | CORRECTION: A low R-squared simply means the independent variables explain less of the variation. In some fields, even a low R-squared (e.g., 0.10 or 10%) can be valuable if the phenomenon is very complex and influenced by many factors, like human behavior or financial markets.
MISTAKE: Confusing R-squared with correlation coefficient (R). | CORRECTION: R-squared is the square of the correlation coefficient (R) for simple linear regression. R measures the strength and direction of a linear relationship between two variables, while R-squared measures the proportion of variance explained by the model.
Practice Questions
Try It Yourself
QUESTION: If a model predicts daily mobile data usage based on the number of apps installed, and its R-squared is 0.65, what percentage of data usage variation is explained by the number of apps? | ANSWER: 65%
QUESTION: A model predicting auto-rickshaw fare based on distance travelled has an SSR (Residual Sum of Squares) of 50 and an SST (Total Sum of Squares) of 200. Calculate its R-squared. | ANSWER: R-squared = 1 - (50/200) = 1 - 0.25 = 0.75
QUESTION: For a model predicting the price of a cup of chai based on the amount of ginger used, the SST is 120. If the model explains 75% of the variation in chai price, what is the SSR (Residual Sum of Squares)? | ANSWER: R-squared = 0.75. So, 0.75 = 1 - (SSR / 120). This means SSR / 120 = 1 - 0.75 = 0.25. Therefore, SSR = 0.25 * 120 = 30.
MCQ
Quick Quiz
What does an R-squared value of 0.95 mean?
The model is 95% accurate in its predictions.
95% of the variation in the dependent variable is explained by the independent variable(s).
There is a 95% chance that the predictions are correct.
The model has a 95% error rate.
The Correct Answer Is:
B
R-squared specifically tells us the proportion of the variance in the dependent variable that is predictable from the independent variable(s). It does not directly mean accuracy, probability of correctness, or error rate.
Real World Connection
In the Real World
In India, companies like Zomato or Swiggy use prediction models to estimate food delivery times. The R-squared value helps them understand how well factors like traffic, restaurant preparation time, and distance explain the actual delivery time. A high R-squared means their estimates are generally reliable, improving customer experience.
Key Vocabulary
Key Terms
R-squared: Another name for Coefficient of Determination | Dependent Variable: The variable we are trying to predict or explain | Independent Variable: The variable(s) used to make predictions | Sum of Squares: A measure of total variation in data | Prediction Model: A mathematical tool used to forecast outcomes
What's Next
What to Learn Next
Great job understanding R-squared! Next, you should explore 'Linear Regression'. This concept is often used to build the prediction models whose performance is then measured by R-squared. It will show you how these predictions are actually made, building on what you've learned here.


