LINMOD 3.1: Brief Manual for LINMOD (Version 3.1) David H. Christiansen, James D. Hosking, Ronald W. Helms, Keith E. Muller, and Kevin B. Hunter TITLE1 "EXAMPLE1.SAS--Demonstrate simple LINMOD use"; * 0. Define raw data file; FILENAME IN01 "C:\PROGRAMS\LINMOD31\EXAMPLES\PAYNE.DAT"; DATA PAYNE; INFILE IN01; * 1. Define directory in which LINMOD source code has been stored; %LET LMDIRECT = C:\PROGRAMS\LINMOD31\SOURCE\ ; * 2. Define SAS macro code needed; %INCLUDE "&LMDIRECT.MACROLIB.MAC" / NOSOURCE2 ; * 3. Reduce raw data to a TYPE=CORR file named _CORRDS_ ; &PROCSSCP DATA=PAYNE ; VAR CONTROL LOW MODERATE HIGH INIT SCORE2 SCORE4 SCORE6 SCORE8 SCORE10; * 4.1 Start IML with at least minimum space needed; PROC IML WORKSIZE=200 SYMSIZE=350; *4.2 Grab code; &LINMOD ; * 5. Retrieve the file _CORRDS_ created in Step 3 ; RUN GETCORSS; * 6. Define the model and estimate primary parameters; INDVARS = { "CONTROL" "LOW" "MODERATE" "HIGH" "INIT" }; DEPVARS=NAMELIST("SCORE",2,10,2); RUN FITMODEL; * 7.1 Conduct a test (and estimation) step; PRINT "* MANOVA Test of Main Effect of Treatment, *" , "* comparing each treatment group to the control group *" ; C = { 1 -1 0 0 0 , 1 0 -1 0 0 , 1 0 0 -1 0 } ; THETARNM= { "C - LOW" "C - MOD" "C - HIGH" }; *U defaults to Identity matrix, if NROW(U)=0; RUN TESTGLH; TITLE1 "EXAMPLE2.SAS--Demonstrate LINMOD using MAKESS"; FILENAME IN01 "C:\PROGRAMS\LINMOD31\EXAMPLES\PAYNE.DAT"; DATA PAYNE; INFILE IN01; %LET LMDIRECT = C:\PROGRAMS\LINMOD31\SOURCE\ ; %INCLUDE "&LMDIRECT.MACROLIB.MAC" / NOSOURCE2 ; PROC IML WORKSIZE=200 SYMSIZE=350; &LINMOD ; OPT_OFF = { "MSH" }; OPT_ON = { "LISTINFO" "AVAILOPT" }; RUN SETOPT; *Read raw data into IML; USE PAYNE; READ ALL VAR{"GROUP"} INTO GROUP; READ ALL VAR{"INIT"} INTO INIT; READ ALL VAR{"SCORE2" "SCORE4" "SCORE6" "SCORE8" "SCORE10"} INTO Y; CLOSE PAYNE; *Use IML functions to create indicator variables for design matrix; N=NROW(Y); * # observations in sample; CONSTANT=J(N,1,1); *Column of 1's for intercept, etc; CELLMEAN=DESIGN(GROUP); *Cell mean coding; EFFECT =CONSTANT||DESIGNF(GROUP); *Effect coding; REFERENC=CONSTANT||CELLMEAN(|*,2:NCOL(CELLMEAN)|); *Reference cell coding; *Assemble all predictors and responses into a single matrix Z; * ZNAMES must also exist; Z = CELLMEAN || INIT || Y; ZNAMES = { "CONTROL" "LOW" "MODERATE" "HIGH" "INIT" } || { "SCORE2" "SCORE4" "SCORE6" "SCORE8" "SCORE10" } ; FREE GROUP INIT Y ; *Create SSCP matrix and associated parameters; RUN MAKESS; FREE Z; *Saves space, but if helpful, use PROCSSCP macro, not MAKESS; *Fit a model; INDVARS = { "CONTROL" "LOW" "MODERATE" "HIGH" "INIT" }; DEPVARS = { "SCORE2" "SCORE4" "SCORE6" "SCORE8" "SCORE10" }; RUN FITMODEL; *Conduct any test or estimation desired; *C= ---- ; *U= ---- ; *RUN TESTGLH; With the current code, simply replacing SOURCE by STORED in the LMDIRECT= ; statement will access stored IML code and thereby speed the loading of LINMOD. LINMOD Options and Default Values SETOPT / MAKESS GETCORSS FITMODEL TESTGLH General _________________________________________________________________________ AVAILOPT CHKMISS (ON) CPARMS PARMIN C (ON) LISTINFO MPARMS CSS SSIN U (ON) CURROPTS MSS BETA (ON) THETA0 (ON) NEWOPTS XPXINV THETA (ON) COMPRESS (ON) UNIBETA MID CHECK EXTHETA (ON) EXBETA (ON) MATTHETA COVBETA UNITHETA (ON) SIGMA (ON) MSH SCORR (ON) MSE SSSTEP ECORR (ON) SSFIT HEIVAL LTFR CANVEC LINDEP (ON) CANRSQ (ON) PARMOUT (ON) MULTTEST (ON) RSQUARED (ON) UNIREP (ON) UNIPRNT (ON) UNIWARN UNIFORC _________________________________________________________________________ (ON) indicates the default ON. The absence of (ON) indicates the default is OFF. Matrices Available from FITMODEL MATRIX OPTION ROWNAME COLNAME __________________________________________ _BETA_ BETA,EXBETA _XNAME_ _XNAME_ _BPVAL_ EXBETA _XNAME_ _YNAME_ _BSE_ EXBETA _XNAME_ _YNAME_ _BT_ EXBETA _XNAME_ _YNAME_ _LINDEP_ LINDEP _XNAME_ _VNAME_ _PARM1_ UNIBETA ---- _PM1CNM_ _SCORR_ SCORR _YNAME_ _YNAME_ _SIGMA_ SIGMA _YNAME_ _YNAME_ _SS_ SSFIT _VNAME_ _VNAME_ _STAT_ UNIBETA _YNAME_ _STRNM_ _XPXINV_ XPXINV _XNAME_ _XNAME_ __________________________________________ Matrices Available from TESTGLH Matrix Option Rowname Colname Section _________________________________________________________________ _THETA_ THETA _THRNM_ _THCNM_ 7.2.2, 7.5.4 _MID_ MID _THRNM_ _THRNM_ 7.2.2, 7.5.5 _SDTHTA_ MATTHETA _THRNM_ _THCNM_ 7.5.7 _TTHTA_ MATTHETA _THRNM_ _THCNM_ 7.5.7 _PVTHTA_ MATTHETA _THRNM_ _THCNM_ 7.5.7 _MSH_ MSH _THCNM_ _THCNM_ 7.2.2, 7.5.9 _MSE_ MSE _THCNM_ _THCNM_ 7.2.2, 7.5.10 _ECORR_ ECORR _THCNM_ _THCNM_ 7.5.11 _HEIVAL_ HEIVAL _CANNM_ _NONM_ 7.5.12 _CANVEC_ CANVEC _THCNM_ _CANNM_ 7.5.13 _CANRSQ_ CANRSQ _CANNM_ _NONM_ 7.5.14 _FSTATS_ UNITHETA _THCNM_ _FSTRNM_ 7.5.6,7.5.17 _STMAT1_ MULTTEST _STMRNM_ _STMCNM_ 7.5.16,7.5.17 _TPARM1_ MULTTEST _NONM_ _TPCNM1_ 7.5.16 _URESUL_ UNIREP _UCOLNM_ _UROWNM_ 7.5.18--7.5.21 _________________________________________________________________ Note that if THETARNM exists then _THTRNM_=THETARNM. Also, if THETACNM exists then _THTCNM_=THETACNM. 8.1 NAMELIST (A Function) Usage: yourlist = NAMELIST(STEM,LOW,HIGH,BY); This function generates a row of names, STEMlow to STEMhigh, by..., a character matrix. STEM is a character string (1x1). Require 0<=LOW<=HIGH, and 1<=BY, integers (1x1). See the MAKESS example in 4.9 for an example use. Example 1 in Section 1.5, includes the following code: DEPVARS=NAMELIST("SCORE",2,10,2); 8.2 UMEAN (A Function) Usage: UAVE = UMEAN(P); This function returns J(P,1,1/P), which provides a column (vector) to use as an averaging U matrix. 8.3 UPOLY1 (A Module) This module produces a U matrix and associated names for a test of trends. Usage: RUN UPOLY1(VALUES, NAME, U, NMOUT ); Inputs. VALUES, a set of numeric treatment levels (values), forming a matrix with one row or column. NAME, a character string providing stem of names for trends. Outputs. U, a matrix with columns orthonormal polynomial coefficients (excludes zero order). NMOUT, a character matrix with one row of names. 8.4 UPOLY2 (A Module) This module produces a U matrices and associated names for a tests of trends and interaction for a two within-subject factors. Assume Factor 1, with levels VALUES1, varies slowly, and that Factor 2, with levels VALUES2, varies rapidly. Usage: RUN UPOLY2(VALUES1,NAME1, VALUES2,NAME2, U1, NMOUT1,U2, NMOUT2, U12 ,NMOUT12); Inputs VALUES1=1st set of numeric treatment levels/values NAME1 = 1st character string providing stem of names; VALUES2=2nd set of numeric treatment levels/values NAME2 = 2nd character string providing stem of names; Outputs U1 =matrix of orthonormal polynomial coefficient columns for 1st factor (excludes zero order) NMOUT1 =list (1 row matrix) of 1st factor names (character); U2 =matrix of orthonormal polynomial coefficient columns for 2nd factor (excludes zero order) NMOUT2 =list (1 row matrix) of 2nd factor names (character); U12 =matrix of orthonormal polynomial coefficient columns for interaction (excludes zero order) NMOUT12=list (1 row matrix) of interaction names (character); 8.5 UTRENDS (A Function) Create polynomial trends matrix (columnwise), excluding the zero order. Usage: UPOLY = UTREND(VALUES);