Skip to main content

Posts

Showing posts from July, 2008

SPSS Regression using Matrices

The SPSS syntax below does several linear regression calculations (model parameter values, sum of squares, F value, F test, R, Rsquare, t tests, etc) using matrices ... just change the data file and initialization part as required and off you go ......



/* ####### DATA FILE ################################################################################### */

FILE HANDLE data /NAME='c:\data\ratty2.sav'.


/* ####### INITIALIZATION AND DATA MATRIX ############################################################## */

MATRIX.

COMPUTE N=21. /* no of data rows */
COMPUTE IND_VARS=3. /* no of independet variables */

GET Y /FILE=data /VARIABLES =size. /* puts y-variable into column matrix called Y */
GET X1 /FILE=data /VARIABLES =t,z2,z3 /* put independent variables into a matrix called X1 */

/* ########## MATRIX CALCULATIONS #################################################################### */


COMPUTE j=make(N,1,1). …