> x = c(1,0,2) > y=c(3,1,2) > lm(y~x) Call: lm(formula = y ~ x) Coefficients: (Intercept) x 1.5 0.5 > mod = lm(y~x) > mod Call: lm(formula = y ~ x) Coefficients: (Intercept) x 1.5 0.5 > summary(mod) Call: lm(formula = y ~ x) Residuals: 1 2 3 1.0 -0.5 -0.5 Coefficients: Estimate Std. Error t value (Intercept) 1.500 1.118 1.342 x 0.500 0.866 0.577 Pr(>|t|) (Intercept) 0.408 x 0.667 Residual standard error: 1.225 on 1 degrees of freedom Multiple R-squared: 0.25, Adjusted R-squared: -0.5 F-statistic: 0.3333 on 1 and 1 DF, p-value: 0.6667 > x2 = x^2 > lm(y~x+x^2) Call: lm(formula = y ~ x + x^2) Coefficients: (Intercept) x 1.5 0.5 > lm(y~x+x2) Call: lm(formula = y ~ x + x2) Coefficients: (Intercept) x x2 1.0 3.5 -1.5 > A = matrix(c(1,2,3,4,5,6),3,2) > A [,1] [,2] [1,] 1 4 [2,] 2 5 [3,] 3 6 > B = matrix(rep(3,6),2,3) > B [,1] [,2] [,3] [1,] 3 3 3 [2,] 3 3 3 > A%*%B [,1] [,2] [,3] [1,] 15 15 15 [2,] 21 21 21 [3,] 27 27 27 > A*B Error in A * B : non-conformable arrays > C = matrix(rnorm(6),2,3) > C [,1] [,2] [,3] [1,] -0.6314838 -0.02117242 1.2428954 [2,] -1.6265466 1.40916533 0.1642478 > B*C [,1] [,2] [,3] [1,] -1.894451 -0.06351725 3.7286862 [2,] -4.879640 4.22749600 0.4927435 > C = matrix(rbinom(6,5,.5),2,3) > C [,1] [,2] [,3] [1,] 2 1 3 [2,] 3 2 4 > B [,1] [,2] [,3] [1,] 3 3 3 [2,] 3 3 3 > B*C [,1] [,2] [,3] [1,] 6 3 9 [2,] 9 6 12 > solve(t(C)%*%C) Error in solve.default(t(C) %*% C) : system is computationally singular: reciprocal condition number = 6.20003e-18 > C=matrix(rnorm(9),3,3) > C [,1] [,2] [,3] [1,] -0.6941833 0.7670638 1.3231382 [2,] 0.2784828 0.2658453 0.1140798 [3,] -0.1424353 0.9918065 0.2311486 > solve(C) [,1] [,2] [,3] [1,] -0.1326884 2.91322806 -0.6782448 [2,] -0.2069304 0.07187407 1.1490360 [3,] 0.8061280 1.48675505 -1.0219720 > ?rnorm starting httpd help server ... done > C=matrix(rnorm(9),3,3) > C [,1] [,2] [,3] [1,] -0.02481775 0.35129724 1.0170294 [2,] -0.01964760 -1.24171454 -0.1344481 [3,] 0.72518964 0.03616592 0.3254510 >