Book contents
- Frontmatter
- Dedication
- Contents
- Preface
- Content-how the chapters fit together
- 1 A brief introduction to R
- 2 Styles of data analysis
- 3 Statistical models
- 4 A review of inference concepts
- 5 Regression with a single predictor
- 6 Multiple linear regression
- 7 Exploiting the linear model framework
- 8 Generalized linear models and survival analysis
- 9 Time series models
- 10 Multi-level models and repeated measures
- 11 Tree-based classification and regression
- 12 Multivariate data exploration and discrimination
- 13 Regression on principal component or discriminant scores
- 14 The R system – additional topics
- 15 Graphs in R
- Epilogue
- References
- Index of R symbols and functions
- Index of terms
- Index of authors
- Plate Section
7 - Exploiting the linear model framework
Published online by Cambridge University Press: 05 October 2013
- Frontmatter
- Dedication
- Contents
- Preface
- Content-how the chapters fit together
- 1 A brief introduction to R
- 2 Styles of data analysis
- 3 Statistical models
- 4 A review of inference concepts
- 5 Regression with a single predictor
- 6 Multiple linear regression
- 7 Exploiting the linear model framework
- 8 Generalized linear models and survival analysis
- 9 Time series models
- 10 Multi-level models and repeated measures
- 11 Tree-based classification and regression
- 12 Multivariate data exploration and discrimination
- 13 Regression on principal component or discriminant scores
- 14 The R system – additional topics
- 15 Graphs in R
- Epilogue
- References
- Index of R symbols and functions
- Index of terms
- Index of authors
- Plate Section
Summary
The model matrix X is fundamental to all calculations for a linear model. The model matrix carries the information needed to calculate the fitted values that correspond to any particular choice of coefficients. There is a one-to-one correspondence between columns of X and regression coefficients.
In Chapter 6, the columns of the model matrix contained the observed values of the explanatory variables, perhaps after transformation. Fitted values were obtained by multiplying the first column by the first coefficient (usually the intercept), the second column by the second coefficient, and so on across all columns. The sum of the products in any row is the fitted value for that row.
This chapter will explore new ways to relate the columns of the model matrix to the explanatory variables, where a variable may be either a vector of numeric values, or a factor. Vectors of zeros and ones (columns of “dummy” variables) can be used to handle factor levels, but as noted below there are other possibilities. For modeling a quadratic form of response, we take values of x as one of the columns and values of x2 as another. The model matrix framework also allows the modeling of many other forms of non-linear response. As before, the regression calculations find the set of coefficients that best predicts the observed responses, in the sense of minimizing the sum of squares of the residuals.
- Type
- Chapter
- Information
- Data Analysis and Graphics Using RAn Example-Based Approach, pp. 217 - 243Publisher: Cambridge University PressPrint publication year: 2010