ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Probability and Statistics
    MS-251
    Progress0 / 36 topics
    Topics
    1. Introduction: Statistics and Data Analysis2. Statistical Inference3. Samples, Populations, and the Role of Probability4. Sampling Procedures5. Discrete and Continuous Data6. Statistical Modeling7. Types of Statistical Studies8. Probability: Sample Space, Events, Counting Sample Points9. Probability of an Event10. Additive Rules11. Conditional Probability12. Independence and the Product Rule13. Bayes’ Rule14. Random Variables and Probability Distributions15. Mathematical Expectation: Mean of a Random Variable16. Variance and Covariance of Random Variables17. Means and Variances of Linear Combinations of Random Variables18. Chebyshev’s Theorem19. Discrete Probability Distributions20. Continuous Probability Distributions21. Fundamental Sampling Distributions22. Sampling Distributions and Data Descriptions23. Random Sampling24. Sampling Distributions25. Sampling Distribution of Means and the Central Limit Theorem26. Sampling Distribution of S227. t-Distribution28. F-Quantile and Probability Plots29. Single Sample & One- and Two-Sample Estimation Problems30. Single Sample & One- and Two-Sample Tests of Hypotheses31. The Use of P-Values for Decision Making in Testing Hypotheses32. Regression: Linear Regression and Correlation33. Least Squares and the Fitted Model34. Multiple Linear Regression and Certain Nonlinear Regression Models35. Linear Regression Model Using Matrices36. Properties of the Least Squares Estimators
    MS-251›Least Squares and the Fitted Model
    Probability and StatisticsTopic 33 of 36

    Least Squares and the Fitted Model

    10 minread
    1,773words
    Intermediatelevel

    Least Squares and the Fitted Model

    In statistical modeling, particularly in linear regression, the least squares method is a technique used to estimate the parameters of a linear regression model. The objective is to find the line (or hyperplane in higher dimensions) that minimizes the sum of the squared differences between the observed values and the values predicted by the model. This line is known as the fitted model or regression line.

    Let's break down the concept of least squares and how it leads to the fitted model.


    1. The Least Squares Method

    The least squares method is used to find the best-fitting line by minimizing the sum of squared residuals. Residuals are the differences between the observed values (YiY_iYi​) and the predicted values (Y^i\hat{Y}_iY^i​) from the regression line. In simple linear regression, the goal is to estimate the parameters (slope β1\beta_1β1​ and intercept β0\beta_0β0​) of the linear model:

    Yi=β0+β1Xi+ϵiY_i = \beta_0 + \beta_1 X_i + \epsilon_iYi​=β0​+β1​Xi​+ϵi​

    Where:

    • YiY_iYi​ are the observed values,
    • XiX_iXi​ are the values of the independent variable,
    • β0\beta_0β0​ is the intercept,
    • β1\beta_1β1​ is the slope,
    • ϵi\epsilon_iϵi​ is the error term (residual).

    The residual for each data point iii is given by:

    ei=Yi−Y^i=Yi−(β0+β1Xi)e_i = Y_i - \hat{Y}_i = Y_i - (\beta_0 + \beta_1 X_i)ei​=Yi​−Y^i​=Yi​−(β0​+β1​Xi​)

    2. Objective of Least Squares

    The objective of the least squares method is to minimize the sum of squared residuals, which is mathematically expressed as:

    SSE=∑i=1n(Yi−Y^i)2\text{SSE} = \sum_{i=1}^{n} (Y_i - \hat{Y}_i)^2SSE=i=1∑n​(Yi​−Y^i​)2

    Where:

    • SSESSESSE stands for Sum of Squared Errors (or residual sum of squares).
    • nnn is the number of data points.

    The least squares method minimizes SSESSESSE by adjusting the parameters β0\beta_0β0​ (intercept) and β1\beta_1β1​ (slope) of the linear equation.

    3. Estimating the Parameters β0\beta_0β0​ and β1\beta_1β1​

    Using calculus, we can find the values of β0\beta_0β0​ and β1\beta_1β1​ that minimize the sum of squared residuals. These values are computed as follows:

    a. Formula for β1\beta_1β1​ (Slope)

    The slope β1\beta_1β1​ is given by the formula:

    β1^=n∑i=1nXiYi−∑i=1nXi∑i=1nYin∑i=1nXi2−(∑i=1nXi)2\hat{\beta_1} = \frac{n \sum_{i=1}^{n} X_i Y_i - \sum_{i=1}^{n} X_i \sum_{i=1}^{n} Y_i}{n \sum_{i=1}^{n} X_i^2 - \left( \sum_{i=1}^{n} X_i \right)^2}β1​^​=n∑i=1n​Xi2​−(∑i=1n​Xi​)2n∑i=1n​Xi​Yi​−∑i=1n​Xi​∑i=1n​Yi​​

    Where:

    • β1^\hat{\beta_1}β1​^​ is the estimated slope,
    • XiX_iXi​ and YiY_iYi​ are the individual data points,
    • nnn is the number of data points.

    b. Formula for β0\beta_0β0​ (Intercept)

    Once the slope β1^\hat{\beta_1}β1​^​ is found, the intercept β0\beta_0β0​ can be estimated as:

    β0^=Yˉ−β1^Xˉ\hat{\beta_0} = \bar{Y} - \hat{\beta_1} \bar{X}β0​^​=Yˉ−β1​^​Xˉ

    Where:

    • Xˉ\bar{X}Xˉ is the mean of the independent variable XXX,
    • Yˉ\bar{Y}Yˉ is the mean of the dependent variable YYY.

    Thus, the fitted model (regression line) is given by:

    Y^=β0^+β1^X\hat{Y} = \hat{\beta_0} + \hat{\beta_1} XY^=β0​^​+β1​^​X

    This is the fitted regression line that minimizes the sum of squared errors.


    4. The Fitted Model: The Regression Line

    The fitted model refers to the regression equation obtained after applying the least squares method. The line of best fit is the line that minimizes the difference between the observed values YiY_iYi​ and the predicted values Y^i\hat{Y}_iY^i​. The fitted model is represented by the equation:

    Y^=β0^+β1^X\hat{Y} = \hat{\beta_0} + \hat{\beta_1} XY^=β0​^​+β1​^​X

    Where:

    • Y^\hat{Y}Y^ is the predicted value of YYY,
    • XXX is the independent variable,
    • β0^\hat{\beta_0}β0​^​ is the estimated intercept,
    • β1^\hat{\beta_1}β1​^​ is the estimated slope.

    The fitted line is used to make predictions about the dependent variable YYY for any given value of XXX. For example, if XXX represents years of experience, and YYY represents salary, the fitted model can predict the expected salary for any given number of years of experience.

    Example of Fitted Model:

    Let’s say we have a dataset that represents the relationship between the number of study hours (XXX) and the test scores (YYY) of a group of students. After performing linear regression, we obtain the fitted model:

    Y^=50+5X\hat{Y} = 50 + 5XY^=50+5X

    This means that for each additional hour of study (XXX), the test score (YYY) increases by 5 points. The intercept of 50 suggests that a student who does not study at all (X=0X = 0X=0) is expected to have a baseline test score of 50.


    5. Assessing the Fit of the Model

    Once the least squares method is used to estimate the parameters, it’s important to assess how well the fitted model represents the data. This can be done using several metrics:

    a. Residuals

    Residuals are the differences between the observed values and the predicted values:

    ei=Yi−Y^ie_i = Y_i - \hat{Y}_iei​=Yi​−Y^i​

    By examining the residuals, we can check the assumptions of the regression model, such as homoscedasticity (constant variance) and independence of errors.

    b. R2R^2R2 (Coefficient of Determination)

    R2R^2R2 is a key metric that tells us how well the fitted model explains the variability in the dependent variable. It is the proportion of the variance in the dependent variable that is explained by the independent variable.

    R2=1−∑i=1n(Yi−Y^i)2∑i=1n(Yi−Yˉ)2R^2 = 1 - \frac{\sum_{i=1}^{n} (Y_i - \hat{Y}_i)^2}{\sum_{i=1}^{n} (Y_i - \bar{Y})^2}R2=1−∑i=1n​(Yi​−Yˉ)2∑i=1n​(Yi​−Y^i​)2​

    Where:

    • YiY_iYi​ are the observed values,
    • Y^i\hat{Y}_iY^i​ are the predicted values,
    • Yˉ\bar{Y}Yˉ is the mean of YYY.

    An R2R^2R2 value close to 1 indicates that the model explains most of the variance in the data, while an R2R^2R2 value close to 0 suggests that the model does not explain much of the variance.

    c. Hypothesis Testing for Parameters

    In addition to the fitted model, hypothesis tests can be performed on the parameters β0\beta_0β0​ and β1\beta_1β1​ to assess whether they are statistically significantly different from zero. Typically, this is done using t-tests for the individual regression coefficients.


    6. Limitations of the Fitted Model

    While the least squares method provides a useful tool for fitting a linear regression model, there are some important limitations:

    • Linearity Assumption: Linear regression assumes a linear relationship between the independent and dependent variables. If the relationship is non-linear, a linear regression model may not provide a good fit.
    • Outliers: Outliers can significantly affect the fitted model, especially in small datasets.
    • Assumption of Homoscedasticity: The least squares method assumes constant variance of the residuals. If the variance of residuals changes with the independent variable, this assumption is violated (heteroscedasticity).
    • Multicollinearity: In multiple regression, high correlation between independent variables can lead to instability in the coefficient estimates.

    Summary

    • The least squares method is used to estimate the parameters (slope and intercept) of a linear regression model by minimizing the sum of squared residuals.
    • The fitted model represents the best-fitting line, which can be used for prediction and analysis.
    • Key metrics for assessing the fit of the model include residuals, R2R^2R2, and hypothesis tests for the regression coefficients.
    • Understanding the assumptions and limitations of the model is essential for accurate interpretation and use of the regression results.
    Previous topic 32
    Regression: Linear Regression and Correlation
    Next topic 34
    Multiple Linear Regression and Certain Nonlinear Regression Models

    Past Papers

    Open this section to load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time10 min
      Word count1,773
      Code examples0
      DifficultyIntermediate