Using MX for SEM analysis - PowerPoint PPT Presentation

1 / 43
About This Presentation
Title:

Using MX for SEM analysis

Description:

Using MX for SEM analysis – PowerPoint PPT presentation

Number of Views:79
Avg rating:3.0/5.0
Slides: 44
Provided by: cjt1
Learn more at: https://www.econ.upf.edu
Category:

less

Transcript and Presenter's Notes

Title: Using MX for SEM analysis


1
Using MX for SEM analysis
2
Using Lisrel
Analysis of Reader Reliability in Essay Scoring
Votaw's Data Tau-Equivalent Model DA NI4
NO126 LA ORIGPRT1 WRITCOPY CARBCOPY
ORIGPRT2 CM 25.0704 12.4363 28.2021 11.7257
9.2281 22.7390 20.7510 11.9732 12.0692 21.8707 MO
NX4 NK1 LXFR PHST LK Esayabil EQ LX(1) -
LX(4) PD OU
3
The models in Mx
  • A path diagram consists of four basic types of
    object circles, squares, one-headed and
    two-headed arrows.
  • These correspond to the following basic concepts
    of statistical multivariate modeling
  •  
  • Two types of variables observed (in squares),
    non-observed (in circles)
  •  
  • Two types of relationship between variables are
    possible causal (one headed arrow) and
    correlational (two-headed arrow).
  •  
  • The RAM specification (McArdle and Boker, 1990)
    involves three matrices F, A and S.
  •  
  • S is for the symmetric paths (two-headed,
    correlational), F is the filtering the set of
    observed variables out of the whole set.
  • A is for the asymmetric paths (one-headed arrows,
    causal).
  •  
  • z F v
  • v A v e ---gt v (I A )-1 e
  •  
  • The covariance matrix of z, Cov (z), is
    structured as
  •  
  • Cov (z) F (I A )-1 S ((I A )-T F
  •  

4
Matrix calculator
xxx.mx file
Open Mx     Just as a matrix computator
NGroups 1 Title aa Calculation Begin
Matrices A Full 2 2 B Full 1 2 End
Matrices Matrix A 1 .5 .5 1 Matrix B 1 2
Begin Algebra C A D AA i\det(A) End
Algebra End Group
5
Computing means and covfrom raw data file
String data
Title Compute Means and Covariances Calculation
NG1 Begin Matrices X full 15 5 Z zi 5 4
! Selection matrix End Matrices Matrix
X include string.rec Begin Algebra Y
XZ M \mean(Y) C \cov(Y) End
Algebra Option mxcstring.cov Option
mxmstring.mea End
Using the raw data string.rec (In the same
folder That we save this compute.mx)
File compute.mx saved in the same folder as
String.rec
Output will be in compute.mxo
string.cov string.mea
6
! Anything after a ! is a comment ! ! Mx script
to fit a simple model ! One factor in A plus
specifics in D ! Use define to simplify setting
matrix dimensions ! define nvar 3 define nfac
1 Simple MX example file Ngroups1 Data
NObservations150 NInput_varsnvar
CMatrix 3.23 2.26 2.65 2.57 2.84 3.23 Begin
Matrices A Full nvar nfac Free D Diag nvar
nvar Free End Matrices Start .5 All
! All free parameters to start at .5
Bound 0 100 D 1 1 to D nvar nvar ! Keep specific
variances positive Covariance AA' D
Option RS ! to get residuals End
String data
Open Mx Open a new file Paste (or write) the
Commands Save the file with The extension
.mx Run it
The file Factor1.mx
7
! Anything after a ! is a comment ! ! Mx script
to fit a simple model ! One factor in A plus
specifics in D ! Use define to simplify setting
matrix dimensions ! define nvar 4 define anvar
3 define nfac 1 Simple MX example file
Ngroups1 Data NObservations15
NInput_varsnvar CMatrix Full Filestring.cov Labe
l True Brian David Graham ! Select True Brian
David Graham Select Brian David Graham
Begin Matrices A Full anvar nfac Free D
Diag anvar anvar Free End Matrices Start .5
All ! All free parameters to
start at .5 Bound 0 100 D 1 1 to D anvar anvar !
Keep specific variances positive Covariance
AA' D Option RS ! to get residuals End
String data
Open Mx Open a new file Paste (or write) the
Commands Save the file with The extension
.mx Run it
The file Factor1.mx
8
Using row data
This is the file String.rec (with spaces )
!MxGui auto-generated data group data file Data
Ninput5 NObservation15 REctangle
Filestring.rec Label Id True Brian David Graham
1 6.3 5 4.8 6
2 4.1 3.2 3.1
3.5 3 5.1 3.6 3.8
4.5 4 5 4.5
4.1 4.3 5 5.7 4
5.2 5 6 3.3
2.5 2.8 2.6 7 1.3
1.7 1.4 1.6 8
5.8 4.8 4.2 5.5 9
2.8 2.4 2 2.1
10 6.7 5.2 5.3 6
11 1.5 1.2 1.1
1.2 12 2.1 1.8 1.6
1.8 13 4.6 3.4
4.1 3.9 14 7.6 6
6.3 6.5 15 2.5
2.2 1.6 2
This is the file string.dat
9
Using the graphic interface
path diagram gt datamap gt search for the data file
in raw gt select variables We do factor analysis
model
10
Fitting a one factor model
This is file factor.dat
  • Using the graphic options
  • Open the path dyagram interface
  • Open de file factor.dat
  • Select the variables on the file factor.dat
  • Finish drawing the model
  • Run and observe ...

! ! Factor.dat - example factor analysis data !
Data Ninput5 Nobs100 Labels verb perf matrix
digit speed CMatrix 1.2 .1 1.4 .2 .3 1.5 .5
.4 .3 2.0 .3 .2 .4 .5 2.1
11
(No Transcript)
12
More on using Mx
13
An ascii xxx.dat file
File coupon.dat
Data Nimput6 Nobservations85 CMatrix 4.389
3.792 4.410 1.935 1.855 2.385 1.454
1.453 0.989 1.914 1.087 1.309 0.841
0.961 1.480 1.623 1.701 1.175 1.279
1.220 1.971 Labels In1 In2 Beh A1 A2 A3
14
1 Path diagram gt new diagram
2 data map
3 open file
4 opne it
5 it brings the variables in
15
6 highlight the variables
7 press on new
16
Run the program
17
Chi2 Goodness of fit
df
18
Label de Latent variables (clic twice ...)
19
parameter estimates
20
Change on chi2
CI
21
Script file File open
22
See the output file
Script file
23
New diagram window
New datamap
Open new file
24
(No Transcript)
25
(No Transcript)
26
Setting paramters to be equal across groups
Overall chi2
27
(No Transcript)
28
Lattin and Roberts data of adoption new
technologiesp. 366 of Lattin et al.
See the data file adoption.txt in RMMRS
29
Using row data
This is the file String.rec (with spaces )
!MxGui auto-generated data group data file Data
Ninput5 NObservation15 REctangle
Filestring.rec Label Id True Brian David Graham
1 6.3 5 4.8 6
2 4.1 3.2 3.1
3.5 3 5.1 3.6 3.8
4.5 4 5 4.5
4.1 4.3 5 5.7 4
5.2 5 6 3.3
2.5 2.8 2.6 7 1.3
1.7 1.4 1.6 8
5.8 4.8 4.2 5.5 9
2.8 2.4 2 2.1
10 6.7 5.2 5.3 6
11 1.5 1.2 1.1
1.2 12 2.1 1.8 1.6
1.8 13 4.6 3.4
4.1 3.9 14 7.6 6
6.3 6.5 15 2.5
2.2 1.6 2
This is the file string.dat
30
1
2
3
4
5. highlight
6
31
This is for modeling means
32
Analysis of Adoption data
33
  dataread.table("E/Albert/COURSES/RMMSS/Mx/ADOP
TION.txt", headerT) names(data) 1 "ADOPt1"
"ADOPt2" "VALUE1" "VALUE2" "VALUE3" "USAGE1"
"USAGE2" "USAGE3" attach(data) round(cov(data,
use"complete.obs"),2) ADOPt1 ADOPt2
VALUE1 VALUE2 VALUE3 USAGE1 USAGE2 USAGE3 ADOPt1
675.17 489.24 6.25 5.46 4.08 10.62 11.69
7.12 ADOPt2 489.24 994.31 4.16 4.46 3.42
16.35 17.92 12.17 VALUE1 6.25 4.16 0.95
0.37 0.45 0.16 0.19 0.12 VALUE2 5.46
4.46 0.37 0.83 0.31 0.11 0.12
0.07 VALUE3 4.08 3.42 0.45 0.31 0.86
0.13 0.18 0.05 USAGE1 10.62 16.35 0.16
0.11 0.13 0.76 0.64 0.45 USAGE2 11.69
17.92 0.19 0.12 0.18 0.64 0.92
0.55 USAGE3 7.12 12.17 0.12 0.07 0.05
0.45 0.55 0.64 Warning message NAs
introduced by coercion dim(data) 1 188 8
34
Adoption.dat
Data Nimput8 Nobservations188 CMatrix 675.17
489.24 994.31 6.25 4.16 0.95
5.46 4.46 0.37 0.83 4.08 3.42
0.45 0.31 0.86 10.62 16.35 0.16
0.11 0.13 0.76 11.69 17.92 0.19
0.12 0.18 0.64 0.92 7.12 12.17
0.12 0.07 0.05 0.45 0.55 0.64 Labels
ADOPt1 ADOPt2 VALUE1 VALUE2 VALUE3 USAGE1 USAGE2
USAGE3
35
One factor model for Value
36
Two factor model
37
Model complert (utilitza la matriu de
correlacions)
38
Loadings of Adoption constrained
Loadings of Adoption constrained.
39
Exercices
Lattin et al. pp. 383-385 10.1 to 10.7, and
specially 10.7
40
10.7 of p. 384 (Lettin et al. )
Impact of students attitude toward math and
their evaluation. Students in the program were
surveyed Twice about their attitude (once at
the beginning of the fall semester and again at
the beginning of the srping semester). The
researcher has also access to the score of a
graduate-level student attitude test from the
program application. The researcher used the
following three questions to assess attitude
toward math (each measured on a seven point
semantic differntial scale). X1
Nervous-Confident X2 Capable-Inept X3
Angry-Happy XX1 to XX3, the same on time 2 The
researcher captured the students evaluation of
the quantitative course with the following Three
measures (all measured on a sevent point Likert
scale from 7 strongly agree to 1 strongly
disagree ) Y1 I will be able to use what I
learned Y2 The subject matter of this course was
not relevant to me Y3 This was a great course
Tscore Apptitude Test Score (from the program
application) Research Question Test the
hypothesis that there is no effect of attitude
toward math on student evaluations of the new
quantitative course, controlling for the effect
of student aptitude. What do you conclude ?.
41
data read.table("E/Albert/COURSES/RMMSS/MATH_ATT
ITUDElabels.txt", headerT)gt attach(data)gt
names(data) 1 "ID" "X1" "X2" "X3"
"XX1" "XX2" "XX3" "Y1" 9 "Y2"
"Y3" "Tscore" pairs(data,210)
dim(data)1 141 11 gt round(cor(data,211),2
) X1 X2 X3 XX1 XX2 XX3
Y1 Y2 Y3 TscoreX1 1.00 -0.65 0.61
0.86 -0.62 0.54 0.33 -0.20 0.28 0.15X2
-0.65 1.00 -0.56 -0.60 0.84 -0.49 -0.22 0.16
-0.18 -0.14X3 0.61 -0.56 1.00 0.59 -0.54
0.86 0.25 -0.17 0.28 0.04XX1 0.86 -0.60
0.59 1.00 -0.78 0.73 0.24 -0.17 0.26
0.08XX2 -0.62 0.84 -0.54 -0.78 1.00 -0.70
-0.18 0.15 -0.20 -0.12XX3 0.54 -0.49 0.86
0.73 -0.70 1.00 0.18 -0.14 0.25 0.03Y1
0.33 -0.22 0.25 0.24 -0.18 0.18 1.00 -0.58
0.62 0.29Y2 -0.20 0.16 -0.17 -0.17 0.15
-0.14 -0.58 1.00 -0.50 -0.15Y3 0.28 -0.18
0.28 0.26 -0.20 0.25 0.62 -0.50 1.00
0.19Tscore 0.15 -0.14 0.04 0.08 -0.12 0.03
0.29 -0.15 0.19 1.00 gt round(cov(data,211)
,2) X1 X2 X3 XX1 XX2 XX3
Y1 Y2 Y3 TscoreX1 2.62 -1.67
1.60 2.47 -1.77 1.59 0.85 -0.47 0.66
12.53X2 -1.67 2.51 -1.43 -1.69 2.36
-1.42 -0.57 0.37 -0.42 -11.62X3 1.60
-1.43 2.64 1.69 -1.56 2.55 0.65 -0.40 0.66
3.72XX1 2.47 -1.69 1.69 3.16 -2.48
2.37 0.67 -0.43 0.67 7.71XX2 -1.77
2.36 -1.56 -2.48 3.16 -2.30 -0.50 0.38 -0.52
-11.77XX3 1.59 -1.42 2.55 2.37 -2.30
3.36 0.52 -0.38 0.68 2.89Y1 0.85
-0.57 0.65 0.67 -0.50 0.52 2.56 -1.36 1.44
24.25Y2 -0.47 0.37 -0.40 -0.43 0.38
-0.38 -1.36 2.10 -1.04 -11.59Y3 0.66
-0.42 0.66 0.67 -0.52 0.68 1.44 -1.04 2.09
14.44Tscore 12.53 -11.62 3.72 7.71 -11.77
2.89 24.25 -11.59 14.44 2808.07gtgt
42
An ascii xxx.dat file
File math.dat
Data Nimput10 Nobservations141 CMatrix FULL
2.62 -1.67 1.60 2.47 -1.77 1.59 0.85
-0.47 0.66 12.53 -1.67 2.51 -1.43
-1.69 2.36 -1.42 -0.57 0.37 -0.42 -11.62
1.60 -1.43 2.64 1.69 -1.56 2.55 0.65
-0.40 0.66 3.72 2.47 -1.69 1.69 3.16
-2.48 2.37 0.67 -0.43 0.67 7.71
-1.77 2.36 -1.56 -2.48 3.16 -2.30 -0.50
0.38 -0.52 -11.77 1.59 -1.42 2.55 2.37
-2.30 3.36 0.52 -0.38 0.68 2.89 0.85
-0.57 0.65 0.67 -0.50 0.52 2.56 -1.36
1.44 24.25 -0.47 0.37 -0.40 -0.43 0.38
-0.38 -1.36 2.10 -1.04 -11.59 0.66
-0.42 0.66 0.67 -0.52 0.68 1.44 -1.04 2.09
14.44 12.53 -11.62 3.72 7.71 -11.77 2.89
24.25 -11.59 14.44 2808.07 Labels X1 X2
X3 XX1 XX2 XX3 Y1 Y2 Y3 Tscore
X1 Nervous-Confident X2 Capable-Inept X3
Angry-Happy XX1 to XX3, the same on time 2 On
the scale 7 strongly agree to 1 strongly
disagree Y1 I will be able to use what I
learned Y2 The subject matter of this course was
not relevant to me Y3 This was a great course
Tscore Apptitude Test Score
43
One factor model
44
The costumer Orientatin of Service Workers
Personality Trait Effects on Self and Supervisor
Performance Ratings
  • Tom J. Brown et al.
  • May 2000
  • (forthcoming, Journal of Marketing Research)

45
The items
46
Sample moments
47
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com