Newsom Structural Equation Modeling Winter 2015 1 Path Analysis Example Mplus (output excerpts) Note: I use the bootstrap approach here for testing the indirect effect. The bootstrap approach will generally produce preferable standard errors for the indirect effect test, but we will come back to this technique later. Mplus VERSION 7.3 MUTHEN & MUTHEN 01/14/2015 9:32 PM INPUT INSTRUCTIONS title: Data from social exchanges pretest; data: file=path1.dat; listwise=on; format=free; variable: names = sex hostile negaff; missing = sex-negaff (-99); ! analysis: type=basic; analysis: type=general; estimator=ml; matrix=covariance; bootstrap = 1000; ! at least 500 bootstrap samples are recommended; model: hostile on sex; negaff on hostile sex; Model indirect: negaff ind sex; output: stdyx ; !* cinterval can be added to the output line to obtain confidence intervals for indirect effects but I omitted here to save space. cinterval(bcbootstrap) obtains bias-corrected bootstrap intervals for nonsymmetric sampling distribution*! INPUT READING TERMINATED NORMALLY Data from social exchanges pretest; SUMMARY OF ANALYSIS Number of groups Number of observations 1 271 Number of dependent variables Number of independent variables Number of continuous latent variables 2 1 0 Estimator ML THE MODEL ESTIMATION TERMINATED NORMALLY MODEL FIT INFORMATION Number of Free Parameters 7 Loglikelihood H0 Value H1 Value -550.577 -550.577 Information Criteria Akaike (AIC) Bayesian (BIC) Sample-Size Adjusted BIC (n* = (n + 2) / 24) 1115.154 1140.369 1118.174 Chi-Square Test of Model Fit Value Degrees of Freedom P-Value 0.000 0 0.0000 Newsom Structural Equation Modeling Winter 2015 MODEL RESULTS 2 Two-Tailed P-Value Estimate S.E. Est./S.E. 0.006 0.077 0.078 0.938 NEGAFF ON HOSTILE SEX 0.344 -0.125 0.090 0.087 3.846 -1.435 0.000 0.151 Intercepts HOSTILE NEGAFF 0.578 1.603 0.054 0.089 10.761 18.054 0.000 0.000 Residual Variances HOSTILE 0.405 NEGAFF 0.493 STANDARDIZED MODEL RESULTS 0.054 0.053 7.424 9.339 0.000 0.000 HOSTILE SEX ON StdYX Estimate HOSTILE SEX ON 0.005 NEGAFF ON HOSTILE SEX 0.297 -0.084 Intercepts HOSTILE NEGAFF 0.909 2.172 R-SQUARE Observed Variable Estimate HOSTILE 0.000 NEGAFF 0.095 TOTAL, TOTAL INDIRECT, SPECIFIC INDIRECT, AND DIRECT EFFECTS Two-Tailed Estimate S.E. Est./S.E. P-Value Effects from SEX to NEGAFF Total -0.123 Total indirect 0.002 0.090 0.028 -1.360 0.075 0.174 0.940 0.002 0.028 0.075 0.940 -0.125 0.087 -1.435 0.151 Specific indirect NEGAFF HOSTILE SEX Direct NEGAFF SEX Sample write-up: To investigate whether hostility mediates the relation between gender and negative affect, a path model was tested using Mplus Version 7.3 (Muthen & Muthen, 1998-2012). Results indicated that, although hostility significantly predicted negative affect (β = .344, SE = .090, β* = .297, p < .001), gender was not significantly related to hostility (β = .006, SE = .077, β* = .005, ns). As would be expected from these results, the indirect effect tested using bootstrapped standard errors was also nonsignficant (β = .002, SE = .028, β* = .001, ns). (Note: The standardized indirect coefficient was deleted from the output). These findings do not support the hypothesized mediational model. Muthén, L.K. and Muthén, B.O. (1998-2012). Mplus User’s Guide. Seventh Edition. Los Angeles, CA: Muthén & Muthén Newsom Structural Equation Modeling Winter 2015 3 lavaan (output excerpts) Input library(lavaan) # always call lavaan library first # first time use on the computer, install the lavaan package with the following command # install.packages("lavaan", dependencies=TRUE) ## Path Example for Newsom's SEM Class path1 = read.table ("c:/jason/R/lavaan/semclass/path1.dat", header=FALSE) # read the raw data names(path1) = c("sex", "hostile", "negaff") # name the variables (must be in the correct order) path1[path1 == -99] <- NA # tells R that -99 is missing (NA is the missing designation) model = ' negaff ~ c*sex hostile ~ a*sex negaff ~ b*hostile # note that all the model commands are enclosed single quotes #indirect effect ab := a*b #total effect total := c + (a*b) ' fit = sem(model, data = path1, missing = 'listwise',se = 'bootstrap') summary(fit,fit.measures=TRUE, rsquare=TRUE, standardized=TRUE) Output lavaan (0.5-17) converged normally after 14 iterations Used 271 Number of observations Estimator Minimum Function Test Statistic Degrees of freedom Total 275 ML 0.000 0 Parameter estimates: Information Standard Errors Number of requested bootstrap draws Number of successful bootstrap draws Regressions: negaff ~ sex hostile ~ sex negaff ~ hostile Estimate Std.err Z-value P(>|z|) Std.lv Std.all (c) -0.125 0.086 -1.453 0.146 -0.125 -0.084 (a) 0.006 0.079 0.076 0.939 0.006 0.005 (b) 0.344 0.089 3.887 0.000 0.344 0.297 0.493 0.405 0.054 0.055 0.493 0.405 0.905 1.000 0.002 -0.123 0.028 0.091 0.002 -0.123 0.001 -0.082 Variances: negaff hostile Defined parameters: ab total R-Square: negaff hostile Observed Bootstrap 1000 1000 0.095 0.000 0.074 -1.351 0.941 0.177 Newsom Structural Equation Modeling Winter 2015 4 Amos (excerpts) Note: this analysis, conducted with Version 22. Estimates (Group number 1 - Default model) Analysis Summary Date and Time Date: Wednesday, January 14, 2015 Time: 10:55:45 PM Title path1_15: Wednesday, January 14, 2015 10:55 PM Scalar Estimates (Group number 1 - Default model) Maximum Likelihood Estimates Regression Weights: (Group number 1 - Default model) Estimate S.E. C.R. P hostile <--- sex .006 .078 .077 .938 negaff <--- hostile .344 .067 5.127 *** negaff <--- sex -.125 .086 -1.446 .148 Label Standardized Regression Weights: (Group number 1 - Default model) Estimate hostile <--- sex .005 negaff <--- hostile .297 negaff <--- sex -.084 Means: (Group number 1 - Default model) Estimate S.E. C.R. P sex .565 .030 18.711 *** Intercepts: (Group number 1 - Default model) Estimate S.E. C.R. P hostile .578 .059 9.860 *** negaff 1.602 .076 21.221 *** Label Label Variances: (Group number 1 - Default model) Estimate S.E. C.R. P Label sex .246 .021 11.619 *** e1 .405 .035 11.619 *** e2 .493 .042 11.619 *** Squared Multiple Correlations: (Group number 1 - Default model) Estimate hostile .000 negaff .095 Newsom Structural Equation Modeling Winter 2015 5 Matrices (Group number 1 - Default model) Total Effects (Group number 1 - Default model) sex hostile hostile .006 .000 negaff -.123 .344 Standardized Total Effects (Group number 1 - Default model) sex hostile hostile .005 .000 negaff -.082 .297 Direct Effects (Group number 1 - Default model) sex hostile hostile .006 .000 negaff -.125 .344 Standardized Direct Effects (Group number 1 - Default model) sex hostile hostile .005 .000 negaff -.084 .297 Indirect Effects (Group number 1 - Default model) sex hostile hostile .000 .000 negaff .002 .000 Standardized Indirect Effects (Group number 1 - Default model) sex hostile hostile .000 .000 negaff .001 .000 Negative Smallest Iteration Condition # Diameter eigenvalues eigenvalue 0 e 0 26.858 9999.000 1 e 0 35.946 .448 2 e 0 31.246 .126 3 e 0 30.455 .050 4 e 0 30.188 .006 5 e 0 30.498 .000 F NTries Ratio 38.116 8.562 .598 .007 .000 .000 0 1 1 1 1 1 9999.000 .669 1.142 1.068 1.009 1.000