Skip to contents

A simulated dataset based on the Theory of Planned Behaviour, where INT is a higher order construct of ATT and SN, and PBC is a higher order construct of PC and PB.

Examples

tpb <- '
  # First order constructs
  ATT =~ att1 + att2 + att3
  SN  =~ sn1 + sn2 + sn3
  PB =~ pb1 + pb2 + pb3
  PC =~ pc1 + pc2 + pc3
  BEH =~ b1 + b2

  # Higher order constructs
  INT =~ ATT + SN
  PBC =~ PC + PB

  # Higher order interaction
  INTxPBC =~ ATT:PC + ATT:PB + SN:PC + SN:PB

  # Structural model
  BEH ~ PBC + INT + INTxPBC
'

# \dontrun{
est <- modsem(tpb, data = TPB_2SO, method = "ca")
summary(est)
#> Estimating baseline model (H0)
#> Warning: Unable to estimate baseline model for models with higher-order interaction terms!
#> modsem (version 1.0.13, approach = ca):
#> 
#> Interaction Model Fit Measures (H1):
#>   Loglikelihood                              -56477.03 
#>   Akaike (AIC)                               113090.05 
#>   Bayesian (BIC)                             113470.91 
#>   Chi-square                                   3479.48 
#>   Degrees of Freedom                               309 
#>   P-value (Chi-square)                           0.000 
#>   RMSEA                                          0.072 
#>   CFI                                            0.931 
#>   SRMR                                           0.076 
#> 
#> R-Squared Interaction Model (H1):
#>   BEH                                            0.165 
#> 
#> lavaan 0.6-19 ended normally after 628 iterations
#> 
#>   Estimator                                         ML
#>   Optimization method                           NLMINB
#>   Number of model parameters                        96
#>   Row rank of the constraints matrix                28
#> 
#>   Number of observations                          2000
#> 
#> Model Test User Model:
#>                                                       
#>   Test statistic                              3479.483
#>   Degrees of freedom                               309
#>   P-value (Chi-square)                           0.000
#> 
#> Parameter Estimates:
#> 
#>   Standard errors                             Standard
#>   Information                                 Expected
#>   Information saturated (h1) model          Structured
#> 
#> Latent Variables:
#>                    Estimate  Std.Err  z-value  P(>|z|)
#>   ATT =~                                              
#>     a      (l_1_A)    1.000                           
#>     a      (l_2_A)    0.903    0.010   94.899    0.000
#>     a      (l_3_A)    0.787    0.009   89.747    0.000
#>   SN =~                                               
#>     s      (l_1_S)    1.000                           
#>     s      (l_2_S)    0.917    0.013   71.403    0.000
#>     s      (l_3_S)    0.804    0.012   67.969    0.000
#>   PB =~                                               
#>     p     (l_1_PB)    1.000                           
#>     p     (l_2_PB)    0.923    0.010   89.364    0.000
#>     p     (l_3_PB)    0.790    0.009   84.731    0.000
#>   PC =~                                               
#>     p     (l_1_PC)    1.000                           
#>     p     (l_2_PC)    0.889    0.009  101.651    0.000
#>     p     (l_3_PC)    0.787    0.008   97.811    0.000
#>   BEH =~                                              
#>     b      (l_1_B)    1.000                           
#>     b      (l_2_B)    0.848    0.043   19.772    0.000
#>   INT =~                                              
#>     A     (l_ATT_)    1.000                           
#>     S      (l_SN_)    0.646    0.076    8.547    0.000
#>   PBC =~                                              
#>     P       (l_PC)    1.000                           
#>     P       (l_PB)    0.650    0.081    7.985    0.000
#>   INTxPBC =~                                          
#>     A    (l_ATTPC)    1.000                           
#>     A    (l_ATTPB)    0.817    0.036   22.725    0.000
#>     S     (l_SNPC)    0.729    0.031   23.234    0.000
#>     S     (l_SNPB)    0.606    0.027   22.365    0.000
#>   ATTPC =~                                            
#>     a (l_11_ATTPC)    1.000                           
#>     a (l_22_ATTPC)    0.803    0.009   90.729    0.000
#>     a (l_33_ATTPC)    0.620    0.007   86.179    0.000
#>   ATTPB =~                                            
#>     a (l_11_ATTPB)    1.000                           
#>     a (l_22_ATTPB)    0.834    0.010   83.614    0.000
#>     a (l_33_ATTPB)    0.622    0.008   78.869    0.000
#>   SNPC =~                                             
#>     s  (l_11_SNPC)    1.000                           
#>     s  (l_22_SNPC)    0.815    0.011   71.600    0.000
#>     s  (l_33_SNPC)    0.633    0.009   68.160    0.000
#>   SNPB =~                                             
#>     s  (l_11_SNPB)    1.000                           
#>     s  (l_22_SNPB)    0.846    0.012   68.808    0.000
#>     s  (l_33_SNPB)    0.635    0.010   65.238    0.000
#> 
#> Regressions:
#>                    Estimate  Std.Err  z-value  P(>|z|)
#>   BEH ~                                               
#>     PBC     (G_PB)    0.221    0.031    7.155    0.000
#>     INT   (G_INT_)    0.209    0.029    7.224    0.000
#>     INTPB (G_INTP)    0.158    0.019    8.137    0.000
#> 
#> Covariances:
#>                    Estimate  Std.Err  z-value  P(>|z|)
#>   INT ~~                                              
#>     PBC  (C_INT_P)    0.017    0.026    0.669    0.504
#>     INTP (C_INT_I)   -0.002    0.029   -0.083    0.934
#>   PBC ~~                                              
#>     INTP    (C_PB)   -0.094    0.035   -2.712    0.007
#>  .att1pc1 ~~                                          
#>    .at22              0.000                           
#>    .at33              0.000                           
#>  .att2pc2 ~~                                          
#>    .at33              0.000                           
#>  .att1pb1 ~~                                          
#>    .at22              0.000                           
#>    .at33              0.000                           
#>  .att2pb2 ~~                                          
#>    .at33              0.000                           
#>  .sn1pc1 ~~                                           
#>    .sn22              0.000                           
#>    .sn33              0.000                           
#>  .sn2pc2 ~~                                           
#>    .sn33              0.000                           
#>  .sn1pb1 ~~                                           
#>    .sn22              0.000                           
#>    .sn33              0.000                           
#>  .sn2pb2 ~~                                           
#>    .sn33              0.000                           
#> 
#> Intercepts:
#>                    Estimate  Std.Err  z-value  P(>|z|)
#>    .ATTP (M_ATTPC)    0.017    0.026    0.669    0.504
#>    .ATTP (M_ATTPB)    0.011    0.017    0.668    0.504
#>    .SNPC  (M_SNPC)    0.011    0.017    0.668    0.504
#>    .SNPB  (M_SNPB)    0.007    0.011    0.667    0.505
#>    .att1              1.008    0.025   40.614    0.000
#>    .att2              1.002    0.023   43.736    0.000
#>    .att3              1.012    0.021   49.282    0.000
#>    .sn1               0.980    0.018   53.085    0.000
#>    .sn2               0.986    0.018   56.087    0.000
#>    .sn3               0.993    0.016   61.749    0.000
#>    .pb1               1.010    0.024   41.515    0.000
#>    .pb2               1.014    0.023   43.981    0.000
#>    .pb3               1.015    0.020   50.248    0.000
#>    .pc1               1.032    0.028   36.550    0.000
#>    .pc2               1.023    0.026   39.909    0.000
#>    .pc3               1.027    0.023   44.819    0.000
#>    .b1                1.000    0.020   50.566    0.000
#>    .b2                0.997    0.018   54.925    0.000
#>    .at11              0.012    0.048    0.242    0.809
#>    .at22             -0.016    0.039   -0.401    0.689
#>    .at33              0.005    0.031    0.170    0.865
#>    .at11              0.031    0.038    0.812    0.417
#>    .at22              0.009    0.033    0.292    0.770
#>    .at33              0.025    0.025    1.013    0.311
#>    .sn11              0.021    0.034    0.605    0.545
#>    .sn22              0.000    0.029    0.008    0.994
#>    .sn33              0.006    0.023    0.282    0.778
#>    .sn11              0.028    0.028    1.031    0.303
#>    .sn22              0.008    0.024    0.344    0.731
#>    .sn33              0.009    0.019    0.467    0.640
#> 
#> Variances:
#>                    Estimate  Std.Err  z-value  P(>|z|)
#>    .AT    (Vr_ATT)    0.306    0.088    3.482    0.000
#>    .SN     (Vr_SN)    0.190    0.037    5.088    0.000
#>    .PB     (Vr_PB)    0.619    0.054   11.411    0.000
#>    .PC      (V_PC)    0.469    0.120    3.907    0.000
#>    .BE      (Z_BE)    0.544    0.036   15.260    0.000
#>     IN    (Vr_INT)    0.752    0.091    8.252    0.000
#>     PB     (V_PBC)    0.958    0.123    7.760    0.000
#>     IN    (V_INTP)    1.297    0.089   14.646    0.000
#>    .AT   (V_ATTPC)    1.511    0.041   36.482    0.000
#>    .AT   (V_ATTPB)    1.084    0.031   35.464    0.000
#>    .SN    (V_SNPC)    0.719    0.022   32.194    0.000
#>    .SN    (V_SNPB)    0.516    0.016   31.825    0.000
#>    .a1     (Vr_t1)    0.174    0.008   21.062    0.000
#>    .a2     (Vr_t2)    0.186    0.007   24.851    0.000
#>    .a3     (Vr_t3)    0.187    0.007   28.710    0.000
#>    .s1     (Vr_s1)    0.177    0.007   24.784    0.000
#>    .s2     (Vr_s2)    0.195    0.007   28.844    0.000
#>    .s3     (Vr_s3)    0.192    0.006   32.240    0.000
#>    .p1    (Vr_pb1)    0.161    0.009   18.864    0.000
#>    .p2    (Vr_pb2)    0.191    0.008   23.432    0.000
#>    .p3    (Vr_pb3)    0.178    0.007   26.465    0.000
#>    .p1    (Vr_pc1)    0.167    0.009   18.483    0.000
#>    .p2    (Vr_pc2)    0.185    0.008   22.968    0.000
#>    .p3    (Vr_pc3)    0.165    0.007   24.405    0.000
#>    .b1     (Vr_b1)    0.131    0.031    4.180    0.000
#>    .b2     (Vr_b2)    0.191    0.023    8.211    0.000
#>    .a1 (Vr_tt1pc1)    0.454    0.015   30.377    0.000
#>    .a2 (Vr_tt2pc2)    0.404    0.011   36.058    0.000
#>    .a3 (Vr_tt3pc3)    0.305    0.008   39.382    0.000
#>    .a1 (Vr_tt1pb1)    0.377    0.012   30.603    0.000
#>    .a2 (Vr_tt2pb2)    0.363    0.010   36.293    0.000
#>    .a3 (Vr_tt3pb3)    0.270    0.007   40.454    0.000
#>    .s1 (Vr_sn1pc1)    0.367    0.012   31.101    0.000
#>    .s2 (Vr_sn2pc2)    0.334    0.009   36.194    0.000
#>    .s3 (Vr_sn3pc3)    0.255    0.007   38.970    0.000
#>    .s1 (Vr_sn1pb1)    0.291    0.009   32.171    0.000
#>    .s2 (Vr_sn2pb2)    0.288    0.008   37.329    0.000
#>    .s3 (Vr_sn3pb3)    0.214    0.005   40.765    0.000
#> 
#> Constraints:
#>                                                |Slack|
#>     V_ATTPC-((V_ATT+V_INT*_ATT_INT^2)*(V_PBC*    0.000
#>     V_11-(_1_ATT^2*(V_ATT+V_INT*_ATT_INT^2)*V    0.000
#>     V_22-(_2_ATT^2*(V_ATT+V_INT*_ATT_INT^2)*V    0.000
#>     V_33-(_3_ATT^2*(V_ATT+V_INT*_ATT_INT^2)*V    0.000
#>     V_ATTPB-((V_ATT+V_INT*_ATT_INT^2)*(V_PB+V    0.000
#>     V_11-(_1_ATT^2*(V_ATT+V_INT*_ATT_INT^2)*V    0.000
#>     V_22-(_2_ATT^2*(V_ATT+V_INT*_ATT_INT^2)*V    0.000
#>     V_33-(_3_ATT^2*(V_ATT+V_INT*_ATT_INT^2)*V    0.000
#>     V_SNPC-((V_INT*_SN_INT^2+V_SN)*(V_PBC*_PC    0.000
#>     V_11-(_1_SN^2*(V_INT*_SN_INT^2+V_SN)*V_1+    0.000
#>     V_22-(_2_SN^2*(V_INT*_SN_INT^2+V_SN)*V_2+    0.000
#>     V_33-(_3_SN^2*(V_INT*_SN_INT^2+V_SN)*V_3+    0.000
#>     V_SNPB-((V_INT*_SN_INT^2+V_SN)*(V_PB+V_PB    0.000
#>     V_11-(_1_SN^2*(V_INT*_SN_INT^2+V_SN)*V_1+    0.000
#>     V_22-(_2_SN^2*(V_INT*_SN_INT^2+V_SN)*V_2+    0.000
#>     V_33-(_3_SN^2*(V_INT*_SN_INT^2+V_SN)*V_3+    0.000
#>     lmbd_tt1pc1_ATTPC-(lmbd_tt1_ATT*lmb_1_PC)    0.000
#>     lmbd_tt2pc2_ATTPC-(lmbd_tt2_ATT*lmb_2_PC)    0.000
#>     lmbd_tt3pc3_ATTPC-(lmbd_tt3_ATT*lmb_3_PC)    0.000
#>     lmbd_tt1pb1_ATTPB-(lmbd_tt1_ATT*lmb_1_PB)    0.000
#>     lmbd_tt2pb2_ATTPB-(lmbd_tt2_ATT*lmb_2_PB)    0.000
#>     lmbd_tt3pb3_ATTPB-(lmbd_tt3_ATT*lmb_3_PB)    0.000
#>     lmbd_sn1pc1_SNPC-(lmbd_sn1_SN*lmbd_p1_PC)    0.000
#>     lmbd_sn2pc2_SNPC-(lmbd_sn2_SN*lmbd_p2_PC)    0.000
#>     lmbd_sn3pc3_SNPC-(lmbd_sn3_SN*lmbd_p3_PC)    0.000
#>     lmbd_sn1pb1_SNPB-(lmbd_sn1_SN*lmbd_p1_PB)    0.000
#>     lmbd_sn2pb2_SNPB-(lmbd_sn2_SN*lmbd_p2_PB)    0.000
#>     lmbd_sn3pb3_SNPB-(lmbd_sn3_SN*lmbd_p3_PB)    0.000
#>     Mn_ATTPC-((Cv_INT_PBC*l_ATT_INT*_PC_PBC))    0.000
#>     Mn_ATTPB-((Cv_INT_PBC*l_ATT_INT*_PB_PBC))    0.000
#>     Mn_SNPC-((Cv_INT_PBC*lmb_PC_PBC*_SN_INT))    0.000
#>     Mn_SNPB-((Cv_INT_PBC*lmb_PB_PBC*_SN_INT))    0.000
#> 
# }