27.03.2013 Views

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Example<br />

Overview<br />

MATRIX—END MATRIX 915<br />

MATRIX.<br />

READ A /FILE=MATRDATA /SIZE={6,6} /FIELD=1 TO 60.<br />

CALL EIGEN(A,EIGENVEC,EIGENVAL).<br />

LOOP J=1 TO NROW(EIGENVAL).<br />

+ DO IF (EIGENVAL(J) > 1.0).<br />

+ PRINT EIGENVAL(J) / TITLE="Eigenvalue:" /SPACE=3.<br />

+ PRINT T(EIGENVEC(:,J)) / TITLE="Eigenvector:" /SPACE=1.<br />

+ END IF.<br />

END LOOP.<br />

END MATRIX.<br />

The MATRIX and END MATRIX commands enclose statements that are executed by the SPSS<br />

matrix processor. Using matrix programs, you can write your own statistical routines in the<br />

compact language of matrix algebra. Matrix programs can include mathematical calculations,<br />

control structures, display of results, and reading and writing matrices as character files<br />

or SPSS data files.<br />

As discussed below, a matrix program is for the most part independent of the rest of the<br />

SPSS session, although it can read and write SPSS data files, including the working data file.<br />

This section does not attempt to explain the rules of matrix algebra. Many textbooks, such<br />

as Hadley (1961) and O’Nan (1971), teach the application of matrix methods to statistics.<br />

The SPSS MATRIX procedure was originally developed at the Madison Academic<br />

Computing Center, University of Wisconsin.<br />

Terminology<br />

A variable within a matrix program represents a matrix, which is simply a set of values<br />

arranged in a rectangular array of rows and columns.<br />

• An n× m (read “n by m”) matrix is one that has n rows and m columns. The integers n and<br />

m are the dimensions of the matrix. An n × m matrix contains n× m elements, or data<br />

values.<br />

• An n × 1 matrix is sometimes called a column vector, and a 1 × n matrix is sometimes<br />

called a row vector. A vector is a special case of a matrix.<br />

• A 1× 1 matrix, containing a single data value, is often called a scalar. A scalar is also a<br />

special case of a matrix.<br />

• An index to a matrix or vector is an integer that identifies a specific row or column. Indexes<br />

normally appear in printed works as subscripts, as in A31, but are specified in the matrix<br />

language within parentheses, as in A( 3,1)<br />

. The row index for a matrix precedes the column<br />

index.<br />

• The main diagonal of a matrix consists of the elements whose row index equals their<br />

column index. It begins at the top left corner of the matrix; in a square matrix, it runs to the<br />

bottom right corner.<br />

• The transpose of a matrix is the matrix with rows and columns interchanged. The transpose<br />

of an n × m matrix is an m× n matrix.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!