Skip to main content
improved exposition, title and corrected typos
Source Link

R -How How are the residual value is calculated -residuals of linear regression are calculated in R?

Just started learning linear regression, started with a simple perfect linear regression example, X values are 1,2,3,4,5 and Y values are 1,2,3,4,5. And this is the summary iI am getting:

Residuals:
         1          2          3          4          5 
-4.828e-16  8.351e-16 -2.098e-16 -1.544e-16  1.196e-17 

Coefficients:
             Estimate Std. Error   t value Pr(>|t|)    
(Intercept) 1.192e-15  6.050e-16 1.969e+00    0.144    
X           1.000e+00  1.824e-16 5.482e+15   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 5.769e-16 on 3 degrees of freedom
Multiple R-squared:      1, Adjusted R-squared:      1 
F-statistic: 3.005e+31 on 1 and 3 DF,  p-value: < 2.2e-16

And this fromFrom this wee see that the estimated linear equation is y=x+1.192 and when we calculate the residuals for the first data point it should be 1-(1+1.92) -1.92. But why the residual output shows -4.8. 

How is the residual is calculated here?

R -How the residual value is calculated - linear regression

Just started learning linear regression, started with a simple perfect linear regression example, X values are 1,2,3,4,5 and Y values are 1,2,3,4,5. And this is the summary i am getting

Residuals:
         1          2          3          4          5 
-4.828e-16  8.351e-16 -2.098e-16 -1.544e-16  1.196e-17 

Coefficients:
             Estimate Std. Error   t value Pr(>|t|)    
(Intercept) 1.192e-15  6.050e-16 1.969e+00    0.144    
X           1.000e+00  1.824e-16 5.482e+15   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 5.769e-16 on 3 degrees of freedom
Multiple R-squared:      1, Adjusted R-squared:      1 
F-statistic: 3.005e+31 on 1 and 3 DF,  p-value: < 2.2e-16

And this from this the linear equation is y=x+1.192 and when we calculate the residuals for first data point it should be 1-(1+1.92) -1.92. But why the residual output shows -4.8. How the residual is calculated here?

How are the residuals of linear regression are calculated in R?

Just started learning linear regression, started with a simple perfect linear regression example, X values are 1,2,3,4,5 and Y values are 1,2,3,4,5. And this is the summary I am getting:

Residuals:
         1          2          3          4          5 
-4.828e-16  8.351e-16 -2.098e-16 -1.544e-16  1.196e-17 

Coefficients:
             Estimate Std. Error   t value Pr(>|t|)    
(Intercept) 1.192e-15  6.050e-16 1.969e+00    0.144    
X           1.000e+00  1.824e-16 5.482e+15   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 5.769e-16 on 3 degrees of freedom
Multiple R-squared:      1, Adjusted R-squared:      1 
F-statistic: 3.005e+31 on 1 and 3 DF,  p-value: < 2.2e-16

From this wee see that the estimated linear equation is y=x+1.192 and when we calculate the residuals for the first data point it should be 1-(1+1.92) -1.92. But why the residual output shows -4.8. 

How is the residual calculated here?

Source Link

R -How the residual value is calculated - linear regression

Just started learning linear regression, started with a simple perfect linear regression example, X values are 1,2,3,4,5 and Y values are 1,2,3,4,5. And this is the summary i am getting

Residuals:
         1          2          3          4          5 
-4.828e-16  8.351e-16 -2.098e-16 -1.544e-16  1.196e-17 

Coefficients:
             Estimate Std. Error   t value Pr(>|t|)    
(Intercept) 1.192e-15  6.050e-16 1.969e+00    0.144    
X           1.000e+00  1.824e-16 5.482e+15   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 5.769e-16 on 3 degrees of freedom
Multiple R-squared:      1, Adjusted R-squared:      1 
F-statistic: 3.005e+31 on 1 and 3 DF,  p-value: < 2.2e-16

And this from this the linear equation is y=x+1.192 and when we calculate the residuals for first data point it should be 1-(1+1.92) -1.92. But why the residual output shows -4.8. How the residual is calculated here?