MATH 376 -- Mathematical Statistics Another Multiple Regression Example April 23, 2012 > Problem74 <- read.table("/home/fac/little/public_html/ProbStat1112/MultReg2R.dat",header=T) > Problem74 x1 x2 x3 x4 y 1 -1 -1 -1 -1 24.4 2 -1 -1 -1 1 22.2 3 -1 -1 1 -1 25.9 4 -1 -1 1 1 24.5 5 -1 1 -1 -1 25.2 6 -1 1 -1 1 19.4 7 -1 1 1 -1 28.4 8 -1 1 1 1 24.1 9 1 -1 -1 -1 23.5 10 1 -1 -1 1 22.1 11 1 -1 1 -1 16.5 12 1 -1 1 1 19.6 13 1 1 -1 -1 19.3 14 1 1 -1 1 14.2 15 1 1 1 -1 16.0 16 1 1 1 1 12.7 > x1 <- Problem74[,1] > x1 [1] -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1 1 1 1 1 > x2 <- Problem74[,2] > x3 <- Problem74[,3] > x4 <- Problem74[,4] > y <- Problem74[,5] > summary(lm(y ~ x1 + x2 + x3 + x4)) Call: lm(formula = y ~ x1 + x2 + x3 + x4) Residuals: Min 1Q Median 3Q Max -3.8125 -2.2500 -0.1125 2.0000 4.2375 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 21.1250 0.7493 28.193 1.31e-11 *** x1 -3.1375 0.7493 -4.187 0.00152 ** x2 -1.2125 0.7493 -1.618 0.13391 x3 -0.1625 0.7493 -0.217 0.83228 x4 -1.2750 0.7493 -1.702 0.11689 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 2.997 on 11 degrees of freedom Multiple R-squared: 0.6774, Adjusted R-squared: 0.56 F-statistic: 5.774 on 4 and 11 DF, p-value: 0.009383 % Comment: Fitting the linear model could also be done without % assigning the separate names for the columns: > lm(Problem74[,5] ~ Problem74[,1] + Problem74[,2] + Problem74[,3] + Problem74[,4])