


Multiple R-squared: 0.831,Ědjusted R-squared: 0.818į-statistic: 63.91 on 1 and 13 DF, p-value: 2.253e-06įrom the model summary we can see that the fitted regression equation is: Residual standard error: 3.641 on 13 degrees of freedom The following code shows how to create this fake dataset in R: #create dataset We’ll attempt to fit a simple linear regression model using hours as the explanatory variable and exam score as the response variable. Step 1: Load the Dataįor this example, we’ll create a fake dataset that contains the following two variables for 15 students: This tutorial provides a step-by-step explanation of how to perform simple linear regression in R. This equation can help us understand the relationship between the explanatory and response variable, and (assuming it’s statistically significant) it can be used to predict the value of a response variable given the value of the explanatory variable. b 0: The intercept of the regression line.In a nutshell, this technique finds a line that best “fits” the data and takes on the following form: Simple linear regression is a technique that we can use to understand the relationship between a single explanatory variable and a single response variable.
