R: Test for idempotent square matrix

is.idempotent.matrix {matrixcalc} | R Documentation

## 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

### 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{β }} + {\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{β }} is the order n vector of regression parameters. The objective function that is minimized in the method of least squares is ≤ft( {{\bf{y}} - {\bf{X}}\;{\bf{β }}} \right)^\prime ≤ft( {{\bf{y}} - {\bf{X}}\;{\bf{β }}} \right). The solution to ths quadratic programming problem is {\bf{\hat β }} = ≤ft[ {≤ft( {{\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 β }} = ≤ft[ {{\bf{I}} - {\bf{X}}\;≤ft( {{\bf{X'}}\;{\bf{X}}} \right)^{ - 1} {\bf{X'}}} \right]{\bf{y}} = {\bf{M}}\;{\bf{y}}. {\bf{M}} and {{\bf{X}}\;≤ft( {{\bf{X'}}\;{\bf{X}}} \right)^{ - 1} {\bf{X'}}} are idempotent. Idempotency of {\bf{M}} enters into the estimation of the variance of the estimator.

### Value

A TRUE or FALSE value.

### Author(s)

Frederick Novomestky fnovomes@poly.edu

### 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

    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 )

[Package matrixcalc version 1.0-3 Index]