LISREL and PRELIS Tutorial
Total Page:16
File Type:pdf, Size:1020Kb
Getting Started with LISREL 8 and PRELIS 2 Updated: August 2012 Getting Started with LISREL 8 and PRELIS 2 Table of Contents Section 1: Introduction .................................................................................................................... 3 Section 2: Reading Raw Data Using PRELIS2 .............................................................................. 3 2.1 A Detailed PRELIS2 Example ........................................................................................................... 5 2.2 Another Detailed Example ................................................................................................................. 7 Section 3: Specifying a LISREL Model ......................................................................................... 8 Section 4: Building LISREL Command Files Using LISREL Matrix Language ......................... 10 Section 5: Building LISREL Command Files Using SIMPLIS.................................................... 20 Section 6: Building LISREL Command Files Using SIMPLIS.................................................... 22 Section 7: Documentation ............................................................................................................. 22 2 The Department of Statistics and Data Sciences, The University of Texas at Austin Getting Started with LISREL 8 and PRELIS 2 Section 1: Introduction This tutorial is for those who plan to use the LISREL software to estimate structural equation models (SEMs). You can also use this software to carry out exploratory and confirmatory factor analysis, as well as path analysis. For more information on LISREL, you might visit Lisrel's home page or our own FAQs. In this tutorial, we will familiarize you with the basic steps to analyzing your data with LISREL: Enter your raw data or covariance matrix into a data file Create a PRELIS2 command file to process (read and transform) the raw data Specify your models of interest Create a LISREL or SIMPLIS program file to test your models of interest Evaluate your LISREL output Section 2: Reading Raw Data Using PRELIS2 Structural equation models are statistical models of linear relationships among latent (unobserved) and manifest (observed) variables. LISREL requires the input of a correlation or covariance matrix. You can use PRELIS2 to prepare either of these matrices from your raw data file. You can read raw data using PRELIS2. The advantage of using PRELIS2 is that it is specifically formulated to handle both ordinal and continuously distributed variables. If you have a choice to use raw data or matrix data, raw data is usually the better choice because PRELIS2 can both analyze and process this data in ways that other programs cannot. Consider the following sample data file, taken from pages 1-19 of the PRELIS2 manual: 1 3 -.7 -.4 2 4 2.3 1.6 3 3 1.2 1.7 1 -9 -.4 -.3 3 2 -1.2 -.7 2 1 -9 1.2 2 1 .8 .3 3 3 1.6 1.5 1 2 -.9 -9 1 4 -.8 -.8 1 1 .7 .8 2 2 1.1 1.3 You can use the following PRELIS2 syntax to read this data. First PRELIS2 example program ! The first line of the program can be a title statement. 3 The Department of Statistics and Data Sciences, The University of Texas at Austin Getting Started with LISREL 8 and PRELIS 2 ! Comment statements start with exclamation marks, ! one per line. This example program is from the ! PRELIS2 manual, p. 4-3 DA NI=4 NO=12 MISSING=-9 TREATMENT=listwise RAW-DATA-FROM FILE=sample.data LABELS var1 var2 var3 var4 CONTINUOUS var1 var2 var3 var4 ! Output a polyserial correlation matrix ! OUTPUT MATRIX = PMATRIX SM=data.100pm ! Or you can output a Pearson correlation matrix ! if you prefer !OUTPUT MATRIX = KMATRIX SM=junk.km ! Or a covariance matrix OUTPUT MATRIX = CMATRIX SM=sample.cov The first line of this program is a title line. It will appear at the top of each page of the output file written by PRELIS2. A number of comment statements follow. Comment statements begin with the exclamation mark (!). Comment statements are ignored by LISREL as it processes the program; they are included to clarify the program's contents for human readers. These are recommended for the same reason title lines are useful: they help clarify complex portions of your programs that may not be clear to you or others who later read your programs. Unlike title lines, however, comments are not reproduced on the program's printed output. The DA line tells PRELIS2 that there are four items (NI = 4) and 12 observations (NO = 12) in the data file. Also, missing values are represented by -9 (MISSING = -9). TREATMENT = listwise tells PRELIS2 to use listwise data deletion when cases have missing values. Listwise deletion means that an entire case's values are deleted if the case has one or more missing values on any of the variables. Another popular option for TREATMENT is pairwise. Pairwise deletion means that missing data for one or both of a pair of variables are deleted, but the rest of the case's data are retained for analyses. If possible, listwise deletion of missing data is a safe approach if you are unsure which approach to take for handling missing data. However, using listwise deletion can significantly reduce the working sample size if many cases have missing data values. There are other missing values options beyond listwise and pairwise data deletion-see the PRELIS2 manual for details. The RAW-DATA-FROM FILE statement identifies the origin of the data. The LABELS statement labels the variables in the data file. The CONTINUOUS statement tells PRELIS2 which variables are to be treated as continuous data. ORDINAL is the default measurement level for all variables with 15 or fewer levels; CONTINUOUS is the default for variables with 16 or more levels. Depending upon the measurement level of each variable, you may choose to code the variable as CONTINUOUS or ORDINAL. According to the authors of the PRELIS2 manual, using ORDINAL coding for noncontinuous data will yield more appropriate results. See the detailed PRELIS2 example below for an example of this type of coding. IMPORTANT: If you use nonCONTINUOUS coding for ANY variable in your data file, PRELIS2 may produce results that do not agree with those generated by other software packages such as SAS and SPSS. 4 The Department of Statistics and Data Sciences, The University of Texas at Austin Getting Started with LISREL 8 and PRELIS 2 PRELIS2 allows you to output a number of different matrix formats. PM (polyserial) is the recommended correlation matrix format. However, choosing this format may result in output that differs from the output produced by other statistical software packages because PRELIS2 has been optimized to treat ordinal data as categorical rather than continuous. PRELIS2 can also output standard Pearson correlations--use the KM keyword to obtain these. Finally, the CM keyword will output a covariance matrix. Using LISTWISE missing-data deletion and treating all variables as continuously distributed yields the following covariance matrix. FIRST PRELIS2 EXAMPLE PROGRAM COVARIANCE MATRIX VAR1 VAR2 VAR3 VAR4 ________ ________ ________ ________ VAR1 .750 VAR2 .000 1.278 VAR3 .300 .103 1.428 VAR4 .362 .044 1.146 1.036 MEANS VAR1 VAR2 VAR3 VAR4 2.000 2.556 .556 .589 STANDARD DEVIATIONS VAR1 VAR2 VAR3 VAR4 .866 1.130 1.195 1.018 (Some output omitted) The covariance matrix, mean, and standard deviation values should match those produced by other statistical software. The output appears in the PRELIS2 output file. You can browse this file with a text editor. 2.1 A Detailed PRELIS2 Example The three data sets used throughout the tutorial are available here for download. You can copy the files to your own computer to practice using PRELIS2. In this example, the PRELIS2 syntax reads six variables from the raw data file "data.100". Second PRELIS2 Demonstration Program DA NI = 6 NO = 100 MISSING = -9 TREATMENT = PAIRWISE RAW-DATA-FROM FILE = DATA.100 LABELS CONTIN1 ORDINAL1 ORDINAL2 ORDINAL3 CONTIN2 ORDINAL4 CONTINUOUS CONTIN1 CONTIN2 ORDINAL ORDINAL1 - ORDINAL3 ORDINAL4 OUTPUT RA=data.100raw MATRIX = PMATRIX SM=data.100pm The title line begins the program. The next line is the DA, or DATA line. NI refers to the number of indicator or manifest variables (e.g., survey items). In this case, there are six such variables. NO is the number of observations (cases) in the dataset: 100. MISSING = -9 tells PRELIS2 that 5 The Department of Statistics and Data Sciences, The University of Texas at Austin Getting Started with LISREL 8 and PRELIS 2 the number -9 in the dataset represents missing values. TREATMENT = PAIRWISE tells PRELIS2 to delete missing data based on a pairwise deletion approach instead of a listwise method. The next line contains the RAW-DATA-FROM FILE statement. It tells PRELIS2 which data file to read. Notice that PRELIS2 assumes that the data are entered in free-field format, which means that each data value in the raw data file is separated by a space, and that spaces are not also used to represent missing data. You can abbreviate this command to RA if you wish. If you have data in a format different from free-field format, you must use a Fortran format statement to tell PRELIS2 how to read and correctly format the data file. Use of the Fortran format statement is shown in the third example, below. The LABELS statement labels each of the variables read from the data file. Notice that the LABELS keyword appears on one line of the PRELIS2 program; the actual labels for the six variables appear on the next line. The next statement is the CONTINUOUS statement. This statement tells PRELIS2 which variables it should treat as continuous variables. In this case, the labeled variables CONTIN1 and CONTIN2 are continuously distributed, so they are so marked with the CONTINUOUS statement. The ORDINAL statement is similar to the CONTINUOUS statement, except that it tells PRELIS2 to treat the variables ORDINAL1 through ORDINAL3, and ORDINAL4 as ordinal rather than continuous. Notice the hyphen (-) used to join contiguous variables in the CONTINUOUS and ORDINAL statements. In this instance, ORDINAL1 through ORDINAL3 are contiguous in the raw data file.