Session 1 1 Check installations 2 Open Mplus 3 Type basic commands 4 Get data read in, spat out &read in again 5 Run an analysis 6 What has it done?

Slides:



Advertisements
Similar presentations
Multilevel analysis with EQS. Castello2004 Data is datamlevel.xls, datamlevel.sav, datamlevel.ess.
Advertisements

I OWA S TATE U NIVERSITY Department of Animal Science Using Basic Graphical and Statistical Procedures (Chapter in the 8 Little SAS Book) Animal Science.
Structural Equation Modeling Using Mplus Chongming Yang Research Support Center FHSS College.
© Department of Statistics 2012 STATS 330 Lecture 32: Slide 1 Stats 330: Lecture 32.
Confirmatory factor analysis GHQ 12. From Shevlin/Adamson 2005:
SPSS Session 5: Association between Nominal Variables Using Chi-Square Statistic.
Mixture modelling of continuous variables. Mixture modelling So far we have dealt with mixture modelling for a selection of binary or ordinal variables.
Copyright © 2009 Pearson Education, Inc. Chapter 29 Multiple Regression.
Latent Growth Curve Modeling In Mplus:
Exploratory factor analysis GHQ-12. EGO GHQ-12 EFA 1) Assuming items are continuous Variable: Names are ghq01 ghq02 ghq03 ghq04 ghq05 ghq06 ghq07 ghq08.
Factor Analysis Purpose of Factor Analysis
Descriptive Statistics In SAS Exploring Your Data.
1 Chapter 3 Multiple Linear Regression Ray-Bing Chen Institute of Statistics National University of Kaohsiung.
CS1061 C Programming Lecture 2: A Few Simple Programs A. O’Riordan, 2004.
Examining Relationship of Variables  Response (dependent) variable - measures the outcome of a study.  Explanatory (Independent) variable - explains.
Raw data analysis S. Purcell & M. C. Neale Twin Workshop, IBG Colorado, March 2002.
C82MCP Diploma Statistics School of Psychology University of Nottingham 1 Linear Regression and Linear Prediction Predicting the score on one variable.
SPSS Statistical Package for the Social Sciences is a statistical analysis and data management software package. SPSS can take data from almost any type.
Introduction to SPSS Short Courses Last created (Feb, 2008) Kentaka Aruga.
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
Mixture Modeling Chongming Yang Research Support Center FHSS College.
Exploratory Factor Analysis in MPLUS
1 Binary Models 1 A (Longitudinal) Latent Class Analysis of Bedwetting.
Logistic Regression and Generalized Linear Models:
Confirmatory factor analysis
Statistics for the Social Sciences Psychology 340 Fall 2013 Thursday, November 21 Review for Exam #4.
Part 2 DIF detection in STATA. Dif Detect - Stata Developed by Paul Crane et al, Washington University based on Ordinal logistic regression (Zumbo, 1999)
© 2002 Prentice-Hall, Inc.Chap 14-1 Introduction to Multiple Regression Model.
1 Experimental Statistics - week 4 Chapter 8: 1-factor ANOVA models Using SAS.
2 nd Order CFA Byrne Chapter 5. 2 nd Order Models The idea of a 2 nd order model (sometimes called a bi-factor model) is: – You have some latent variables.
Categorical and Zero Inflated Growth Models Alan C. Acock* Summer, 2009 *Alan C. Acock, Department of Human Development and Family Sciences, Oregon State.
1 Experimental Statistics - week 2 Review: 2-sample t-tests paired t-tests Thursday: Meet in 15 Clements!! Bring Cody and Smith book.
Regression For the purposes of this class: –Does Y depend on X? –Does a change in X cause a change in Y? –Can Y be predicted from X? Y= mX + b Predicted.
Social patterning in bed-sharing behaviour A longitudinal latent class analysis (LLCA)
Estimation Kline Chapter 7 (skip , appendices)
Session 1 1 Check installations 2 Open Mplus 3 Type basic commands 4 Get data read in, spat out &read in again 5 Run an analysis 6 What has it done?
Numerical Statistics Given a set of data (numbers and a context) we are interested in how to describe the entire set without listing all the elements.
BUSI 6480 Lecture 8 Repeated Measures.
1 Parallel Models. 2 Model two separate processes which run in tandem Bedwetting and daytime wetting 5 time points: 4½, 5½, 6½,7½ & 9½ yrs Binary measures.
1 Differential Item Functioning in Mplus Summer School Week 2.
3.2 - Least- Squares Regression. Where else have we seen “residuals?” Sx = data point - mean (observed - predicted) z-scores = observed - expected * note.
Linear Discriminant Analysis (LDA). Goal To classify observations into 2 or more groups based on k discriminant functions (Dependent variable Y is categorical.
SEM Basics 2 Byrne Chapter 2 Kline pg 7-15, 50-51, ,
University Rennes 2, CRPCC, EA 1285
Estimation Kline Chapter 7 (skip , appendices)
Examples. Path Model 1 Simple mediation model. Much of the influence of Family Background (SES) is indirect.
ALISON BOWLING CONFIRMATORY FACTOR ANALYSIS. REVIEW OF EFA Exploratory Factor Analysis (EFA) Explores the data All measured variables are related to every.
ALISON BOWLING MAXIMUM LIKELIHOOD. GENERAL LINEAR MODEL.
Tutorial I: Missing Value Analysis
1 Statistics 262: Intermediate Biostatistics Regression Models for longitudinal data: Mixed Models.
Demonstration of SEM-based IRT in Mplus
G Lecture 71 Revisiting Hierarchical Mixed Models A General Version of the Model Variance/Covariances of Two Kinds of Random Effects Parameter Estimation.
Additional Regression techniques Scott Harris October 2009.
The SweSAT Vocabulary (word): understanding of words and concepts. Data Sufficiency (ds): numerical reasoning ability. Reading Comprehension (read): Swedish.
CMS SAS Users Group Conference Learn more about THE POWER TO KNOW ® October 17, 2011 Medicare Payment Standardization Modeling using SAS Enterprise Miner.
Data Screening. What is it? Data screening is very important to make sure you’ve met all your assumptions, outliers, and error problems. Each type of.
Data Entry, Coding & Cleaning SPSS Training Thomas Joshua, MS July, 2008.
Linear model. a type of regression analyses statistical method – both the response variable (Y) and the explanatory variable (X) are continuous variables.
Descriptive Statistics ( )
Latent Class Analysis Computing examples
BINARY LOGISTIC REGRESSION
Modeling in R Sanna Härkönen.
Structural Equation Modeling using MPlus
Correlation, Regression & Nested Models
DEPARTMENT OF COMPUTER SCIENCE
Confirmatory factor analysis
Simple Linear Regression
Rachael Bedford Mplus: Longitudinal Analysis Workshop 23/06/2015
SEM: Step by Step In AMOS and Mplus.
Presentation transcript:

Session 1 1 Check installations 2 Open Mplus 3 Type basic commands 4 Get data read in, spat out &read in again 5 Run an analysis 6 What has it done?

Session 2 1 Mplus input file command structures 2 Mplus conventions 3 Mplus punctuation CaSeS ; : (.) & green! 4 Common typos in input 5 Mplus output file structure 6 Output options inc. saves and plots

Session 1 1 Check installations 2 Open Mplus 3 Type basic commands 4 Get data read in, spat out &read in again 5 Run an analysis 6 What has it done?

Odd1 Even1 Sum1 Case1 Odd2 Even2 Sum2 Case XXXX XXXX1234 DATA: Dunn Statistics in Psychiatry GHQ12 T1 T2 Clinical Psychology students General Health Questionnaire Short self-report questionnaire Used to screen for common mental Disorder (anxiety and depression)

Warning, detour ahead …

Getting (past) the basics … The importance of total control over data The value of learning simple FORTRAN formatting statements –LISCOMP, the predecessor to Mplus, –And Mplus itself, is written in FORTRAN Reading data in uses simple conventions F / I / G / E / X / T – could be read as F6 –92 read as F2.1 would be 9.1 »Width in columns for the real number »then number of numerals that appear after the decimal point

Overcoming limitations Of the Mplus demo –It has a limit on the number of variables Depending on what analysis you are doing these limits are –4 variables –6 variables We shall (largely) work within them –But we can also beat them to make life easier for you

FORTRAN FORMAT STATEMENTS I X T and / –I1 Integer single digit –4X skip four columns without reading anything –Can jump over data in the middle of a file this way »i.e. columns in text files can be ignored –T10 Jump from first column to and start reading at column ten, then process rest of format instructions –Can jump over data at the start of a file this way –/ is to jump to next line (when data has more “records” lines of data per individidual) rather than

Dunn SiP Book GHQ12 from clinical psychology students Odd1 Even1 Sum1 Case1 Odd2 Even2 Sum2Case | | | | | | | | | | | | Numbered columns for field widths (guide for eye and FORTRAN SYNTAX) F5 F5 F5 F6 F5 F6 F5 F5 i.e (3F5,F6,F5,F6,2F5) Specifications for formatted input some F5 some F6

End of detour …

Analysis time Time to begin! –A first orientation to Mplus in action Data Input file syntax Output Plot Actually just doing data transformation at this stage –Not doing any analysis

Odd1 Even1 Sum1 Case1 Odd2 Even2 Sum2 Case XXXX XXXX1234 DATA: Dunn Statistics in Psychiatry GHQ12 T1 T2 Clinical Psychology students General Health Questionnaire Short self-report questionnaire Used to screen for common mental Disorder (anxiety and depression)

DATA: FILE IS "c:\dunn_ghqoddeven12.dat"; FORMAT IS I4 I4 4x I4 I4 I4 4x I4; Odd1 Even1 Sum1 Case1 Odd2 Even2 Sum2 Case

DATA: FILE IS "c:\dunn_ghqoddeven12.dat"; FORMAT IS I4 I4 4x I4 I4 I4 4x I4; DEFINE: sum1 = odd1 + even1; diff1= odd1 - even1; !sum2 = odd2 + even2; !diff2= odd2 - even2; VARIABLE: NAMES ARE odd1 even1 case1 odd2 even2 case2; **File actually contains SUM1 & SUM2 variables** USEVARIABLES ARE sum1 diff1; Odd1 Even1 Sum1 Case1 Odd2 Even2 Sum2 Case This file is dunn_GHQ12_T1T2_ClinPsych_SiP.inp WARNING - more syntax below in the file estimates a correlation and produces a scatter plot

ANALYSIS: ESTIMATOR=ML; MODEL: sum1 with diff1; !sum1 with diff1 sum2 diff2; ! diff1 with sum2 diff2; ! sum2 with diff2; OUTPUT: STDY SAMPSTAT; PLOT: TYPE IS PLOT1; Odd1 Even1 Sum1 Case1 Odd2 Even2 Sum2 Case This file is dunn_GHQ12_T1T2_ClinPsych_SiP.inp

ANALYSIS: ESTIMATOR=ML; MODEL: sum1 with diff1; !sum1 with diff1 sum2 diff2; ! diff1 with sum2 diff2; ! sum2 with diff2; OUTPUT: STDY SAMPSTAT; PLOT: TYPE IS PLOT1; This file is dunn_GHQ12_T1T2_ClinPsych_SiP.inp

SUMMARY OF ANALYSIS [ dunn_GHQ12_T1T2_ClinPsych_SiP.out] Number of groups 1 Number of observations 12 Number of dependent variables 2 Number of independent variables 0 Number of continuous latent variables 0 Observed dependent variables Continuous SUM1 DIFF1

[ dunn_GHQ12_T1T2_ClinPsych_SiP.out] Estimator ML Information matrix OBSERVED Maximum number of iterations 1000 Convergence criterion 0.500D-04 Maximum number of steepest descent iterations 20 Input data file(s) c:\dunn_ghqoddeven12.dat Input data format (I4 I4 4X I4 I4 I4 4X I4) [dunn_GHQ12_T1T2_ClinPsych_SiP.out]

SAMPLE STATISTICS [ dunn_GHQ12_T1T2_ClinPsych_SiP.out] Means SUM1 DIFF1 ________ ________ Covariances SUM1 DIFF1 ________ ________ SUM DIFF Correlations SUM1 DIFF1 ________ ________ SUM DIFF [dunn_GHQ12_T1T2_ClinPsych_SiP.out]

THE MODEL ESTIMATION TERMINATED NORMALLY TESTS OF MODEL FIT Chi-Square Test of Model Fit Value Degrees of Freedom 0 P-Value Chi-Square Test of Model Fit for the Baseline Model Value Degrees of Freedom 1 P-Value CFI/TLI CFI TLI Loglikelihood H0 Value H1 Value [dunn_GHQ12_T1T2_ClinPsych_SiP.out]

MODEL RESULTS Two-Tailed Estimate S.E. Est./S.E. P-Value SUM1 WITH DIFF Means SUM DIFF Variances SUM DIFF STANDARDIZED MODEL RESULTS STDY Standardization Two-Tailed Estimate S.E. Est./S.E. P-Value SUM1 WITH DIFF Means SUM DIFF Variances SUM DIFF [dunn_GHQ12_T1T2_ClinPsych_SiP.out]

[dunn_GHQ12_T1T2_ClinPsych_SiP.out/gph]

Session 2 1 Mplus input file COMMAND STRUCTURES: 2 Mplus conventions 3 Mplus punctuation ; : (.) & green! comment 4 Common typos in input 5 Mplus output file structure 6 Output options inc. saves and plots

TITLE: DATA: VARIABLE: DEFINE: ANALYSIS: MODEL: OUTPUT: SAVEDATA: PLOT: Command Structures Simple command structures can be built from the GUI

Main command structures appear first on lines as BLOCK CAPS: OTHER COMMANDS THEN FOLLOW either IN CAPS or lowercase; All lines end with a ; but lines can run over more than one line and end with a colon; Conventions

We’ve seen this already … TITLE: DATA: VARIABLE: DEFINE: ANALYSIS: MODEL: OUTPUT: SAVEDATA: PLOT: Mplus does not mind which Order commands come in …. You do not need them all! Actually you can do a lot With a little!

Mplus is not CaSe SeNsItIvE ! Exclamations - are like comment statements, the editor turns them green

All lines end with a semi-colon The most common typo is probably omitting one of these or typing two;;

{ ( [ Mplus parameters } ) } Variancesor Residual Variances –Variable name without brackets [Means]or Thresholds [catvar$1] –Variable name in square brackets (round brackets) –Variable name in round brackets {Scale factors} –Variable name in curly brackets

Mplus output file structure- has to be seen to be believed! OUTPUT: options here govern what you will see in the text output file; SAVEDATA: options here will determine what else is saved in new text files; PLOT: options here will enable you to view graphs of certain things;

OUTPUT: and PLOT: OUTPUT: !many more! SAMP STAND RES ! short for residuals) MOD (number) CINT !(three types) TECHn !(14 types-no’s 1 to 14) FSCOEFF FSDETERMINACY + a few more … don’t forget that final colon; PLOT: TYPE IS PLOT1 PLOT2 or PLOT3; ! That’s about it

