mc.table | R Documentation |
For a given set of regressors this command calculates the coefficient of determination of a regression of one specific regressor on all combinations of the remaining regressors. This provides an overview of potential multicollinearity. Needs at least three variables. For just two regressors the square of cor()
can be used.
mc.table(x, intercept = TRUE, digits = 3)
x |
data frame of variables to be regressed on each other. |
intercept |
logical value specifying whether regression should have an intercept. |
digits |
number of digits to be rounded to. |
Matrix of R-squared values. The column headers indicate the respective endogenous variables that is projected on a combination of exogenous variables. Example: If we have 4 regressors x1, x2, x3, x4, then the fist column of the returned matrix has 7 rows including the R-squared values of the following regressions:
x1 ~ x2 + x3 + x4
x1 ~ x3 + x4
x1 ~ x2 + x4
x1 ~ x2 + x3
x1 ~ x4
x1 ~ x3
x1 ~ x2
The second column corresponds to the regressions:
x2 ~ x1 + x3 + x4
x2 ~ x3 + x4
x2 ~ x1 + x4
x2 ~ x1 + x3
x2 ~ x4
x2 ~ x3
x2 ~ x1
and so on.
## Replicate table 21.3 in the textbook
mc.table(data.printer[,-1])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.