Calcite | Level 5

Idempotent matrix

How to create idempotent matrix in sas/IML

6 REPLIES 6
Super User

Re: Idempotent matrix

Any idempotent matrix?

Calcite | Level 5

Re: Idempotent matrix

Thank you for your response. I need SAS/IML code to generate any idempotent matrix.
Super User

Re: Idempotent matrix

Moved this thread to the IML Forum.

SAS Super FREQ

Re: Idempotent matrix

One way to generate an idempotent matrix is to use the formula:
M=I-(1/n)*ii`

where I is the identity matrix, n is the number of rows, and i is a column vector of 1s of dimension n.

This matrix is by definition orthogonal so that the rows are independent.

I have included an example below of how this can be done in IML.

proc iml;
n=5;
i=j(n,1,1);
M=i(5)-((1/n)*i*i`);
m2=m*m;*check for idempotency;
print m m2;
quit;

SAS Super FREQ

Re: Idempotent matrix

To create a matrix in SAS/IML, use curly brackets to begin/end the matrix. Use spaces to separate columns and use commas to indicate a new row. For example:

``````proc iml;

A = { 1  0,
0   1};
``````
SAS Super FREQ