Converting an SPSS Data File to Mplus. by Paul F. Tremblay September 2013



Similar documents
Before LISREL: Preparing the Data using PRELIS

Specification of Rasch-based Measures in Structural Equation Modelling (SEM) Thomas Salzberger

A Brief Introduction to SPSS Factor Analysis

There are six different windows that can be opened when using SPSS. The following will give a description of each of them.

Stephen du Toit Mathilda du Toit Gerhard Mels Yan Cheng. LISREL for Windows: PRELIS User s Guide

What's New in ADP Reporting?

Importing Data from a Dat or Text File into SPSS

2: Entering Data. Open SPSS and follow along as your read this description.

Chapter 7 Factor Analysis SPSS

SPSS (Statistical Package for the Social Sciences)

SPSS: Getting Started. For Windows

Time Clock Import Setup & Use

January 26, 2009 The Faculty Center for Teaching and Learning

Importing and Exporting With SPSS for Windows 17 TUT 117

SPSS for Windows importing and exporting data

CHAPTER 3 EXAMPLES: REGRESSION AND PATH ANALYSIS

R Graphics Cookbook. Chang O'REILLY. Winston. Tokyo. Beijing Cambridge. Farnham Koln Sebastopol

Create Custom Tables in No Time

Stephen du Toit Mathilda du Toit Gerhard Mels Yan Cheng. LISREL for Windows: SIMPLIS Syntax Files

Mplus Tutorial August 2012

Coupling Microsoft Excel with NI Requirements Gateway

How To Read Data Files With Spss For Free On Windows (Spss)

Introduction to PASW Statistics

