top of page
Inaugurated by IN-SPACe
ISRO Registered Space Tutor

S3-SA3-0391

What is Adjusted R-squared?

Grade Level:

Class 9

AI/ML, Data Science, Physics, Economics, Cryptography, Computer Science, Engineering

Definition
What is it?

Adjusted R-squared is a special version of R-squared that helps us understand how well a model fits data, especially when we add more features. Unlike regular R-squared, it penalizes us for adding features that don't actually improve the model much. It tells us how much of the variation in the output can be explained by the input features, after considering the number of features used.

Simple Example
Quick Example

Imagine you're trying to predict your friend's cricket score based on how much they practiced. If you also add how many samosas they ate, and that doesn't really help predict their score better, Adjusted R-squared would show that adding 'samosas' didn't improve your prediction much, or might even make it look worse. Regular R-squared would just go up slightly, even if 'samosas' was useless.

Worked Example
Step-by-Step

Let's calculate Adjusted R-squared.

Given: R-squared = 0.85, Number of features (p) = 3, Number of data points (n) = 10

---Step 1: Understand the formula. Adjusted R-squared = 1 - [(1 - R-squared) * (n - 1) / (n - p - 1)]

---Step 2: Substitute the given values into the formula.
Adjusted R-squared = 1 - [(1 - 0.85) * (10 - 1) / (10 - 3 - 1)]

---Step 3: Calculate the term (1 - R-squared).
1 - 0.85 = 0.15

---Step 4: Calculate the term (n - 1).
10 - 1 = 9

---Step 5: Calculate the term (n - p - 1).
10 - 3 - 1 = 6

---Step 6: Substitute these calculated values back into the formula.
Adjusted R-squared = 1 - [0.15 * 9 / 6]

---Step 7: Perform the multiplication and division.
0.15 * 9 = 1.35
1.35 / 6 = 0.225

---Step 8: Complete the final subtraction.
Adjusted R-squared = 1 - 0.225 = 0.775

Answer: The Adjusted R-squared is 0.775.

Why It Matters

Understanding Adjusted R-squared is key in AI/ML and Data Science to build models that are both accurate and simple. Data scientists use it to choose the best features for predicting things like stock prices or customer behavior. This helps in careers from financial analysis to medical research, making sure models are reliable.

Common Mistakes

MISTAKE: Thinking a higher R-squared always means a better model, even if many extra features were added. | CORRECTION: Always check Adjusted R-squared. If it doesn't increase much (or even decreases) when new features are added, those features might not be useful.

MISTAKE: Confusing Adjusted R-squared with regular R-squared. | CORRECTION: Remember that regular R-squared always increases or stays the same when you add more features, even useless ones. Adjusted R-squared only increases if the new feature genuinely improves the model more than expected by chance.

MISTAKE: Assuming a high Adjusted R-squared means the model is perfect for prediction. | CORRECTION: While a high value is good, Adjusted R-squared only measures how well the model explains past data. It doesn't guarantee future predictions will be accurate or that the model is the absolute best choice.

Practice Questions
Try It Yourself

QUESTION: If R-squared is 0.70, number of features (p) is 2, and number of data points (n) is 8, what is the Adjusted R-squared? | ANSWER: Adjusted R-squared = 1 - [(1 - 0.70) * (8 - 1) / (8 - 2 - 1)] = 1 - [0.30 * 7 / 5] = 1 - [2.1 / 5] = 1 - 0.42 = 0.58

QUESTION: A model has an R-squared of 0.60 with 5 features and 15 data points. If you add a new feature, and the R-squared becomes 0.62, how does the Adjusted R-squared change? Calculate both. | ANSWER: Initial Adjusted R-squared = 1 - [(1 - 0.60) * (15 - 1) / (15 - 5 - 1)] = 1 - [0.40 * 14 / 9] = 1 - 0.622 = 0.378. New Adjusted R-squared = 1 - [(1 - 0.62) * (15 - 1) / (15 - 6 - 1)] = 1 - [0.38 * 14 / 8] = 1 - 0.665 = 0.335. The Adjusted R-squared decreased from 0.378 to 0.335, meaning the new feature was not very helpful.

QUESTION: You are building a model to predict mobile data usage. Your current model has an R-squared of 0.75 using 4 factors (e.g., age, screen time, app usage, time of day) from 20 users. You add a 5th factor (e.g., mobile plan cost) and the R-squared increases to 0.76. Should you include the 5th factor based on Adjusted R-squared? Show calculations. | ANSWER: Initial Adjusted R-squared = 1 - [(1 - 0.75) * (20 - 1) / (20 - 4 - 1)] = 1 - [0.25 * 19 / 15] = 1 - 0.3167 = 0.6833. New Adjusted R-squared = 1 - [(1 - 0.76) * (20 - 1) / (20 - 5 - 1)] = 1 - [0.24 * 19 / 14] = 1 - 0.3257 = 0.6743. Since the Adjusted R-squared decreased (from 0.6833 to 0.6743), you should NOT include the 5th factor.

MCQ
Quick Quiz

Why is Adjusted R-squared generally preferred over regular R-squared when comparing models with different numbers of features?

It is easier to calculate.

It always gives a higher value.

It penalizes models for including too many useless features.

It only works for linear models.

The Correct Answer Is:

C

Adjusted R-squared is preferred because it accounts for the number of features. It penalizes models that add features which don't significantly improve the model's explanatory power, unlike regular R-squared which always increases with more features.

Real World Connection
In the Real World

In Indian e-commerce, companies like Flipkart or Amazon use concepts like Adjusted R-squared to build recommendation systems. They predict what products you might like based on your past purchases, browsing history, and other factors. Adjusted R-squared helps them choose the most important factors without making their prediction model unnecessarily complex, ensuring fast and accurate recommendations for millions of users.

Key Vocabulary
Key Terms

R-squared: A measure of how well a model explains the variation in the dependent variable. | Features (Independent Variables): The input factors used to predict an outcome. | Data Points (n): The total number of observations or samples in your dataset. | Penalize: To reduce a value as a cost for something, in this case, for adding unnecessary features. | Model Fit: How well a statistical model describes the data it was generated from.

What's Next
What to Learn Next

Next, explore 'What is Multicollinearity?'. This concept is closely related because if your features are too similar, it can affect your R-squared and Adjusted R-squared, making your model less reliable. Keep building your data science skills!

bottom of page