Exam2.B.1 is used to visualize the effect of lm model statement with Gaussian data and their design matrix

References

  1. Stroup, W. W. (2012). Generalized Linear Mixed Models: Modern Concepts, Methods and Applications. CRC Press.

See also

Examples

#----------------------------------------------------------------------------------- ## Linear Model discussed in Example 2.B.1 using simple regression data of Table1.1 #----------------------------------------------------------------------------------- data(Table1.1) Exam2.B.1.lm1 <- lm( formula = y~x , data = Table1.1 # , subset # , weights # , na.action , method = "qr" , model = TRUE # , x = FALSE # , y = FALSE , qr = TRUE , singular.ok = TRUE , contrasts = NULL # , offset # , ... ) summary(Exam2.B.1.lm1)
#> #> Call: #> lm(formula = y ~ x, data = Table1.1, method = "qr", model = TRUE, #> qr = TRUE, singular.ok = TRUE, contrasts = NULL) #> #> Residuals: #> Min 1Q Median 3Q Max #> -4.0909 -0.9727 -0.2182 0.8364 4.3455 #> #> Coefficients: #> Estimate Std. Error t value Pr(>|t|) #> (Intercept) -1.2727 1.4066 -0.905 0.389136 #> x 1.4364 0.2378 6.041 0.000193 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> Residual standard error: 2.494 on 9 degrees of freedom #> Multiple R-squared: 0.8022, Adjusted R-squared: 0.7802 #> F-statistic: 36.5 on 1 and 9 DF, p-value: 0.0001925 #>
DesignMatrix.lm1 <- model.matrix ( object = Exam2.B.1.lm1 ) DesignMatrix.lm1
#> (Intercept) x #> 1 1 0 #> 2 1 1 #> 3 1 2 #> 4 1 3 #> 5 1 4 #> 6 1 5 #> 7 1 6 #> 8 1 7 #> 9 1 8 #> 10 1 9 #> 11 1 10 #> attr(,"assign") #> [1] 0 1