我正在尝试用R语言的lavaan指定一个奇怪的模型。
该模型如下所示:
我的规格尝试如下所示。我发现很难实现的是将观察到的变量的唯一误差固定为唯一项的两个相关性之和。
例如,项y * 1,2与y * 1,3和y * 2,3的协变量,其误差应该是cov y * 1,3 + cov y * 1,3。
在lavaan语法中,如何显式修正项目错误以使其等于这些协方差之和?
cfa_model_spesification<-'
C=~ #C4_12*i10i11+C4_13*i10i12+
#C5_12*i13i14+C5_13*i13i15+
#C6_12*i17i18+C6_13*i17i19+
C1_12*i1i2+C1_13*i1i3+
C2_12*i4i5+C2_13*i4i6+
C3_12*i7i8+C3_13*i7i9
R=~ #R4_23*i10i11+R4_12*i11i12+
#R5_23*i13i14+R5_12*i14i16+
#R6_23*i17i18+R6_12*i18i19+
R1_12*i1i2+R1_23*i2i3+
R2_12*i4i5+R2_23*i5i6+
R3_12*i7i8+R3_23*i8i9
O=~ #O4_13*i10i12+O4_23*i11i12+
#O5_13*i13i15+O5_23*i14i16+
#O6_13*i17i19+O6_23*i18i19+
O1_13*i1i3+O1_23*i2i3+
O2_13*i4i6+O2_23*i5i6+
O3_13*i7i9+O3_23*i8i9
O~~1*O
C~~1*C
R~~1*R
O~~C+R
R~~C
R1_23==-R1_12
R2_23==-R2_12
R3_23==-R3_12
R1_23>0
R2_23>0
R3_23>0
# R1_12<0
# R2_12<0
# R3_12<0
O1_13<0
O1_23<0
O2_13<0
O2_23<0
O3_13<0
O3_23<0
i1i2~~i1i3
i1i2~~i2i3
i1i3~~i2i3
i4i5~~i4i6
i4i5~~i5i6
i4i6~~i5i6
i7i8~~i7i9
i7i8~~i8i9
i7i9~~i8i9
i1i2~~1*i1i2
i4i5~~1*i4i5
i7i8~~1*i7i8
# i1i3~~equal("i1i3~~i1i2+i1i3~~i2i3")*i1i3
# i2i3~~equal("i2i3~~i1i2+i2i3~~i1i3")*i2i3
# i4i6~~equal("i4i6~~i4i5+i4i6~~i5i6")*i4i6
# i5i6~~equal("i5i6~~i4i5+i5i6~~i4i6")*i5i6
# i7i9~~equal("i7i9~~i7i8+i7i9~~i8i9")*i7i9
# i8i9~~equal("i8i9~~i7i8+i8i9~~i7i9")*i8i9
'
在mplus中的语法如下所示
TITLE:
Example
DATA:
FILE IS triplets.dat;
VARIABLE:
NAMES=i1i2 i1i3 i2i3 i4i5 i4i6 i5i6 i7i8 i7i9 i8i9 i10i11 i10i12 i11i12;
CATEGORICAL=i1i2-i11i12;
ANALYSIS:
ESTIMATOR=ulsmv;
PARAMETERIZATION=THETA;
MODEL:
Trait1 BY
i1i2*1 i1i3*1 (L1)
i4i5*-1 i4i6*-1 (L4)
i7i8*1 i7i9*1 (L7)
i10i11*1 i10i12*1 (L10);
Trait2 BY
i1i2*-1 (L2_n)
i2i3*1 (L2)
i4i5*-1 (L5_n)
i5i6*1 (L5)
i7i8*-1 (L8_n)
i8i9*1 (L8)
i10i11*1 (L11_n)
i11i12*-1 (L11);
Trait3 BY
i1i3*-1 i2i3*-1 (L3_n)
i4i6*-1 i5i6*-1 (L6_n)
i7i9*1 i8i9*1 (L9_n)
i10i12*-1 i11i12*-1 (L12_n);
Trait1-Trait3@1
Trait1 WITH Trait2*-0.4 Trait3*0;
Trait2 WITH Trait3*0.3;
i1i2*2 (e1e2);
i1i3*2 (e1e3);
i2i3*2 (e2e3);
i4i5*2 (e4e5);
i4i6*2 (e4e6);
i5i6*2 (e5e6);
i7i8*2 (e7e8);
i7i9*2 (e7e9);
i8i9*2 (e8e9);
i10i11*2 (e10e11);
i10i12*2 (e10e12);
i11i12*2 (e11e12);
i1i2 WITH i1i3*1 (e1);
i1i2 WITH i2i3*-1 (e2_n);
i1i3 WITH i2i3*1 (e3);
i4i5 WITH i4i6*1 (e4);
i4i5 WITH i5i6*-1 (e5_n);
i4i6 WITH i5i6*1 (e6);
i7i8 WITH i7i9*1 (e7);
i7i8 WITH i8i9*-1 (e8_n);
i7i9 WITH i8i9*1 (e9);
i10i11 WITH i10i12*1 (e10);
i10i11 WITH i11i12*-1 (e11_n);
i10i12 WITH i11i12*1 (e12);
MODEL CONSTRAINT:
L2_n=-L2;
L5_n=-L5;
L8_n=-L8;
L11_n=-L11;
e1e2=e1-e2_n;
e1e3=e1+e3;
e2e3=-e2_n+e3;
e4e5=e4-e5_n;
e4e6=e4+e6;
e5e6=-e5_n+e6;
e7e8=e7-e8_n;
e7e9=e7+e9;
e8e9=-e8_n+e9;
e10e11=e10-e11_n;
e10e12=e10+e12;
e11e12=-e11_n+e12;
e1=1;
e4=1;
e7=1;
e10=1;
最佳答案
这是我为配饰模型想到的lavaan的模型化
lavaan_6_model_spesification<-'# factor loadings (lambda)
trait1=~start(1)*L1*i1i2+start(1)*L1*i1i3+start(1)*L4*i4i5+start(1)*L4*i4i6+start(1)*L7*i7i8+start(1)*L7*i7i9+start(1)*L10*i10i11+start(1)*L10*i10i12+start(1)*L13*i13i14+start(1)*L13*i13i15+start(1)*L16*i16i17+start(1)*L16*i16i18
trait2=~start(-1)*L2n*i1i2+start(1)*L2*i2i3+start(-1)*L5n*i4i5+start(1)*L5*i5i6+start(-1)*L8n*i7i8+start(1)*L8*i8i9+start(-1)*L11n*i10i11+start(1)*L11*i11i12+start(-1)*L14n*i13i14+start(1)*L14*i14i15+start(-1)*L17n*i16i17+start(1)*L17*i17i18
trait3=~start(-1)*L3n*i1i3+start(-1)*L3n*i2i3+start(-1)*L6n*i4i6+start(-1)*L6n*i5i6+start(-1)*L9n*i7i9+start(-1)*L9n*i8i9+start(-1)*L12n*i10i12+start(-1)*L12n*i11i12+start(-1)*L15n*i13i15+start(-1)*L15n*i14i15+start(-1)*L18n*i16i18+start(-1)*L18n*i17i18
# fix factor variances to 1
trait1~~1*trait1
trait2~~1*trait2
trait3~~1*trait3
# factor correlations
trait1~~trait2+trait3
trait2~~trait3
# fix factor loadings of the same item to the same value
L2==-L2n
L5==-L5n
L8==-L8n
L11==-L11n
L14==-L14n
L17==-L17n
# declare uniquenesses (psi)
i1i2~~P1P2*i1i2
i1i3~~P1P3*i1i3
i2i3~~P2P3*i2i3
i4i5~~P4P5*i4i5
i4i6~~P4P6*i4i6
i5i6~~P5P6*i5i6
i7i8~~P7P8*i7i8
i7i9~~P7P9*i7i9
i8i9~~P8P9*i8i9
i10i11~~P10P11*i10i11
i10i12~~P10P12*i10i12
i11i12~~P11P12*i11i12
i13i14~~P13P14*i13i14
i13i15~~P13P15*i13i15
i14i15~~P14P15*i14i15
i16i17~~P16P17*i16i17
i16i18~~P16P18*i16i18
i17i18~~P17P18*i17i18
# correlated uniqunesses
i1i2~~start(1)*P1*i1i3
i1i2~~start(-1)*P2n*i2i3
i1i3~~start(1)*P3*i2i3
i4i5~~start(1)*P4*i4i6
i4i5~~start(-1)*P5n*i5i6
i4i6~~start(1)*P6*i5i6
i7i8~~start(1)*P7*i7i9
i7i8~~start(-1)*P8n*i8i9
i7i9~~start(1)*P9*i8i9
i10i11~~start(1)*P10*i10i12
i10i11~~start(-1)*P11n*i11i12
i10i12~~start(1)*P12*i11i12
i13i14~~start(1)*P13*i13i15
i13i14~~start(-1)*P14n*i14i15
i13i15~~start(1)*P15*i14i15
i16i17~~start(1)*P16*i16i18
i16i17~~start(-1)*P17n*i17i18
i16i18~~start(1)*P18*i17i18
# pairs uniqueness is equal to sum of 2 utility uniqunesses
P1P2==P1-P2n
P1P3==P1+P3
P2P3==-P2n+P3
P4P5==P4-P5n
P4P6==P4+P6
P5P6==-P5n+P6
P7P8==P7-P8n
P7P9==P7+P9
P8P9==-P8n+P9
P10P11==P10-P11n
P10P12==P10+P12
P11P12==-P11n+P12
P13P14==P13-P14n
P13P15==P13+P15
P14P15==-P14n+P15
P16P17==P16-P17n
P16P18==P16+P18
P17P18==-P17n+P18
# fix one uniqueness per block for identification
P1==1
P4==1
P7==1
P10==1
P13==1
P16==1
# force item parameters of the same item to be equal
'
关于r - 指定湍流为外源相关性之和的CFA,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48490705/