In probability theory and statistics, the simple linear regression model is a commonly used model for analyzing the relationship between a single independent variable and a dependent variable. In the simple linear regression model, we have one independent variable (usually denoted as x) and one dependent variable (usually denoted as y). We assume that the relationship between these two variables can be described by a linear equation of the form:
y = β0 + β1x + ε
Here, y is the dependent variable, x is the independent variable, β0 and β1 are the parameters of the model, and ε is the error term. β0 is the intercept, representing the expected value of the dependent variable y when the independent variable x is 0, and β1 is the slope, representing the impact of a unit change in the independent variable x on the dependent variable y.
Our goal is to estimate the parameters β0 and β1 based on a given dataset. One commonly used method is the least squares method, which involves minimizing the differences between the observed values and the predicted values of the model.
Once we have estimated the parameters β0 and β1, we can use the model for prediction. Given a new value of the independent variable x, we can calculate the corresponding expected value of the dependent variable y by substituting the estimated parameter values.
There are 3 pages in the Shiny app:
1. Scatter plot and linear regression line plot generated from a variable set of data.
2. A scatter plot with two sliders that can control the slope and intercept of the regression line.
3. A predefined scatter plot that allows students to apply the least squares estimation method.
To enhance students' understanding of the concept of simple linear regression model, we have developed the first page of Shiny app. As you can see on the overview page, we randomly provide a set of sample data for x and y. At the top right corner of the page, a scatter plot is generated, while at the bottom right, a line representing the fitted simple linear regression line for the sample data is displayed. The red line on the plot represents the random errors in the simple linear regression equation. We have also included a 'Reset Data' button. When this button is clicked, the data in the left-hand side table is reset, and the plot on the right-hand side updates accordingly, demonstrating the changes in the simple linear regression equation based on the data. This feature aims to facilitate a better understanding of the regression model concept and the interpretation of the parameters in the simple linear regression equation.
Experience the concept of simple linear regression
Adjust the sliders for slope and intercept to optimize the fit of the corresponding line to the scatter plot. Try to find the relationship between income and consumption.
By observing the scatter plot and adjusting the slope and intercept sliders, students will visually experience how the regression line fits the data points. To deepen students' comprehension of the process and concept of simple linear regression. However, to obtain the optimal fit, we will introduce the method of least squares in subsequent section.
Calculate Regression Coefficients using Least Squares Estimation
Please utilize a calculator to calculate regression coefficients using the least squares estimation method. The coefficients should be rounded to three decimal places. After the calculation is performed, you can click the "Check" button to validate the answers. If it shows "incorrect", you need to recalculate until the answers are right. If you encounter difficulties, you can click the "View Answer" button to see the correct answers.
Group 12 - MAED5511