matrixcalc (version 1.0-3)

is.idempotent.matrix: Test for idempotent square matrix

Description

This function returns a TRUE value if the square matrix argument x is idempotent, that is, the product of the matrix with itself is the matrix. The equality test is performed to within the specified tolerance level. If the matrix is not idempotent, then a FALSE value is returned.

Usage

is.idempotent.matrix(x, tol = 1e-08)

Arguments

x

a numeric square matrix

tol

a numeric tolerance level usually left out

Value

A TRUE or FALSE value.

Details

Idempotent matrices are used in econometric analysis. Consider the problem of estimating the regression parameters of a standard linear model \({\bf{y}} = {\bf{X}}\;{\bf{\beta }} + {\bf{e}}\) using the method of least squares. \({\bf{y}}\) is an order \(m\) random vector of dependent variables. \({\bf{X}}\) is an \(m \times n\) matrix whose columns are columns of observations on one of the \( n - 1\) independent variables. The first column contains \(m\) ones. \({\bf{e}}\) is an order \(m\) random vector of zero mean residual values. \({\bf{\beta }}\) is the order \(n\) vector of regression parameters. The objective function that is minimized in the method of least squares is \(\left( {{\bf{y}} - {\bf{X}}\;{\bf{\beta }}} \right)^\prime \left( {{\bf{y}} - {\bf{X}}\;{\bf{\beta }}} \right)\). The solution to ths quadratic programming problem is \({\bf{\hat \beta }} = \left[ {\left( {{\bf{X'}}\;{\bf{X}}} \right)^{ - 1} \;{\bf{X'}}} \right]\;{\bf{y}}\) The corresponding estimator for the residual vector is \({\bf{\hat e}} = {\bf{y}} - {\bf{X}}\;{\bf{\hat \beta }} = \left[ {{\bf{I}} - {\bf{X}}\;\left( {{\bf{X'}}\;{\bf{X}}} \right)^{ - 1} {\bf{X'}}} \right]{\bf{y}} = {\bf{M}}\;{\bf{y}}\). \({\bf{M}}\) and \({{\bf{X}}\;\left( {{\bf{X'}}\;{\bf{X}}} \right)^{ - 1} {\bf{X'}}}\) are idempotent. Idempotency of \({\bf{M}}\) enters into the estimation of the variance of the estimator.

References

Bellman, R. (1987). Matrix Analysis, Second edition, Classics in Applied Mathematics, Society for Industrial and Applied Mathematics.

Chang, A. C., (1984). Fundamental Methods of Mathematical Economics, Third edition, McGraw-Hill.

Green, W. H. (2003). Econometric Analysis, Fifth edition, Prentice-Hall.

Horn, R. A. and C. R. Johnson (1990). Matrix Analysis, Cambridge University Press.

Examples

Run this code
# NOT RUN {
A <- diag( 1, 3 )
is.idempotent.matrix( A )
B <- matrix( c( 1, 2, 3, 4 ), nrow=2, byrow=TRUE )
is.idempotent.matrix( B )
C <- matrix( c( 1, 0, 0, 0 ), nrow=2, byrow=TRUE )
is.idempotent.matrix( C )
# }

Run the code above in your browser using DataCamp Workspace