> xy # print the xy dataframe x y 1 29.7 16.6 2 68.4 49.1 3 120.7 121.7 4 217.2 219.6 5 313.5 375.5 6 419.1 570.8 7 535.9 648.2 8 641.5 755.6 > > xy.reg <- lm(y~x) # Fit the regression (lm=linear model) > summary(xy.reg) # Print out estimates, t-tests Call: lm(formula = y ~ x) Residuals: Min 1Q Median 3Q Max -31.052 -14.738 -4.175 5.488 66.428 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -27.56895 19.84220 -1.389 0.214 x 1.26925 0.05503 23.063 4.36e-07 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 32.65 on 6 degrees of freedom Multiple R-squared: 0.9888, Adjusted R-squared: 0.987 F-statistic: 531.9 on 1 and 6 DF, p-value: 4.355e-07 > anova(xy.reg) # Print out ANOVA table Analysis of Variance Table Response: y Df Sum Sq Mean Sq F value Pr(>F) x 1 567033 567033 531.9 4.355e-07 *** Residuals 6 6396 1066 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > > > xy.reg0 <- lm(y~x -1) # Fits regression thru Origin > summary(xy.reg0) # Print out estimates, t-tests Call: lm(formula = y ~ x - 1) Residuals: Min 1Q Median 3Q Max -42.572 -26.359 -18.987 -1.848 64.924 Coefficients: Estimate Std. Error t value Pr(>|t|) x 1.20705 0.03408 35.42 3.71e-09 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 34.75 on 7 degrees of freedom Multiple R-squared: 0.9945, Adjusted R-squared: 0.9937 F-statistic: 1255 on 1 and 7 DF, p-value: 3.712e-09 > anova(xy.reg0) # Print out ANOVA table Analysis of Variance Table Response: y Df Sum Sq Mean Sq F value Pr(>F) x 1 1515175 1515175 1254.5 3.712e-09 *** Residuals 7 8454 1208 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 >