Linear Regression Overview
- 25Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What is the primary purpose of regression analysis?
25 questions
- 1
What is the primary purpose of regression analysis?
Model answer
Regression analysis helps understand the relationship between a dependent variable and one or more independent variables by creating a predictive model.
Explanation
Regression quantifies how changes in independent variables affect the dependent variable, enabling prediction and inference.
- 2
In regression, what is the difference between a dependent variable and an independent variable?
Model answer
The dependent variable is the outcome being predicted, while independent variables are the predictors used to explain or forecast the dependent variable.
Explanation
For example, predicting GRE score (dependent) from CGPA (independent).
- 3
What distinguishes simple linear regression from multiple linear regression?
Model answer
Simple linear regression has one independent variable, whereas multiple linear regression has two or more independent variables.
Explanation
Simple: y=mx+c; Multiple: y=β0+β1x1+β2x2+…
- 4
Write the general equation for a simple linear regression line and identify the coefficients.
Model answer
y=mx+c where m is the slope and c is the y-intercept.
Explanation
The slope indicates how much y changes per unit change in x; the intercept is the value of y when x=0.
- 5
What is a residual in linear regression?
Model answer
A residual is the difference between the actual observed value and the value predicted by the regression line.
Explanation
Residual = actual y - predicted y. Minimizing the sum of squared residuals is the goal for finding the best fit line.
- 6
How is the best fit line determined in linear regression?
Model answer
The best fit line minimizes the sum of squared residuals (RSS) – the line with the smallest RSS is chosen.
Explanation
This ordinary least squares (OLS) method ensures the line fits the data as closely as possible.
- 7
What does the slope coefficient represent in a simple linear regression model?
Model answer
The slope represents the expected change in the dependent variable for a one‑unit increase in the independent variable.
Explanation
For example, if y=6.8x+261, a 1‑unit increase in CGPA is associated with a 6.8‑point increase in GRE score.
- 8
What is the equation for a multiple linear regression model with three independent variables?
Model answer
y=β0+β1x1+β2x2+β3x3
Explanation
Each βi measures the effect of xi while holding other variables constant.
- 9
Why is it necessary to split data into training and testing sets?
Model answer
To evaluate how well the model generalizes to unseen data, preventing overfitting and giving a realistic performance estimate.
Explanation
Training set builds the model; testing set assesses its predictive accuracy on new data.
- 10
What does the R‑value (coefficient of correlation) indicate about the relationship between two variables?
Model answer
It measures the strength and direction of a linear relationship, ranging from -1 to +1. Values near ±1 indicate a strong linear relationship; 0 implies no linear relationship.
Explanation
Positive R means variables move together; negative R means they move in opposite directions.
- 11
How is R‑squared (R2) interpreted in linear regression?
Model answer
R2 represents the proportion of variance in the dependent variable that is explained by the independent variables in the model.
Explanation
An R2 of 0.8 means 80% of the variance in y is accounted for by the predictors.
- 12
Why is adjusted R2 preferred over R2 when comparing models with different numbers of predictors?
Model answer
Adjusted R2 penalizes the inclusion of irrelevant variables, preventing overfitting, whereas R2 always increases when more variables are added.
Explanation
Adjusted R2 adjusts for the number of predictors, giving a more honest measure of model fit.
- 13
What is RMSE and how is it calculated?
Model answer
RMSE (Root Mean Squared Error) is the square root of the average squared differences between actual and predicted values. It measures the average prediction error.
Explanation
RMSE=n1∑i=1n(yi−y^i)2
- 14
What does it mean if the residual sum of squares (RSS) is zero?
Model answer
It means the model predicts all observed values perfectly with no error, which is practically impossible with real data.
Explanation
Zero RSS would imply the regression line passes through every data point.
- 15
What is multicollinearity and why is it problematic in linear regression?
Model answer
Multicollinearity occurs when independent variables are highly correlated. It inflates coefficient standard errors, making estimates unstable and harder to interpret.
Explanation
The algorithm assumes predictors are independent; violation weakens predictive power and reliability.
- 16
List the key assumptions of linear regression.
Model answer
- Linearity of relationship; 2. Independence of errors; 3. Homoscedasticity (constant variance of errors); 4. Normality of errors; 5. No multicollinearity among predictors.
Explanation
Violations can lead to biased estimates, poor predictions, and invalid inferences.
- 17
What does homoscedasticity mean in the context of linear regression?
Model answer
Homoscedasticity means the variance of residuals is constant across all levels of the independent variables.
Explanation
If variance increases with predicted values (heteroscedasticity), standard errors may be inaccurate.
- 18
How do outliers affect linear regression models?
Model answer
Outliers can pull the regression line toward themselves, distorting the slope and intercept and reducing model accuracy.
Explanation
Linear regression is sensitive to outliers; they should be detected and handled before model building.
- 19
Why is a low variance filter applied to features before model building?
Model answer
Columns with very little variance (e.g., almost all same value) provide no predictive information and are removed to reduce noise and complexity.
Explanation
For instance, if almost all cars have the same fuel type, that column won't help predict price.
- 20
When should one‑hot encoding be used instead of label encoding for categorical variables?
Model answer
One‑hot encoding should be used for nominal categorical variables (no natural order) to avoid introducing false ordinal relationships.
Explanation
For gender (male/female), label encoding (0,1) implies an order that doesn't exist; one‑hot creates binary columns without order.
- 21
Describe two common strategies for handling missing data in a numeric column.
Model answer
- Replace with median (robust to outliers). 2. Use model‑based imputation (e.g., MICE) that predicts missing values from other features.
Explanation
Median is preferred over mean when outliers are present. MICE creates multiple imputations using chained equations.
- 22
What function in R is used to fit a linear regression model, and what are its primary arguments?
Model answer
The
lm()function, with formula (dependent ~ independent) and data (data frame).Explanation
Example:
lm(price ~ carat, data = diamonds). - 23
In the Python demo using sklearn, what is the purpose of the
train_test_splitfunction?Model answer
It splits the dataset into random training and testing subsets, typically with a specified test size (e.g., 0.3 for 30% test).
Explanation
This ensures the model is evaluated on unseen data to gauge generalization.
- 24
How does gradient descent help find the best fit line in linear regression?
Model answer
Gradient descent iteratively adjusts slope and intercept to minimize the cost function (RSS) by moving in the direction of steepest descent.
Explanation
It uses partial derivatives to update coefficients step by step until convergence to the minimum error.
- 25
What does the
predict()function do after fitting a linear regression model in R?Model answer
It uses the fitted model to generate predicted values for new data (typically the test set).
Explanation
Example:
predict(model, newdata = test)returns predicted y values.

Ask anything
We've read this whole study set, so questions about it get the best answers.