SAVEDATA: You can save –You data (the subset of variables that you modelled only, or these variables plus some more that you want to keep even though you did not use them e.g. IDVARIABLE a subid or AUXILIARY other variables such as sex etc. You can also save –Factor scores (appended to your data) –Latent class memberships –Cook’s distances or “influence” statistics There are also other things you can save …. –These depend on what analysis you have constructed

Watch out for the GUI spot here ….. (if you want it)

Watch out for the GUI-2

GUI doesn’t build this part … V1 F1 V2V3V4 F2 E1 E2 E3 E4

GHQ T1 T2 Psychological Distress Odd 1 GHQ T1 Even 1 Odd 2 Even 2 GHQ T2 E1 E2 E3 E4 Correlation Among GHQ scores at T1 and T2 (could be regression)

Acronyms / Abbreviations / Fit Chi-Square [Pearson and Likelihood Ratio] CFI/TLI Loglikelihood H0 Value H1 Value Information Criteria Akaike (AIC) Bayesian (BIC) Sample-Size Adjusted BIC (n* = (n + 2) / 24) RMSEA Root Mean Square Error Of Approximation SRMR Standardized Root Mean Square Residual

TITLE: Dunn SiP Book GHQ12 from clinical psychology students Odd1 Even1 Sum1 Case1 Odd2 Even2 Sum2 Case DATA: FILE IS "c:\dunn_ghqoddeven12.dat"; FORMAT IS I4 I4 4x I4 I4 I4 4x I4; VARIABLE: NAMES ARE odd1 even1 case1 odd2 even2 case2; USEVARIABLES ARE odd1 even1 odd2 even2;

Out and back: Bob the (re)-builder walk through Reading data with a fixed format –Same kind of data now, bigger dataset –Do an analysis and save data –Then read back in formatted –hals_ighq.inp Then –read_savehalstxt.inp

“Passing out” variables [ quick2_rebuild2.inp ] DATA: FILE IS c:\halsghq3.dat; VARIABLE: NAMES ARE GHQ22 GHQ24 GHQ28 AGEYRS IDNUM SEXM1F2; USEVARIABLES ARE AGEYRS GHQ22 GHQ24 GHQ28; CATEGORICAL ARE GHQ22 GHQ24 GHQ28; IDVARIABLE = IDNUM; AUXILIARY = SEXM1F2; MODEL: IGHQ BY GHQ22 GHQ24 GHQ28;!define IGHQ measured BY 3vars IGHQ ON AGEYRS; !Here regressing latent factor ON age SAVEDATA: FILE IS savedata.txt; Little words IS/ARE are optional

HALSGHQ3.DAT "halsGHQ3.dat“ GHQ22 GHQ24 GHQ28 AGEYRS IDNUM SEXM1F2

Output. SUMMARY OF ANALYSIS Number of groups 1 Number of observations 6553 Number of dependent variables 3 Number of independent variables 1 Number of continuous latent variables 1 Observed dependent variables Binary and ordered categorical (ordinal) GHQ22 GHQ24 GHQ28 Observed independent variables AGEYRS Observed auxiliary variables SEXM1F2 Continuous latent variables IGHQ Variables with special functions ID variable IDNUM

SAVEDATA INFORMATION Order and format of variables GHQ22 F10.3 GHQ24 F10.3 GHQ28 F10.3 AGEYRS F10.3 IDNUM I6 SEXM1F2 F10.3 Save file savedata.txt Save file format 4F10.3 I6 F10.3 Save file record length 5000 Output

Quick2rebuildout.out INPUT READING TERMINATED NORMALLY SUMMARY OF ANALYSIS Number of groups 1 Number of observations 6553 Number of dependent variables 3 Number of independent variables 1 Number of continuous latent variables 1 Observed dependent variables Binary and ordered categorical (ordinal) GHQ22 GHQ24 GHQ28 Observed independent variables AGEYRS Observed auxiliary variables SEXM1F2 Continuous latent variables IGHQ Variables with special functions ID variable IDNUM

Quick2rebuildout.out (cont) Estimator WLSMV Maximum number of iterations 1000 Convergence criterion 0.500D-04 Maximum number of steepest descent iterations 20 Parameterization DELTA Input data file(s) c:\halsghq3.dat Input data format FREE

Quick2rebuildout.out SUMMARY OF CATEGORICAL DATA PROPORTIONS GHQ22 Category Category Category Category GHQ24 Category Category Category Category GHQ28 Category Category Category Category

Quick2rebuildout.out MODEL ESTIMATION TERMINATED NORMALLY :TESTS OF MODELFIT Chi-Square Test of Model Fit Value * Degrees of Freedom 2** P-Value Chi-Square Test of Model Fit for the Baseline Model Value Degrees of Freedom 4 P-Value CFI/TLI CFI TLI Number of Free Parameters 13 RMSEA (Root Mean Square Error Of Approximation) Estimate WRMR (Weighted Root Mean Square Residual) Value 0.812

Quick2rebuildout.out MODEL RESULTS Two-Tailed Estimate S.E. Est./S.E. P-Value IGHQ BY GHQ GHQ GHQ IGHQ ON AGEYRS Thresholds GHQ22$ GHQ22$ GHQ22$ GHQ24$ GHQ24$ GHQ24$ GHQ28$ GHQ28$ GHQ28$ Residual Variances IGHQ

Quick2rebuildout.out R-SQUARE Observed Residual Variable Estimate Variance GHQ GHQ GHQ Latent Variable Estimate IGHQ QUALITY OF NUMERICAL RESULTS Condition Number for the Information Matrix 0.967E-04 (ratio of smallest to largest eigenvalue) Beginning Time: 05:51:15 Ending Time: 05:51:17 Elapsed Time: 00:00:02

Time for some constraints & F by y1*1 (1) y2 (1); F1 by i1 i2 (10) i3 i4 (11); … can be words not numbers