How To Write A File System On A Microsoft Office (Windows) (Windows 2.3) (For Windows 2) (Minorode) (Orchestra) (Powerpoint) (Xls) (

Using SPSS, Chapter 2: Descriptive Statistics

Factor Analysis Using SPSS

Missing Data: Part 1 What to Do? Carol B. Thompson Johns Hopkins Biostatistics Center SON Brown Bag 3/20/13

SPSS and AM statistical software example.

2.1 Data Collection Techniques

Microsoft Office. Mail Merge in Microsoft Word

SPSS Resources. 1. See website (readings) for SPSS tutorial & Stats handout

Data analysis process

Binary Logistic Regression

Introduction to SAS Informats and Formats

Tutorial #7A: LC Segmentation with Ratings-based Conjoint Data

Best Practice Guidelines for Internet and Telephone Banking Providers. For services to personal customers

Advanced Excel 10/20/2011 1

NCSS Statistical Software

Craig K. Enders Arizona State University Department of Psychology

Appendix III: SPSS Preliminary

Top 10 Things to Know about WRDS

A REVIEW OF CURRENT SOFTWARE FOR HANDLING MISSING DATA

IBM SPSS Missing Values 22

Step 2: Save the file as an Excel file for future editing, adding more data, changing data, to preserve any formulas you were using, etc.

Notepads Import File Specification

Making the MDM file. cannot

Directions for Frequency Tables, Histograms, and Frequency Bar Charts

A Review of Methods. for Dealing with Missing Data. Angela L. Cool. Texas A&M University

CHAPTER 12 EXAMPLES: MONTE CARLO SIMULATION STUDIES

This chapter will demonstrate how to perform multiple linear regression with IBM SPSS

Automatic data recovery

APPLIED MISSING DATA ANALYSIS

The Beginning Balance for Meal Plan #1 is: $ (Your daily average should be $2.96)

7 Time series analysis

Analyzing Structural Equation Models With Missing Data

Installing R and the psych package

GETTING YOUR DATA INTO SPSS

SPSS Introduction. Yi Li

Reading Delimited Text Files into SAS 9 TS-673

Chapter 2 Introduction to SPSS

Data Cleaning and Missing Data Analysis

Using Microsoft Excel to Manage and Analyze Data: Some Tips

Microsoft Access Rollup Procedure for Microsoft Office Click on Blank Database and name it something appropriate.

Basic Pivot Tables. To begin your pivot table, choose Data, Pivot Table and Pivot Chart Report. 1 of 18

ELFRING FONTS UPC BAR CODES

SPSS Tutorial, Feb. 7, 2003 Prof. Scott Allard

Analysis of categorical data: Course quiz instructions for SPSS

Directions for using SPSS

Introduction to SPSS 16.0

Statistical Analysis Using SPSS for Windows Getting Started (Ver. 2014/11/6) The numbers of figures in the SPSS_screenshot.pptx are shown in red.

Using Microsoft Access Databases

Technical Paper. Reading Delimited Text Files into SAS 9

SPSS The Basics. Jennifer Thach RHS Assessment Office March 3 rd, 2014

Introduction to Using SPSS Command Files

Person Inquiry Screen

SPSS Explore procedure

Simple Linear Regression, Scatterplots, and Bivariate Correlation

MILWAUKEE COUNTY APPLICANT TRACKING SYSTEM USER GUIDE

1 Organizing time series in Matlab structures

Resources You can find more resources for Sync & Save at our support site:

IBM SPSS Missing Values 20

Importing and Exporting Databases in Oasis montaj

Access 2010 Intermediate Skills

Client Marketing: Sets

Psych. Research 1 Guide to SPSS 11.0

QPM Lab 2: Data Visualization & Descriptive Statistics in R and R Commander

Multidimensional Scaling (MDS) Presentation

Helpful Information is found at this page:

Creating Raw Data Files Using SAS. Transcript

Everything you wanted to know about using Hexadecimal and Octal Numbers in Visual Basic 6

10. Comparing Means Using Repeated Measures ANOVA

Merging Labels, Letters, and Envelopes Word 2013

HOMEWORK # 2 SOLUTIO

Paper An Introduction to SAS PROC SQL Timothy J Harrington, Venturi Partners Consulting, Waukegan, Illinois

Background Who are AddressWorks? How do I get a Statement of Accuracy? Data Cleansing Frequently asked Questions...

Transcription:

Converting an SPSS Data File to Mplus by Paul F. Tremblay September 2013 Types of Data Files There are two types of ASCII data files that can be considered. They are referred to as delimited (free) and fixed width formats respectively. A Delimited file is one that separates the data by some form of delimiter such as a tab, space, or comma. An example of a Delimited file involving four subjects (one per line) and five variables is presented below. In this example, the data are separated by one space. In SPSS although the data is typically saved as an SPSS data file with an.sav extension, it is also possible to save the data as a delimited ASCII file that can be read in other programs. 1 2 3 4 5 12 5 167 1 14 1 23 4 12 6 40 21 23 6 19 A Fixed width file contains the values in specific defined fields. Assume, for example, that an individual had typed the above text file in a series of three column fields so that the first variable was in columns 1 to 3, the next in columns 4 to 6, etc. The same values as shown above would appear as: 1 2 3 4 5 12 5167 1 14 1 23 4 12 6 40 21 23 6 19 Note that the entries are right justified in that each value ends on the column to the right of the specification indicated, and it isn t even necessary to have a space between the variables. The values line up on the right hand side. (As a minor point, it should be noted that although the example had all the variables in 3 column fields, it is not necessary to have the field widths identical. What is important is that the values be right justified in their fields. So as an example, for the four subjects above, the values of the second variable would be 2, 5, 23, 21. The values for the third variable would be 3, 167, 4, 23.) Converting Data File from SPSS to Mplus using a Delimited Format Make sure that all your values are numeric. For example if you had a variable Gender coded as M or F, you should recode with number such as 1 and 0. Note also that in SPSS, variable names can be longer than eight characters. In Mplus the limit is eight characters, and Mplus will simply append variables names that are too long. We start with a data file in SPSS that has some missing values that have not been coded in any special way. For example a participant might have missed a question, and therefore a blank space rather than a value is assigned to that data point. These are referred to as system missing unlike other missing value codes that you could have assigned. In this latter case, a researcher may have typed in the data manually and decided to put in a special code of -9 when a participant was missing a data point. Then

the researcher would need to define the missing variable code as -9 in SPSS. This can be done the following way in SPSS: However in our example below, we will recode the system missing values into a code -9 to ensure that are missing values are interpreted correctly in the translation to Mplus. The syntax in SPSS is: RECODE v1 v2 v3 (SYSMIS=-9) (else=copy). EXECUTE.

Now we can see that the blank spaces are coded with a -9 in the screen below. I now save the SPSS file as a tab delimited file. The file name has a.dat extension (in my example the full name is test.dat). You should probably remove the checkmark (see below) so that your variable names do not appear in the data file. Otherwise you will need to remove these labels from your data file (see below). If you open this file in Notepad it looks like the following screen. Because I left the checkmark in the previous screen, my variable names appear with the data and need to be removed. (You could cut these variable names and paste them in the mplus syntax file in the statement listing your variables. Note that you will need to shorten variable names longer than 8 characters or Mplus will append them).

The syntax file for Mplus is presented below. TITLE: First example of setting up data file DATA: file is test.dat;!listwise = on; VARIABLE: names are v1 v2 v3; missing all (-9); usevariables = v1; ANALYSIS: type = basic; Note that we have provided the statement to define missing values with the statement missing all (-9);. If you forget this statement, Mplus would read your data incorrectly. You can use more than one missing value code if needed. See Mplus manual for examples. The analysis: type = basic; statement will give you descriptive statistics without testing any model. Note also the statement uservariables = v1;. Here I will get information only for v1. I will bring in the other two variables in a subsequent example. The Mplus output follows: *** WARNING Data set contains cases with missing on all variables. These cases were not included in the analysis. Number of cases with missing on all variables: 1 1 WARNING(S) FOUND IN THE INPUT INSTRUCTIONS First example of using different data file formats SUMMARY OF ANALYSIS Number of groups 1 Number of observations 9 Number of dependent variables 1 Number of independent variables 0 Number of continuous latent variables 0 Observed dependent variables Continuous Estimator ML Information matrix OBSERVED Maximum number of iterations 1000 Convergence criterion 0.500D-04 Maximum number of steepest descent iterations 20 Maximum number of iterations for H1 2000 Convergence criterion for H1 0.100D-03 Input data file(s) test1.txt

Input data format FREE SUMMARY OF DATA Number of missing data patterns 1 SUMMARY OF MISSING DATA PATTERNS MISSING DATA PATTERNS (x = not missing) 1 x MISSING DATA PATTERN FREQUENCIES Pattern Frequency 1 9 COVARIANCE COVERAGE OF DATA Minimum covariance coverage value 0.100 PROPORTION OF DATA PRESENT Covariance Coverage 1.000 RESULTS FOR BASIC ANALYSIS ESTIMATED SAMPLE STATISTICS Means 1 17.667 Covariances 208.889 Correlations 1.000 Note in the above output that Mplus estimates missing values using maximum likelihood. In the above example however, it does not estimate missing values because there are no other variables in the analysis, from which to borrow information. So the statistics for v1 will be estimated on nine cases and will correspond to descriptive statistics in SPSS. If we bring in the other two variables, v2, v3, however, missing values will be estimated with the information from all variables. You can see in the output below that Mplus reports 10 cases for the

analyses (i.e., no cases are dropped out). Mplus also shows the patterns of missing data. The statistics for the three variables will now be different than statistics calculated in listwise or pairwise data. If you want a listwise analysis, you can specify a listwise statement as indicated above (by removing the exclamation mark in the syntax statement,!listwise = on;). SUMMARY OF DATA Number of missing data patterns 4 SUMMARY OF MISSING DATA PATTERNS MISSING DATA PATTERNS (x = not missing) 1 2 3 4 x x x V2 x x V3 x x x MISSING DATA PATTERN FREQUENCIES Pattern Frequency Pattern Frequency Pattern Frequency 1 6 3 1 2 2 4 1 COVARIANCE COVERAGE OF DATA Minimum covariance coverage value 0.100 PROPORTION OF DATA PRESENT Covariance Coverage V2 V3 0.900 V2 0.800 0.800 V3 0.700 0.600 0.800 RESULTS FOR BASIC ANALYSIS ESTIMATED SAMPLE STATISTICS Means V2 V3 1 15.158 129.911 4.149 Covariances V2 V3 258.612 V2-1335.259 30544.906 V3 11.306-91.992 1.076 Correlations V2 V3 1.000 V2-0.475 1.000 V3 0.678-0.507 1.000