Loading Packages

library(tidyverse)
library(sjstats)
library(jmRtools)
library(MuMIn)
library(psych)
library(car)

Loading Data

SciMo_esm <- read_csv("/Volumes/educ/CEPSE/Projects/SchmidtLab/PSE/PSE_Raw Data Files/SciMo_Raw Data File/scimo_esm_11.19.18.csv")
## Parsed with column specification:
## cols(
##   .default = col_double(),
##   stud_ID = col_character()
## )
## See spec(...) for full column specifications.
SciMo_student_survey <- read_csv("/Volumes/educ/CEPSE/Projects/SchmidtLab/PSE/PSE_Raw Data Files/SciMo_Raw Data File/scimo_student-survey_07.30.18.csv")
## Parsed with column specification:
## cols(
##   .default = col_double(),
##   stud_ID = col_character(),
##   ThirdQuar_2010 = col_character(),
##   FourthQuar_2010 = col_character(),
##   ThirdQuar_2011 = col_logical()
## )
## See spec(...) for full column specifications.
SciMo_video_value <- read_csv("/Volumes/educ/CEPSE/Projects/SchmidtLab/PSE/PSE_Raw Data Files/SciMo_Raw Data File/scimo_value_final_07.30.18.csv")
## Parsed with column specification:
## cols(
##   .default = col_double(),
##   date = col_character()
## )
## See spec(...) for full column specifications.

Fixing Joining Variables

#Fixing response_date in ESM dataset
SciMo_esm$year <- ifelse(SciMo_esm$year == 8, 2008, 2009)
SciMo_esm$response_date <- as.Date(with(SciMo_esm, paste(year, month, day, sep="-")), "%Y-%m-%d")
SciMo_esm$response_date <- format(as.Date(SciMo_esm$response_date, format = "%Y-%m-%d"), "%Y-%m-%d")

#Renaming variables in video value dataset (right side is what they were named; new mame on left)
SciMo_video_value <- rename(SciMo_video_value,
                            response_date = date,
                            teacher_ID = teacher)
#Formating as response date variable as a date for video value dataset
SciMo_video_value$response_date <- format(as.Date(SciMo_video_value$response_date, format = "%m/%d/%Y"), "%Y-%m-%d")

Creating New Signal Variables in ESM Dataset

SciMo_esm$signal_value <- ifelse(SciMo_esm$pager == 1 & SciMo_esm$signal == 1, 1,
                                 ifelse(SciMo_esm$pager == 2 & SciMo_esm$signal == 1, 2,
                                        ifelse(SciMo_esm$pager == 1 & SciMo_esm$signal == 2, 3,
                                               ifelse(SciMo_esm$pager == 2 & SciMo_esm$signal == 4, 4,
                                                      ifelse(SciMo_esm$pager == 3 & SciMo_esm$signal == 1, 1,
                                                             ifelse(SciMo_esm$pager == 4 & SciMo_esm$signal == 2, 2,
                                                                    ifelse(SciMo_esm$pager == 3 & SciMo_esm$signal == 2, 3, 4)))))))

Creating Predictor Variables

#Creating dummy female variable
SciMo_student_survey$female <- ifelse(SciMo_student_survey$gender == 2, 1, 0)

#Creating minority dummy variable - 1 = minority status, 0 = white/asian
SciMo_student_survey$minority <- ifelse(SciMo_student_survey$race == 4 | SciMo_student_survey$race == 1, 0, 1)

#Creating grade variables
SciMo_esm <- mutate(SciMo_esm, ninth = ifelse(SciMo_esm$grade == 1, 1, 0))
SciMo_esm <- mutate(SciMo_esm, tenth = ifelse(SciMo_esm$grade == 2, 1, 0))
SciMo_esm <- mutate(SciMo_esm, eleventh = ifelse(SciMo_esm$grade == 3, 1, 0))
SciMo_esm <- mutate(SciMo_esm, twelfth = ifelse(SciMo_esm$grade == 4, 1, 0))
                                        
#Creating dummy grade variable, 0 = 9th grade; 1 = 10th, 11th, 12th grade
SciMo_esm <- mutate(SciMo_esm, grade_dum = ifelse(SciMo_esm$grade == 1, 0, 1))

#Creating Overall Value Sum in Video Value Dataset
SciMo_video_value$ov_sum <- (SciMo_video_value$high_utility_sum + SciMo_video_value$high_attainment_sum + SciMo_video_value$high_intrinsic_sum)

#Renaming utility value variable
SciMo_video_value <- rename(SciMo_video_value, uv_sum = high_utility_sum)

#Creating Perceived Competence Variable
SciMo_student_survey$per_comp <- composite_mean_maker(SciMo_student_survey, confident1, capable1)

#Renaming instructional practice variable
SciMo_esm <- rename(SciMo_esm, activity = instructional_practice)

#Creating class activity variable, same as in JRST paper
# SciMo_esm$act_re <- car::recode(SciMo_esm$activity,
#                                 "1 = 'Lecture';
#                                               c(2, 3) = 'Individual Work';
#                                               c(4, 5) = 'Group Work';
#                                               c(6, 8, 7) = 'Quiz and Test';
#                                               c(9) = 'Discussion';
#                                               c(11, 10) = 'Presentation';
#                                               c(12, 13) = 'Video';
#                                               c(15, 14, 16) = 'Laboratory';
#                                               c(17) = 'Non-instructional';
#                                               c(18) = NA")
# 
# SciMo_esm$act_re <- ifelse((SciMo_esm$act_re == "Discussion" | SciMo_esm$act_re == "Non-instructional" | SciMo_esm$act_re == "Presentation" | SciMo_esm$act_re == "Video" | SciMo_esm$act_re == "Group Work"), "Other", SciMo_esm$act_re)


SciMo_esm$act_aa <- ifelse((SciMo_esm$activity == 10 | SciMo_esm$activity == 11 | SciMo_esm$activity ==14 | SciMo_esm$activity ==15 | SciMo_esm$activity ==16), 1, 0)

SciMo_esm$act_seat <- ifelse((SciMo_esm$activity == 4 | SciMo_esm$activity == 5 | SciMo_esm$activity == 2 | SciMo_esm$activity == 3), 1, 0)

SciMo_esm$act_lec <- ifelse((SciMo_esm$activity == 1 | SciMo_esm$activity == 12 | SciMo_esm$activity == 13), 1, 0)

SciMo_esm$act_test <- ifelse((SciMo_esm$activity == 6 | SciMo_esm$activity == 7 | SciMo_esm$activity == 8), 1, 0)

SciMo_esm$act_oth <- ifelse((SciMo_esm$activity == 9 | SciMo_esm$activity == 17 | SciMo_esm$activity == 18), 1, 0)
#Creating class activity variable, same as in JRST paper
#SciMo_esm$act_re <- car::recode(SciMo_esm$activity,
#                                              "1 = 'Lecture';
#                                               c(2, 3) = 'Individual Work';
#                                               c(4, 5) = 'Group Work';
#                                               c(6, 8, 7) = 'Quiz and Test';
#                                               c(9) = 'Discussion';
#                                               c(11, 10) = 'Presentation';
#                                               c(12, 13) = 'Video';
#                                               c(15, 14, 16) = 'Laboratory';
#                                               c(17) = 'Non-instructional';
#                                               c(18) = NA")

#table(SciMo_esm$act_re)

# SciMo_esm$act_re <- ifelse((SciMo_esm$act_re == "Discussion" | SciMo_esm$act_re == "Non-instructional" | SciMo_esm$act_re == "Presentation" | SciMo_esm$act_re == "Video" | SciMo_esm$act_re == "Group Work"), "Other", SciMo_esm$act_re)
#Creating class activity variable, same as in JRST paper
SciMo_esm$act_re <- car::recode(SciMo_esm$activity,
                                              "c(1, 12, 13, 9)  = 'Lecture';
                                               c(2, 3) = 'Individual Work';
                                               c(4, 5) = 'Group Work';
                                               c(6, 8, 7) = 'Quiz and Test';
                                               c(11, 10) = 'Presentation';
                                               c(15, 14, 16) = 'Laboratory';
                                               c(17) = 'Non-instructional';
                                               c(18) = NA")

table(SciMo_esm$act_re)
## 
##        Group Work   Individual Work        Laboratory           Lecture 
##               271               671              1023               791 
## Non-instructional      Presentation     Quiz and Test 
##               322               313               688
#Creating dummy coded variables
SciMo_esm$act_lec <- ifelse((SciMo_esm$activity == 1 | SciMo_esm$activity == 12 | SciMo_esm$activity == 13 | SciMo_esm$activity == 9), 1, 0)

SciMo_esm$act_indwork <- ifelse((SciMo_esm$activity == 2 | SciMo_esm$activity == 3), 1, 0)

SciMo_esm$act_groupwork <- ifelse((SciMo_esm$activity == 4 | SciMo_esm$activity == 5), 1, 0)

SciMo_esm$act_test <- ifelse((SciMo_esm$activity == 6 | SciMo_esm$activity == 7 | SciMo_esm$activity == 8), 1, 0)

SciMo_esm$act_pres <- ifelse((SciMo_esm$activity == 11 | SciMo_esm$activity == 10), 1, 0)

SciMo_esm$act_lab <- ifelse((SciMo_esm$activity == 15 | SciMo_esm$activity == 14 | SciMo_esm$activity == 16), 1, 0)

SciMo_esm$act_nonins <- ifelse((SciMo_esm$activity == 17), 1, 0)

Multigroup SEM constrained model

library(lavaan)

MG_EMO <- '
#measurement model
cont =~ control + succeed + learning + exp_y + exp_t
value =~ imp_y + imp_fut
#regressions
happy ~ cont + value
excited ~ cont + value
frustrated ~ cont + value
bored ~ cont + value
#residual correlations
happy ~~ excited + frustrated + bored
excited ~~ frustrated + bored
frustrated ~~ bored
cont ~~ value
'

fit<-sem(MG_EMO, data=SciMo_esm, cluster = "uniqueid", group = "act_re", se = "robust.cluster.sem", group.equal = c("regressions")) #meanstructure = TRUE)
summary(fit, fit.measures=TRUE, standardized = TRUE)
## lavaan 0.6-3 ended normally after 161 iterations
## 
##   Optimization method                           NLMINB
##   Number of free parameters                        352
##   Number of equality constraints                    56
## 
##                                                   Used       Total
##   Number of observations per group         
##   Individual Work                                  633         671
##   Number of clusters [uniqueid]                    198
##   Quiz and Test                                    629         688
##   Number of clusters [uniqueid]                    179
##   NaN                                               43          51
##   Number of clusters [uniqueid]                     22
##   Non-instructional                                302         322
##   Number of clusters [uniqueid]                    159
##   Lecture                                          746         791
##   Number of clusters [uniqueid]                    202
##   Laboratory                                       941        1023
##   Number of clusters [uniqueid]                    141
##   Group Work                                       249         271
##   Number of clusters [uniqueid]                    127
##   Presentation                                     295         313
##   Number of clusters [uniqueid]                     70
## 
##   Estimator                                         ML      Robust
##   Model Fit Test Statistic                     905.383     618.733
##   Degrees of freedom                               320         320
##   P-value (Chi-square)                           0.000       0.000
##   Scaling correction factor                                  1.463
##     for the Yuan-Bentler correction (Mplus variant)
## 
## Chi-square for each group:
## 
##   Individual Work                              106.167      72.554
##   Quiz and Test                                 94.897      64.852
##   NaN                                           68.158      46.579
##   Non-instructional                             91.984      62.861
##   Lecture                                      148.934     101.780
##   Laboratory                                   194.760     133.098
##   Group Work                                   108.747      74.317
##   Presentation                                  91.738      62.693
## 
## Model test baseline model:
## 
##   Minimum Function Test Statistic            17567.287   11181.798
##   Degrees of freedom                               440         440
##   P-value                                        0.000       0.000
## 
## User model versus baseline model:
## 
##   Comparative Fit Index (CFI)                    0.966       0.972
##   Tucker-Lewis Index (TLI)                       0.953       0.962
## 
##   Robust Comparative Fit Index (CFI)                         0.974
##   Robust Tucker-Lewis Index (TLI)                            0.964
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)             -50826.991  -50826.991
##   Scaling correction factor                                  1.566
##     for the MLR correction
##   Loglikelihood unrestricted model (H1)     -50374.299  -50374.299
##   Scaling correction factor                                  1.655
##     for the MLR correction
## 
##   Number of free parameters                        296         296
##   Akaike (AIC)                              102245.982  102245.982
##   Bayesian (BIC)                            104096.783  104096.783
##   Sample-size adjusted Bayesian (BIC)       103156.233  103156.233
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.062       0.044
##   90 Percent Confidence Interval          0.057  0.067       0.040  0.048
##   P-value RMSEA <= 0.05                          0.000       0.989
## 
##   Robust RMSEA                                               0.053
##   90 Percent Confidence Interval                             0.047  0.060
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.047       0.047
## 
## Parameter Estimates:
## 
##   Information                                 Expected
##   Information saturated (h1) model          Structured
##   Standard Errors                   Robust.cluster.sem
## 
## 
## Group 1 [Individual Work]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               0.730    0.714
##     succeed           1.032    0.079   13.056    0.000    0.753    0.798
##     learning          0.974    0.070   13.955    0.000    0.712    0.727
##     exp_y             1.179    0.074   15.964    0.000    0.861    0.891
##     exp_t             1.140    0.075   15.199    0.000    0.832    0.839
##   value =~                                                              
##     imp_y             1.000                               0.960    0.960
##     imp_fut           0.753    0.073   10.377    0.000    0.722    0.723
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont    (.p8.)    0.561    0.035   16.156    0.000    0.410    0.390
##     value   (.p9.)    0.102    0.026    3.875    0.000    0.098    0.093
##   excited ~                                                             
##     cont    (.10.)    0.285    0.037    7.690    0.000    0.208    0.202
##     value   (.11.)    0.161    0.028    5.663    0.000    0.154    0.150
##   frustrated ~                                                          
##     cont    (.12.)   -0.239    0.030   -7.973    0.000   -0.175   -0.209
##     value   (.13.)    0.050    0.023    2.160    0.031    0.048    0.057
##   bored ~                                                               
##     cont    (.14.)   -0.247    0.046   -5.421    0.000   -0.180   -0.164
##     value   (.15.)   -0.272    0.036   -7.527    0.000   -0.261   -0.236
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.477    0.058    8.200    0.000    0.477    0.517
##    .frustrated       -0.064    0.038   -1.679    0.093   -0.064   -0.083
##    .bored            -0.175    0.055   -3.195    0.001   -0.175   -0.179
##  .excited ~~                                                            
##    .frustrated        0.033    0.044    0.741    0.458    0.033    0.041
##    .bored            -0.142    0.056   -2.553    0.011   -0.142   -0.140
##  .frustrated ~~                                                         
##    .bored             0.157    0.042    3.741    0.000    0.157    0.184
##   cont ~~                                                               
##     value             0.319    0.053    6.008    0.000    0.454    0.454
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.635    0.066   24.606    0.000    1.635    1.599
##    .succeed           1.750    0.056   31.244    0.000    1.750    1.853
##    .learning          1.659    0.056   29.650    0.000    1.659    1.695
##    .exp_y             1.712    0.064   26.555    0.000    1.712    1.771
##    .exp_t             1.701    0.064   26.398    0.000    1.701    1.716
##    .imp_y             1.166    0.071   16.468    0.000    1.166    1.167
##    .imp_fut           0.968    0.071   13.577    0.000    0.968    0.970
##    .happy             1.479    0.076   19.432    0.000    1.479    1.408
##    .excited           0.817    0.071   11.443    0.000    0.817    0.795
##    .frustrated        0.613    0.051   11.975    0.000    0.613    0.734
##    .bored             1.461    0.074   19.620    0.000    1.461    1.324
##     cont              0.000                               0.000    0.000
##     value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           0.512    0.064    7.943    0.000    0.512    0.490
##    .succeed           0.324    0.033    9.970    0.000    0.324    0.363
##    .learning          0.451    0.048    9.436    0.000    0.451    0.471
##    .exp_y             0.193    0.026    7.526    0.000    0.193    0.206
##    .exp_t             0.291    0.044    6.538    0.000    0.291    0.295
##    .imp_y             0.078    0.077    1.011    0.312    0.078    0.078
##    .imp_fut           0.476    0.059    8.122    0.000    0.476    0.477
##    .happy             0.889    0.056   15.933    0.000    0.889    0.806
##    .excited           0.960    0.074   12.934    0.000    0.960    0.909
##    .frustrated        0.672    0.054   12.359    0.000    0.672    0.964
##    .bored             1.074    0.065   16.631    0.000    1.074    0.882
##     cont              0.533    0.076    7.036    0.000    1.000    1.000
##     value             0.921    0.100    9.205    0.000    1.000    1.000
## 
## 
## Group 2 [Quiz and Test]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               0.721    0.680
##     succeed           0.956    0.056   16.952    0.000    0.689    0.771
##     learning          0.795    0.073   10.914    0.000    0.574    0.561
##     exp_y             1.084    0.058   18.628    0.000    0.782    0.862
##     exp_t             1.049    0.061   17.273    0.000    0.757    0.772
##   value =~                                                              
##     imp_y             1.000                               0.907    0.880
##     imp_fut           0.934    0.096    9.708    0.000    0.847    0.754
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont    (.p8.)    0.561    0.035   16.156    0.000    0.405    0.370
##     value   (.p9.)    0.102    0.026    3.875    0.000    0.093    0.085
##   excited ~                                                             
##     cont    (.10.)    0.285    0.037    7.690    0.000    0.205    0.205
##     value   (.11.)    0.161    0.028    5.663    0.000    0.146    0.145
##   frustrated ~                                                          
##     cont    (.12.)   -0.239    0.030   -7.973    0.000   -0.173   -0.189
##     value   (.13.)    0.050    0.023    2.160    0.031    0.045    0.049
##   bored ~                                                               
##     cont    (.14.)   -0.247    0.046   -5.421    0.000   -0.178   -0.153
##     value   (.15.)   -0.272    0.036   -7.527    0.000   -0.246   -0.212
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.499    0.056    8.853    0.000    0.499    0.524
##    .frustrated       -0.144    0.047   -3.051    0.002   -0.144   -0.161
##    .bored            -0.127    0.062   -2.049    0.040   -0.127   -0.116
##  .excited ~~                                                            
##    .frustrated       -0.003    0.044   -0.078    0.938   -0.003   -0.004
##    .bored            -0.006    0.057   -0.101    0.919   -0.006   -0.006
##  .frustrated ~~                                                         
##    .bored             0.284    0.052    5.434    0.000    0.284    0.286
##   cont ~~                                                               
##     value             0.291    0.050    5.805    0.000    0.446    0.446
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.696    0.066   25.614    0.000    1.696    1.600
##    .succeed           1.900    0.049   38.727    0.000    1.900    2.125
##    .learning          1.521    0.057   26.815    0.000    1.521    1.489
##    .exp_y             1.812    0.053   34.451    0.000    1.812    1.997
##    .exp_t             1.763    0.062   28.652    0.000    1.763    1.800
##    .imp_y             1.752    0.063   27.731    0.000    1.752    1.701
##    .imp_fut           1.402    0.079   17.678    0.000    1.402    1.249
##    .happy             1.380    0.073   18.782    0.000    1.380    1.262
##    .excited           0.725    0.062   11.600    0.000    0.725    0.724
##    .frustrated        0.693    0.055   12.678    0.000    0.693    0.760
##    .bored             1.364    0.075   18.245    0.000    1.364    1.174
##     cont              0.000                               0.000    0.000
##     value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           0.604    0.063    9.545    0.000    0.604    0.537
##    .succeed           0.324    0.031   10.486    0.000    0.324    0.405
##    .learning          0.715    0.067   10.665    0.000    0.715    0.685
##    .exp_y             0.212    0.032    6.651    0.000    0.212    0.257
##    .exp_t             0.387    0.051    7.557    0.000    0.387    0.404
##    .imp_y             0.239    0.081    2.931    0.003    0.239    0.225
##    .imp_fut           0.544    0.094    5.798    0.000    0.544    0.432
##    .happy             0.991    0.059   16.790    0.000    0.991    0.828
##    .excited           0.914    0.070   13.074    0.000    0.914    0.910
##    .frustrated        0.807    0.065   12.333    0.000    0.807    0.970
##    .bored             1.219    0.058   21.167    0.000    1.219    0.903
##     cont              0.521    0.065    8.056    0.000    1.000    1.000
##     value             0.822    0.103    7.976    0.000    1.000    1.000
## 
## 
## Group 3 [NaN]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               0.742    0.784
##     succeed           0.857    0.117    7.342    0.000    0.636    0.791
##     learning          0.957    0.162    5.904    0.000    0.710    0.741
##     exp_y             1.176    0.155    7.587    0.000    0.873    0.950
##     exp_t             1.140    0.142    8.019    0.000    0.846    0.917
##   value =~                                                              
##     imp_y             1.000                               0.966    1.144
##     imp_fut           0.491    0.220    2.235    0.025    0.474    0.567
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont    (.p8.)    0.561    0.035   16.156    0.000    0.416    0.423
##     value   (.p9.)    0.102    0.026    3.875    0.000    0.099    0.100
##   excited ~                                                             
##     cont    (.10.)    0.285    0.037    7.690    0.000    0.211    0.264
##     value   (.11.)    0.161    0.028    5.663    0.000    0.155    0.194
##   frustrated ~                                                          
##     cont    (.12.)   -0.239    0.030   -7.973    0.000   -0.177   -0.260
##     value   (.13.)    0.050    0.023    2.160    0.031    0.048    0.070
##   bored ~                                                               
##     cont    (.14.)   -0.247    0.046   -5.421    0.000   -0.183   -0.173
##     value   (.15.)   -0.272    0.036   -7.527    0.000   -0.262   -0.248
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.331    0.183    1.808    0.071    0.331    0.504
##    .frustrated       -0.096    0.092   -1.042    0.297   -0.096   -0.166
##    .bored            -0.083    0.112   -0.738    0.460   -0.083   -0.094
##  .excited ~~                                                            
##    .frustrated       -0.041    0.075   -0.552    0.581   -0.041   -0.084
##    .bored            -0.207    0.104   -1.994    0.046   -0.207   -0.278
##  .frustrated ~~                                                         
##    .bored             0.076    0.072    1.052    0.293    0.076    0.115
##   cont ~~                                                               
##     value             0.122    0.126    0.968    0.333    0.171    0.171
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.302    0.184    7.095    0.000    1.302    1.377
##    .succeed           1.651    0.139   11.920    0.000    1.651    2.055
##    .learning          1.674    0.177    9.482    0.000    1.674    1.748
##    .exp_y             1.605    0.192    8.337    0.000    1.605    1.747
##    .exp_t             1.721    0.187    9.221    0.000    1.721    1.864
##    .imp_y             0.930    0.170    5.487    0.000    0.930    1.101
##    .imp_fut           0.628    0.157    3.990    0.000    0.628    0.751
##    .happy             1.488    0.163    9.147    0.000    1.488    1.512
##    .excited           0.419    0.133    3.153    0.002    0.419    0.524
##    .frustrated        0.465    0.114    4.090    0.000    0.465    0.681
##    .bored             1.395    0.192    7.254    0.000    1.395    1.319
##     cont              0.000                               0.000    0.000
##     value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           0.344    0.105    3.284    0.001    0.344    0.385
##    .succeed           0.242    0.063    3.826    0.000    0.242    0.374
##    .learning          0.413    0.081    5.072    0.000    0.413    0.450
##    .exp_y             0.082    0.045    1.844    0.065    0.082    0.098
##    .exp_t             0.136    0.050    2.700    0.007    0.136    0.160
##    .imp_y            -0.220    0.322   -0.682    0.495   -0.220   -0.308
##    .imp_fut           0.474    0.149    3.182    0.001    0.474    0.678
##    .happy             0.772    0.224    3.453    0.001    0.772    0.797
##    .excited           0.558    0.149    3.737    0.000    0.558    0.875
##    .frustrated        0.436    0.122    3.562    0.000    0.436    0.934
##    .bored             1.000    0.163    6.128    0.000    1.000    0.894
##     cont              0.551    0.132    4.169    0.000    1.000    1.000
##     value             0.933    0.401    2.328    0.020    1.000    1.000
## 
## 
## Group 4 [Non-instructional]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               0.685    0.697
##     succeed           1.031    0.086   12.009    0.000    0.706    0.780
##     learning          0.799    0.090    8.863    0.000    0.547    0.562
##     exp_y             1.203    0.093   12.879    0.000    0.824    0.867
##     exp_t             1.175    0.099   11.820    0.000    0.805    0.849
##   value =~                                                              
##     imp_y             1.000                               0.857    0.884
##     imp_fut           0.777    0.121    6.413    0.000    0.666    0.666
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont    (.p8.)    0.561    0.035   16.156    0.000    0.385    0.379
##     value   (.p9.)    0.102    0.026    3.875    0.000    0.088    0.086
##   excited ~                                                             
##     cont    (.10.)    0.285    0.037    7.690    0.000    0.195    0.209
##     value   (.11.)    0.161    0.028    5.663    0.000    0.138    0.147
##   frustrated ~                                                          
##     cont    (.12.)   -0.239    0.030   -7.973    0.000   -0.164   -0.185
##     value   (.13.)    0.050    0.023    2.160    0.031    0.042    0.048
##   bored ~                                                               
##     cont    (.14.)   -0.247    0.046   -5.421    0.000   -0.169   -0.145
##     value   (.15.)   -0.272    0.036   -7.527    0.000   -0.233   -0.200
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.395    0.054    7.315    0.000    0.395    0.484
##    .frustrated       -0.147    0.051   -2.863    0.004   -0.147   -0.184
##    .bored            -0.002    0.070   -0.033    0.974   -0.002   -0.002
##  .excited ~~                                                            
##    .frustrated       -0.044    0.043   -1.011    0.312   -0.044   -0.056
##    .bored             0.036    0.063    0.564    0.573    0.036    0.036
##  .frustrated ~~                                                         
##    .bored             0.284    0.064    4.463    0.000    0.284    0.292
##   cont ~~                                                               
##     value             0.283    0.056    5.075    0.000    0.481    0.481
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.709    0.072   23.732    0.000    1.709    1.737
##    .succeed           1.772    0.065   27.191    0.000    1.772    1.958
##    .learning          1.391    0.066   20.949    0.000    1.391    1.429
##    .exp_y             1.702    0.070   24.428    0.000    1.702    1.790
##    .exp_t             1.791    0.068   26.239    0.000    1.791    1.888
##    .imp_y             1.142    0.069   16.665    0.000    1.142    1.179
##    .imp_fut           0.907    0.075   12.047    0.000    0.907    0.908
##    .happy             1.497    0.071   21.180    0.000    1.497    1.476
##    .excited           0.768    0.073   10.499    0.000    0.768    0.821
##    .frustrated        0.579    0.058    9.966    0.000    0.579    0.655
##    .bored             1.414    0.085   16.645    0.000    1.414    1.214
##     cont              0.000                               0.000    0.000
##     value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           0.498    0.062    8.090    0.000    0.498    0.515
##    .succeed           0.320    0.045    7.117    0.000    0.320    0.391
##    .learning          0.647    0.068    9.565    0.000    0.647    0.684
##    .exp_y             0.225    0.038    5.847    0.000    0.225    0.249
##    .exp_t             0.252    0.051    4.960    0.000    0.252    0.280
##    .imp_y             0.205    0.102    2.005    0.045    0.205    0.219
##    .imp_fut           0.555    0.079    7.006    0.000    0.555    0.556
##    .happy             0.840    0.077   10.960    0.000    0.840    0.817
##    .excited           0.792    0.072   11.071    0.000    0.792    0.905
##    .frustrated        0.761    0.081    9.455    0.000    0.761    0.972
##    .bored             1.235    0.076   16.321    0.000    1.235    0.911
##     cont              0.469    0.069    6.806    0.000    1.000    1.000
##     value             0.734    0.116    6.309    0.000    1.000    1.000
## 
## 
## Group 5 [Lecture]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               0.678    0.646
##     succeed           1.027    0.057   18.121    0.000    0.696    0.785
##     learning          0.993    0.060   16.505    0.000    0.673    0.721
##     exp_y             1.074    0.066   16.207    0.000    0.728    0.812
##     exp_t             1.135    0.062   18.234    0.000    0.770    0.856
##   value =~                                                              
##     imp_y             1.000                               0.910    0.957
##     imp_fut           0.765    0.067   11.464    0.000    0.696    0.694
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont    (.p8.)    0.561    0.035   16.156    0.000    0.380    0.375
##     value   (.p9.)    0.102    0.026    3.875    0.000    0.093    0.092
##   excited ~                                                             
##     cont    (.10.)    0.285    0.037    7.690    0.000    0.193    0.197
##     value   (.11.)    0.161    0.028    5.663    0.000    0.146    0.149
##   frustrated ~                                                          
##     cont    (.12.)   -0.239    0.030   -7.973    0.000   -0.162   -0.194
##     value   (.13.)    0.050    0.023    2.160    0.031    0.045    0.054
##   bored ~                                                               
##     cont    (.14.)   -0.247    0.046   -5.421    0.000   -0.168   -0.152
##     value   (.15.)   -0.272    0.036   -7.527    0.000   -0.247   -0.225
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.411    0.042    9.684    0.000    0.411    0.478
##    .frustrated       -0.117    0.038   -3.115    0.002   -0.117   -0.155
##    .bored            -0.158    0.048   -3.321    0.001   -0.158   -0.166
##  .excited ~~                                                            
##    .frustrated        0.010    0.035    0.279    0.780    0.010    0.013
##    .bored            -0.045    0.052   -0.877    0.380   -0.045   -0.046
##  .frustrated ~~                                                         
##    .bored             0.223    0.042    5.276    0.000    0.223    0.261
##   cont ~~                                                               
##     value             0.282    0.037    7.570    0.000    0.458    0.458
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.664    0.063   26.407    0.000    1.664    1.586
##    .succeed           2.013    0.046   43.394    0.000    2.013    2.272
##    .learning          1.981    0.049   40.565    0.000    1.981    2.123
##    .exp_y             1.909    0.048   39.632    0.000    1.909    2.129
##    .exp_t             1.956    0.050   39.176    0.000    1.956    2.174
##    .imp_y             1.247    0.056   22.159    0.000    1.247    1.310
##    .imp_fut           0.903    0.062   14.483    0.000    0.903    0.900
##    .happy             1.619    0.062   25.986    0.000    1.619    1.598
##    .excited           0.818    0.058   14.055    0.000    0.818    0.833
##    .frustrated        0.525    0.046   11.409    0.000    0.525    0.629
##    .bored             1.357    0.066   20.561    0.000    1.357    1.232
##     cont              0.000                               0.000    0.000
##     value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           0.641    0.051   12.698    0.000    0.641    0.583
##    .succeed           0.301    0.023   12.977    0.000    0.301    0.383
##    .learning          0.418    0.034   12.115    0.000    0.418    0.480
##    .exp_y             0.274    0.040    6.901    0.000    0.274    0.341
##    .exp_t             0.217    0.026    8.389    0.000    0.217    0.268
##    .imp_y             0.077    0.066    1.171    0.242    0.077    0.085
##    .imp_fut           0.523    0.051   10.203    0.000    0.523    0.519
##    .happy             0.841    0.046   18.308    0.000    0.841    0.819
##    .excited           0.879    0.055   16.034    0.000    0.879    0.912
##    .frustrated        0.677    0.061   11.157    0.000    0.677    0.969
##    .bored             1.086    0.056   19.384    0.000    1.086    0.895
##     cont              0.459    0.057    8.087    0.000    1.000    1.000
##     value             0.828    0.073   11.284    0.000    1.000    1.000
## 
## 
## Group 6 [Laboratory]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               0.770    0.753
##     succeed           1.016    0.040   25.108    0.000    0.782    0.812
##     learning          0.979    0.045   21.784    0.000    0.754    0.789
##     exp_y             1.149    0.044   25.944    0.000    0.885    0.888
##     exp_t             1.061    0.044   24.195    0.000    0.817    0.839
##   value =~                                                              
##     imp_y             1.000                               0.917    0.937
##     imp_fut           0.721    0.054   13.225    0.000    0.661    0.703
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont    (.p8.)    0.561    0.035   16.156    0.000    0.432    0.406
##     value   (.p9.)    0.102    0.026    3.875    0.000    0.094    0.088
##   excited ~                                                             
##     cont    (.10.)    0.285    0.037    7.690    0.000    0.219    0.211
##     value   (.11.)    0.161    0.028    5.663    0.000    0.147    0.141
##   frustrated ~                                                          
##     cont    (.12.)   -0.239    0.030   -7.973    0.000   -0.184   -0.201
##     value   (.13.)    0.050    0.023    2.160    0.031    0.045    0.050
##   bored ~                                                               
##     cont    (.14.)   -0.247    0.046   -5.421    0.000   -0.190   -0.160
##     value   (.15.)   -0.272    0.036   -7.527    0.000   -0.249   -0.210
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.446    0.058    7.651    0.000    0.446    0.478
##    .frustrated       -0.008    0.051   -0.149    0.882   -0.008   -0.009
##    .bored            -0.112    0.061   -1.844    0.065   -0.112   -0.106
##  .excited ~~                                                            
##    .frustrated        0.077    0.050    1.523    0.128    0.077    0.086
##    .bored             0.026    0.062    0.426    0.670    0.026    0.024
##  .frustrated ~~                                                         
##    .bored             0.210    0.056    3.730    0.000    0.210    0.208
##   cont ~~                                                               
##     value             0.392    0.051    7.728    0.000    0.556    0.556
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.615    0.071   22.828    0.000    1.615    1.581
##    .succeed           1.799    0.061   29.492    0.000    1.799    1.868
##    .learning          1.579    0.061   25.884    0.000    1.579    1.652
##    .exp_y             1.674    0.068   24.740    0.000    1.674    1.679
##    .exp_t             1.762    0.064   27.680    0.000    1.762    1.811
##    .imp_y             1.140    0.065   17.488    0.000    1.140    1.164
##    .imp_fut           0.952    0.063   15.219    0.000    0.952    1.013
##    .happy             1.499    0.073   20.548    0.000    1.499    1.409
##    .excited           0.961    0.068   14.025    0.000    0.961    0.923
##    .frustrated        0.635    0.052   12.277    0.000    0.635    0.693
##    .bored             1.224    0.077   15.939    0.000    1.224    1.032
##     cont              0.000                               0.000    0.000
##     value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           0.451    0.053    8.545    0.000    0.451    0.432
##    .succeed           0.316    0.034    9.151    0.000    0.316    0.340
##    .learning          0.345    0.035    9.717    0.000    0.345    0.377
##    .exp_y             0.211    0.029    7.180    0.000    0.211    0.212
##    .exp_t             0.280    0.044    6.420    0.000    0.280    0.296
##    .imp_y             0.118    0.048    2.451    0.014    0.118    0.123
##    .imp_fut           0.446    0.046    9.792    0.000    0.446    0.505
##    .happy             0.892    0.057   15.595    0.000    0.892    0.788
##    .excited           0.977    0.067   14.565    0.000    0.977    0.902
##    .frustrated        0.813    0.071   11.521    0.000    0.813    0.968
##    .bored             1.256    0.065   19.222    0.000    1.256    0.893
##     cont              0.593    0.061    9.716    0.000    1.000    1.000
##     value             0.841    0.075   11.280    0.000    1.000    1.000
## 
## 
## Group 7 [Group Work]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               0.739    0.733
##     succeed           0.959    0.072   13.243    0.000    0.709    0.771
##     learning          0.993    0.080   12.348    0.000    0.734    0.765
##     exp_y             1.105    0.082   13.526    0.000    0.817    0.834
##     exp_t             1.046    0.093   11.216    0.000    0.773    0.801
##   value =~                                                              
##     imp_y             1.000                               1.031    1.014
##     imp_fut           0.615    0.092    6.670    0.000    0.634    0.626
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont    (.p8.)    0.561    0.035   16.156    0.000    0.415    0.408
##     value   (.p9.)    0.102    0.026    3.875    0.000    0.105    0.103
##   excited ~                                                             
##     cont    (.10.)    0.285    0.037    7.690    0.000    0.211    0.202
##     value   (.11.)    0.161    0.028    5.663    0.000    0.165    0.159
##   frustrated ~                                                          
##     cont    (.12.)   -0.239    0.030   -7.973    0.000   -0.177   -0.202
##     value   (.13.)    0.050    0.023    2.160    0.031    0.051    0.059
##   bored ~                                                               
##     cont    (.14.)   -0.247    0.046   -5.421    0.000   -0.183   -0.161
##     value   (.15.)   -0.272    0.036   -7.527    0.000   -0.280   -0.247
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.407    0.065    6.267    0.000    0.407    0.460
##    .frustrated       -0.094    0.055   -1.697    0.090   -0.094   -0.122
##    .bored            -0.106    0.083   -1.279    0.201   -0.106   -0.111
##  .excited ~~                                                            
##    .frustrated        0.056    0.057    0.986    0.324    0.056    0.066
##    .bored            -0.117    0.078   -1.489    0.137   -0.117   -0.111
##  .frustrated ~~                                                         
##    .bored             0.246    0.069    3.586    0.000    0.246    0.270
##   cont ~~                                                               
##     value             0.403    0.060    6.718    0.000    0.528    0.528
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.807    0.081   22.349    0.000    1.807    1.793
##    .succeed           1.867    0.072   25.898    0.000    1.867    2.030
##    .learning          1.667    0.079   21.168    0.000    1.667    1.737
##    .exp_y             1.747    0.084   20.852    0.000    1.747    1.783
##    .exp_t             1.847    0.076   24.371    0.000    1.847    1.913
##    .imp_y             1.185    0.081   14.615    0.000    1.185    1.166
##    .imp_fut           1.004    0.082   12.198    0.000    1.004    0.992
##    .happy             1.570    0.089   17.711    0.000    1.570    1.542
##    .excited           0.976    0.085   11.426    0.000    0.976    0.938
##    .frustrated        0.594    0.076    7.777    0.000    0.594    0.680
##    .bored             1.329    0.096   13.865    0.000    1.329    1.170
##     cont              0.000                               0.000    0.000
##     value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           0.470    0.068    6.863    0.000    0.470    0.462
##    .succeed           0.343    0.058    5.919    0.000    0.343    0.406
##    .learning          0.382    0.057    6.690    0.000    0.382    0.414
##    .exp_y             0.293    0.049    6.004    0.000    0.293    0.305
##    .exp_t             0.334    0.071    4.739    0.000    0.334    0.359
##    .imp_y            -0.029    0.128   -0.230    0.818   -0.029   -0.029
##    .imp_fut           0.623    0.083    7.470    0.000    0.623    0.608
##    .happy             0.808    0.079   10.164    0.000    0.808    0.779
##    .excited           0.973    0.083   11.674    0.000    0.973    0.900
##    .frustrated        0.739    0.093    7.940    0.000    0.739    0.968
##    .bored             1.125    0.086   13.041    0.000    1.125    0.871
##     cont              0.547    0.081    6.778    0.000    1.000    1.000
##     value             1.063    0.141    7.537    0.000    1.000    1.000
## 
## 
## Group 8 [Presentation]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               0.686    0.657
##     succeed           1.061    0.099   10.752    0.000    0.728    0.832
##     learning          1.003    0.120    8.335    0.000    0.688    0.769
##     exp_y             1.242    0.120   10.319    0.000    0.852    0.936
##     exp_t             1.223    0.118   10.353    0.000    0.839    0.911
##   value =~                                                              
##     imp_y             1.000                               0.936    0.981
##     imp_fut           0.560    0.097    5.791    0.000    0.525    0.598
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont    (.p8.)    0.561    0.035   16.156    0.000    0.385    0.434
##     value   (.p9.)    0.102    0.026    3.875    0.000    0.096    0.108
##   excited ~                                                             
##     cont    (.10.)    0.285    0.037    7.690    0.000    0.195    0.199
##     value   (.11.)    0.161    0.028    5.663    0.000    0.150    0.153
##   frustrated ~                                                          
##     cont    (.12.)   -0.239    0.030   -7.973    0.000   -0.164   -0.192
##     value   (.13.)    0.050    0.023    2.160    0.031    0.046    0.054
##   bored ~                                                               
##     cont    (.14.)   -0.247    0.046   -5.421    0.000   -0.170   -0.160
##     value   (.15.)   -0.272    0.036   -7.527    0.000   -0.254   -0.240
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.356    0.062    5.767    0.000    0.356    0.494
##    .frustrated       -0.057    0.053   -1.076    0.282   -0.057   -0.087
##    .bored             0.060    0.058    1.041    0.298    0.060    0.078
##  .excited ~~                                                            
##    .frustrated        0.151    0.058    2.605    0.009    0.151    0.192
##    .bored             0.155    0.071    2.182    0.029    0.155    0.167
##  .frustrated ~~                                                         
##    .bored             0.264    0.071    3.736    0.000    0.264    0.315
##   cont ~~                                                               
##     value             0.309    0.084    3.697    0.000    0.481    0.481
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.712    0.110   15.590    0.000    1.712    1.640
##    .succeed           2.000    0.089   22.365    0.000    2.000    2.285
##    .learning          2.027    0.090   22.615    0.000    2.027    2.267
##    .exp_y             2.037    0.102   19.885    0.000    2.037    2.237
##    .exp_t             2.037    0.101   20.113    0.000    2.037    2.210
##    .imp_y             1.285    0.095   13.581    0.000    1.285    1.346
##    .imp_fut           0.780    0.094    8.320    0.000    0.780    0.889
##    .happy             1.614    0.096   16.840    0.000    1.614    1.818
##    .excited           0.905    0.110    8.240    0.000    0.905    0.921
##    .frustrated        0.481    0.073    6.569    0.000    0.481    0.564
##    .bored             1.207    0.105   11.524    0.000    1.207    1.138
##     cont              0.000                               0.000    0.000
##     value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           0.619    0.083    7.416    0.000    0.619    0.568
##    .succeed           0.236    0.034    6.934    0.000    0.236    0.308
##    .learning          0.326    0.048    6.724    0.000    0.326    0.408
##    .exp_y             0.103    0.027    3.734    0.000    0.103    0.124
##    .exp_t             0.145    0.033    4.465    0.000    0.145    0.171
##    .imp_y             0.034    0.114    0.299    0.765    0.034    0.038
##    .imp_fut           0.493    0.063    7.849    0.000    0.493    0.642
##    .happy             0.595    0.066    9.059    0.000    0.595    0.755
##    .excited           0.876    0.092    9.519    0.000    0.876    0.908
##    .frustrated        0.708    0.106    6.679    0.000    0.708    0.970
##    .bored             0.989    0.084   11.730    0.000    0.989    0.880
##     cont              0.471    0.128    3.687    0.000    1.000    1.000
##     value             0.876    0.121    7.251    0.000    1.000    1.000
library(semTools)
## 
## ###############################################################################
## This is semTools 0.5-1
## All users of R (or SEM) are invited to submit functions or ideas for functions.
## ###############################################################################
## 
## Attaching package: 'semTools'
## The following object is masked from 'package:psych':
## 
##     skew
## The following object is masked from 'package:readr':
## 
##     clipboard
measurementInvariance(model = MG_EMO, data = SciMo_esm, group = "act_re")
## 
## Measurement invariance models:
## 
## Model 1 : fit.configural
## Model 2 : fit.loadings
## Model 3 : fit.intercepts
## Model 4 : fit.means
## 
## Chi Square Difference Test
## 
##                 Df    AIC    BIC   Chisq Chisq diff Df diff Pr(>Chisq)    
## fit.configural 264 102248 104449  795.82                                  
## fit.loadings   299 102225 104207  842.24      46.42      35    0.09389 .  
## fit.intercepts 362 102465 104053 1208.21     365.97      63    < 2e-16 ***
## fit.means      376 102686 104187 1457.89     249.68      14    < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Fit measures:
## 
##                  cfi rmsea cfi.delta rmsea.delta
## fit.configural 0.969 0.065        NA          NA
## fit.loadings   0.968 0.062     0.001       0.003
## fit.intercepts 0.951 0.070     0.018       0.008
## fit.means      0.937 0.077     0.014       0.008

Multigroup SEM items fixed to 1

library(lavaan)

MG_EMO3 <- '
#measurement model
cont =~ control + succeed + learning + exp_y + exp_t
value =~ imp_y + imp_fut
#intercepts
control ~ 1
imp_y ~ 1
#variances fixed to one
cont ~~ 1*cont
value ~~ 1*value
#regressions
happy ~ cont + value
excited ~ cont + value
frustrated ~ cont + value
bored ~ cont + value
#residual correlations
happy ~~ excited + frustrated + bored
excited ~~ frustrated + bored
frustrated ~~ bored
cont ~~ value
'

fit6<-sem(MG_EMO3, data=SciMo_esm, cluster = "uniqueid", group = "act_re", se = "robust.cluster.sem") #meanstructure = TRUE)
summary(fit6, fit.measures=TRUE, standardized = TRUE)
## lavaan 0.6-3 ended normally after 126 iterations
## 
##   Optimization method                           NLMINB
##   Number of free parameters                        336
## 
##                                                   Used       Total
##   Number of observations per group         
##   Individual Work                                  633         671
##   Number of clusters [uniqueid]                    198
##   Quiz and Test                                    629         688
##   Number of clusters [uniqueid]                    179
##   NaN                                               43          51
##   Number of clusters [uniqueid]                     22
##   Non-instructional                                302         322
##   Number of clusters [uniqueid]                    159
##   Lecture                                          746         791
##   Number of clusters [uniqueid]                    202
##   Laboratory                                       941        1023
##   Number of clusters [uniqueid]                    141
##   Group Work                                       249         271
##   Number of clusters [uniqueid]                    127
##   Presentation                                     295         313
##   Number of clusters [uniqueid]                     70
## 
##   Estimator                                         ML      Robust
##   Model Fit Test Statistic                    1091.391     709.664
##   Degrees of freedom                               280         280
##   P-value (Chi-square)                           0.000       0.000
##   Scaling correction factor                                  1.538
##     for the Yuan-Bentler correction (Mplus variant)
## 
## Chi-square for each group:
## 
##   Individual Work                              145.454      94.580
##   Quiz and Test                                131.823      85.716
##   NaN                                           52.765      34.309
##   Non-instructional                            116.780      75.935
##   Lecture                                      209.144     135.993
##   Laboratory                                   200.651     130.471
##   Group Work                                   119.918      77.975
##   Presentation                                 114.856      74.684
## 
## Model test baseline model:
## 
##   Minimum Function Test Statistic            17567.287   11181.798
##   Degrees of freedom                               440         440
##   P-value                                        0.000       0.000
## 
## User model versus baseline model:
## 
##   Comparative Fit Index (CFI)                    0.953       0.960
##   Tucker-Lewis Index (TLI)                       0.926       0.937
## 
##   Robust Comparative Fit Index (CFI)                         0.961
##   Robust Tucker-Lewis Index (TLI)                            0.938
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)             -50919.995  -50919.995
##   Scaling correction factor                                  1.752
##     for the MLR correction
##   Loglikelihood unrestricted model (H1)     -50374.299  -50374.299
##   Scaling correction factor                                  1.655
##     for the MLR correction
## 
##   Number of free parameters                        336         336
##   Akaike (AIC)                              102511.990  102511.990
##   Bayesian (BIC)                            104612.899  104612.899
##   Sample-size adjusted Bayesian (BIC)       103545.248  103545.248
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.078       0.057
##   90 Percent Confidence Interval          0.073  0.083       0.052  0.061
##   P-value RMSEA <= 0.05                          0.000       0.005
## 
##   Robust RMSEA                                               0.070
##   90 Percent Confidence Interval                             0.064  0.077
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.136       0.136
## 
## Parameter Estimates:
## 
##   Information                                 Expected
##   Information saturated (h1) model          Structured
##   Standard Errors                   Robust.cluster.sem
## 
## 
## Group 1 [Individual Work]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               1.000    0.813
##     succeed           0.864    0.034   25.588    0.000    0.864    0.834
##     learning          0.818    0.031   26.719    0.000    0.818    0.773
##     exp_y             0.987    0.030   32.600    0.000    0.987    0.912
##     exp_t             0.954    0.034   28.083    0.000    0.954    0.869
##   value =~                                                              
##     imp_y             1.000                               1.000    0.968
##     imp_fut           0.744    0.046   16.048    0.000    0.744    0.731
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont              0.527    0.051   10.357    0.000    0.527    0.482
##     value             0.057    0.063    0.902    0.367    0.057    0.052
##   excited ~                                                             
##     cont              0.190    0.060    3.150    0.002    0.190    0.186
##     value             0.146    0.070    2.084    0.037    0.146    0.142
##   frustrated ~                                                          
##     cont             -0.217    0.044   -4.877    0.000   -0.217   -0.256
##     value            -0.008    0.047   -0.177    0.860   -0.008   -0.010
##   bored ~                                                               
##     cont             -0.221    0.085   -2.592    0.010   -0.221   -0.193
##     value            -0.331    0.094   -3.522    0.000   -0.331   -0.290
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.479    0.058    8.222    0.000    0.479    0.521
##    .frustrated       -0.063    0.038   -1.661    0.097   -0.063   -0.081
##    .bored            -0.175    0.053   -3.278    0.001   -0.175   -0.180
##  .excited ~~                                                            
##    .frustrated        0.031    0.044    0.712    0.476    0.031    0.039
##    .bored            -0.145    0.054   -2.683    0.007   -0.145   -0.144
##  .frustrated ~~                                                         
##    .bored             0.151    0.042    3.587    0.000    0.151    0.179
##   cont ~~                                                               
##     value             0.507    0.064    7.980    0.000    0.507    0.507
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.635    0.066   24.606    0.000    1.635    1.329
##    .imp_y             1.166    0.071   16.468    0.000    1.166    1.128
##    .succeed           1.750    0.056   31.244    0.000    1.750    1.690
##    .learning          1.659    0.056   29.650    0.000    1.659    1.567
##    .exp_y             1.712    0.064   26.555    0.000    1.712    1.583
##    .exp_t             1.701    0.064   26.398    0.000    1.701    1.551
##    .imp_fut           0.968    0.071   13.577    0.000    0.968    0.952
##    .happy             1.479    0.076   19.432    0.000    1.479    1.354
##    .excited           0.817    0.071   11.443    0.000    0.817    0.799
##    .frustrated        0.613    0.051   11.975    0.000    0.613    0.724
##    .bored             1.461    0.074   19.620    0.000    1.461    1.281
##     cont              0.000                               0.000    0.000
##     value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     cont              1.000                               1.000    1.000
##     value             1.000                               1.000    1.000
##    .control           0.514    0.073    7.058    0.000    0.514    0.340
##    .succeed           0.326    0.032   10.266    0.000    0.326    0.304
##    .learning          0.450    0.047    9.646    0.000    0.450    0.402
##    .exp_y             0.197    0.025    7.917    0.000    0.197    0.168
##    .exp_t             0.294    0.044    6.760    0.000    0.294    0.245
##    .imp_y             0.068    0.046    1.482    0.138    0.068    0.063
##    .imp_fut           0.482    0.049    9.922    0.000    0.482    0.465
##    .happy             0.882    0.058   15.297    0.000    0.882    0.739
##    .excited           0.960    0.074   12.987    0.000    0.960    0.918
##    .frustrated        0.668    0.053   12.593    0.000    0.668    0.932
##    .bored             1.068    0.068   15.622    0.000    1.068    0.822
## 
## 
## Group 2 [Quiz and Test]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               1.000    0.792
##     succeed           0.781    0.031   25.375    0.000    0.781    0.808
##     learning          0.650    0.045   14.509    0.000    0.650    0.609
##     exp_y             0.878    0.030   29.424    0.000    0.878    0.881
##     exp_t             0.852    0.031   27.318    0.000    0.852    0.805
##   value =~                                                              
##     imp_y             1.000                               1.000    0.928
##     imp_fut           0.851    0.051   16.773    0.000    0.851    0.739
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont              0.494    0.057    8.644    0.000    0.494    0.444
##     value             0.014    0.067    0.203    0.839    0.014    0.012
##   excited ~                                                             
##     cont              0.268    0.050    5.350    0.000    0.268    0.269
##     value             0.043    0.054    0.800    0.424    0.043    0.043
##   frustrated ~                                                          
##     cont             -0.242    0.053   -4.578    0.000   -0.242   -0.263
##     value             0.090    0.055    1.650    0.099    0.090    0.098
##   bored ~                                                               
##     cont             -0.251    0.067   -3.745    0.000   -0.251   -0.212
##     value            -0.240    0.074   -3.231    0.001   -0.240   -0.203
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.494    0.057    8.712    0.000    0.494    0.522
##    .frustrated       -0.139    0.048   -2.887    0.004   -0.139   -0.156
##    .bored            -0.127    0.061   -2.073    0.038   -0.127   -0.116
##  .excited ~~                                                            
##    .frustrated        0.001    0.043    0.015    0.988    0.001    0.001
##    .bored            -0.009    0.056   -0.155    0.877   -0.009   -0.008
##  .frustrated ~~                                                         
##    .bored             0.282    0.052    5.398    0.000    0.282    0.285
##   cont ~~                                                               
##     value             0.493    0.048   10.238    0.000    0.493    0.493
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.696    0.066   25.614    0.000    1.696    1.344
##    .imp_y             1.752    0.063   27.731    0.000    1.752    1.626
##    .succeed           1.900    0.049   38.727    0.000    1.900    1.967
##    .learning          1.521    0.057   26.815    0.000    1.521    1.427
##    .exp_y             1.812    0.053   34.451    0.000    1.812    1.820
##    .exp_t             1.763    0.062   28.652    0.000    1.763    1.667
##    .imp_fut           1.402    0.079   17.678    0.000    1.402    1.219
##    .happy             1.380    0.073   18.782    0.000    1.380    1.242
##    .excited           0.725    0.062   11.600    0.000    0.725    0.727
##    .frustrated        0.693    0.055   12.678    0.000    0.693    0.753
##    .bored             1.364    0.075   18.245    0.000    1.364    1.153
##     cont              0.000                               0.000    0.000
##     value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     cont              1.000                               1.000    1.000
##     value             1.000                               1.000    1.000
##    .control           0.593    0.068    8.693    0.000    0.593    0.372
##    .succeed           0.323    0.030   10.794    0.000    0.323    0.347
##    .learning          0.715    0.066   10.845    0.000    0.715    0.629
##    .exp_y             0.222    0.031    7.099    0.000    0.222    0.224
##    .exp_t             0.394    0.051    7.707    0.000    0.394    0.352
##    .imp_y             0.161    0.049    3.282    0.001    0.161    0.139
##    .imp_fut           0.600    0.071    8.400    0.000    0.600    0.453
##    .happy             0.984    0.060   16.361    0.000    0.984    0.797
##    .excited           0.909    0.071   12.890    0.000    0.909    0.914
##    .frustrated        0.802    0.066   12.144    0.000    0.802    0.946
##    .bored             1.220    0.059   20.675    0.000    1.220    0.872
## 
## 
## Group 3 [NaN]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               1.000    0.868
##     succeed           0.709    0.088    8.068    0.000    0.709    0.821
##     learning          0.794    0.101    7.825    0.000    0.794    0.778
##     exp_y             0.973    0.103    9.476    0.000    0.973    0.958
##     exp_t             0.945    0.097    9.737    0.000    0.945    0.931
##   value =~                                                              
##     imp_y             1.000                               1.000    1.150
##     imp_fut           0.481    0.114    4.228    0.000    0.481    0.569
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont              0.172    0.125    1.378    0.168    0.172    0.209
##     value            -0.097    0.139   -0.696    0.487   -0.097   -0.118
##   excited ~                                                             
##     cont             -0.051    0.122   -0.418    0.676   -0.051   -0.074
##     value             0.067    0.141    0.472    0.637    0.067    0.097
##   frustrated ~                                                          
##     cont             -0.200    0.069   -2.914    0.004   -0.200   -0.286
##     value             0.256    0.119    2.148    0.032    0.256    0.366
##   bored ~                                                               
##     cont             -0.218    0.197   -1.107    0.268   -0.218   -0.204
##     value            -0.264    0.133   -1.991    0.046   -0.264   -0.247
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.225    0.137    1.638    0.102    0.225    0.409
##    .frustrated       -0.046    0.064   -0.728    0.467   -0.046   -0.091
##    .bored            -0.067    0.100   -0.668    0.504   -0.067   -0.084
##  .excited ~~                                                            
##    .frustrated       -0.006    0.051   -0.111    0.912   -0.006   -0.013
##    .bored            -0.204    0.107   -1.905    0.057   -0.204   -0.297
##  .frustrated ~~                                                         
##    .bored             0.054    0.073    0.739    0.460    0.054    0.084
##   cont ~~                                                               
##     value             0.194    0.155    1.255    0.210    0.194    0.194
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.302    0.184    7.095    0.000    1.302    1.130
##    .imp_y             0.930    0.170    5.487    0.000    0.930    1.070
##    .succeed           1.651    0.139   11.920    0.000    1.651    1.913
##    .learning          1.674    0.177    9.482    0.000    1.674    1.640
##    .exp_y             1.605    0.192    8.337    0.000    1.605    1.580
##    .exp_t             1.721    0.187    9.221    0.000    1.721    1.696
##    .imp_fut           0.628    0.157    3.990    0.000    0.628    0.743
##    .happy             1.488    0.163    9.147    0.000    1.488    1.814
##    .excited           0.419    0.133    3.153    0.002    0.419    0.606
##    .frustrated        0.465    0.114    4.090    0.000    0.465    0.665
##    .bored             1.395    0.192    7.254    0.000    1.395    1.305
##     cont              0.000                               0.000    0.000
##     value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     cont              1.000                               1.000    1.000
##     value             1.000                               1.000    1.000
##    .control           0.329    0.113    2.909    0.004    0.329    0.247
##    .succeed           0.243    0.062    3.892    0.000    0.243    0.326
##    .learning          0.412    0.079    5.183    0.000    0.412    0.395
##    .exp_y             0.085    0.042    2.015    0.044    0.085    0.083
##    .exp_t             0.137    0.050    2.741    0.006    0.137    0.133
##    .imp_y            -0.244    0.109   -2.250    0.024   -0.244   -0.323
##    .imp_fut           0.484    0.110    4.406    0.000    0.484    0.676
##    .happy             0.641    0.147    4.345    0.000    0.641    0.952
##    .excited           0.471    0.127    3.718    0.000    0.471    0.988
##    .frustrated        0.403    0.092    4.371    0.000    0.403    0.825
##    .bored             1.004    0.162    6.196    0.000    1.004    0.878
## 
## 
## Group 4 [Non-instructional]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               1.000    0.819
##     succeed           0.833    0.042   19.621    0.000    0.833    0.830
##     learning          0.639    0.051   12.461    0.000    0.639    0.621
##     exp_y             0.961    0.040   23.881    0.000    0.961    0.894
##     exp_t             0.936    0.043   21.743    0.000    0.936    0.877
##   value =~                                                              
##     imp_y             1.000                               1.000    0.952
##     imp_fut           0.681    0.064   10.680    0.000    0.681    0.659
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont              0.411    0.071    5.775    0.000    0.411    0.395
##     value             0.129    0.067    1.928    0.054    0.129    0.124
##   excited ~                                                             
##     cont              0.204    0.078    2.610    0.009    0.204    0.212
##     value             0.218    0.082    2.660    0.008    0.218    0.226
##   frustrated ~                                                          
##     cont             -0.160    0.063   -2.541    0.011   -0.160   -0.182
##     value             0.103    0.072    1.434    0.152    0.103    0.117
##   bored ~                                                               
##     cont             -0.314    0.082   -3.846    0.000   -0.314   -0.268
##     value            -0.110    0.095   -1.154    0.249   -0.110   -0.093
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.395    0.055    7.162    0.000    0.395    0.485
##    .frustrated       -0.150    0.051   -2.928    0.003   -0.150   -0.187
##    .bored            -0.006    0.068   -0.082    0.935   -0.006   -0.005
##  .excited ~~                                                            
##    .frustrated       -0.048    0.042   -1.139    0.255   -0.048   -0.062
##    .bored             0.027    0.061    0.439    0.661    0.027    0.027
##  .frustrated ~~                                                         
##    .bored             0.278    0.062    4.481    0.000    0.278    0.288
##   cont ~~                                                               
##     value             0.539    0.053   10.180    0.000    0.539    0.539
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.709    0.072   23.732    0.000    1.709    1.399
##    .imp_y             1.142    0.069   16.665    0.000    1.142    1.088
##    .succeed           1.772    0.065   27.191    0.000    1.772    1.765
##    .learning          1.391    0.066   20.949    0.000    1.391    1.352
##    .exp_y             1.702    0.070   24.428    0.000    1.702    1.583
##    .exp_t             1.791    0.068   26.239    0.000    1.791    1.679
##    .imp_fut           0.907    0.075   12.047    0.000    0.907    0.878
##    .happy             1.497    0.071   21.180    0.000    1.497    1.437
##    .excited           0.768    0.073   10.499    0.000    0.768    0.798
##    .frustrated        0.579    0.058    9.966    0.000    0.579    0.658
##    .bored             1.414    0.085   16.645    0.000    1.414    1.205
##     cont              0.000                               0.000    0.000
##     value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     cont              1.000                               1.000    1.000
##     value             1.000                               1.000    1.000
##    .control           0.493    0.073    6.786    0.000    0.493    0.330
##    .succeed           0.314    0.042    7.444    0.000    0.314    0.311
##    .learning          0.649    0.067    9.761    0.000    0.649    0.614
##    .exp_y             0.232    0.037    6.245    0.000    0.232    0.201
##    .exp_t             0.263    0.050    5.289    0.000    0.263    0.231
##    .imp_y             0.103    0.067    1.551    0.121    0.103    0.094
##    .imp_fut           0.604    0.057   10.527    0.000    0.604    0.566
##    .happy             0.843    0.077   10.887    0.000    0.843    0.776
##    .excited           0.790    0.074   10.701    0.000    0.790    0.852
##    .frustrated        0.758    0.081    9.326    0.000    0.758    0.976
##    .bored             1.228    0.074   16.686    0.000    1.228    0.892
## 
## 
## Group 5 [Lecture]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               1.000    0.778
##     succeed           0.806    0.029   27.725    0.000    0.806    0.827
##     learning          0.780    0.028   27.499    0.000    0.780    0.770
##     exp_y             0.837    0.026   31.956    0.000    0.837    0.845
##     exp_t             0.885    0.027   32.431    0.000    0.885    0.882
##   value =~                                                              
##     imp_y             1.000                               1.000    1.010
##     imp_fut           0.686    0.045   15.260    0.000    0.686    0.672
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont              0.508    0.044   11.524    0.000    0.508    0.484
##     value             0.023    0.050    0.448    0.654    0.023    0.021
##   excited ~                                                             
##     cont              0.255    0.050    5.113    0.000    0.255    0.258
##     value             0.102    0.050    2.043    0.041    0.102    0.103
##   frustrated ~                                                          
##     cont             -0.292    0.043   -6.779    0.000   -0.292   -0.339
##     value             0.044    0.040    1.107    0.268    0.044    0.051
##   bored ~                                                               
##     cont             -0.336    0.056   -5.975    0.000   -0.336   -0.297
##     value            -0.178    0.058   -3.067    0.002   -0.178   -0.157
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.408    0.042    9.773    0.000    0.408    0.477
##    .frustrated       -0.109    0.037   -2.908    0.004   -0.109   -0.146
##    .bored            -0.150    0.049   -3.093    0.002   -0.150   -0.159
##  .excited ~~                                                            
##    .frustrated        0.013    0.035    0.379    0.705    0.013    0.017
##    .bored            -0.044    0.051   -0.849    0.396   -0.044   -0.045
##  .frustrated ~~                                                         
##    .bored             0.210    0.042    5.046    0.000    0.210    0.248
##   cont ~~                                                               
##     value             0.499    0.035   14.078    0.000    0.499    0.499
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.664    0.063   26.407    0.000    1.664    1.295
##    .imp_y             1.247    0.056   22.159    0.000    1.247    1.259
##    .succeed           2.013    0.046   43.394    0.000    2.013    2.065
##    .learning          1.981    0.049   40.565    0.000    1.981    1.956
##    .exp_y             1.909    0.048   39.632    0.000    1.909    1.926
##    .exp_t             1.956    0.050   39.176    0.000    1.956    1.948
##    .imp_fut           0.903    0.062   14.483    0.000    0.903    0.885
##    .happy             1.619    0.062   25.986    0.000    1.619    1.542
##    .excited           0.818    0.058   14.055    0.000    0.818    0.826
##    .frustrated        0.525    0.046   11.409    0.000    0.525    0.611
##    .bored             1.357    0.066   20.561    0.000    1.357    1.198
##     cont              0.000                               0.000    0.000
##     value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     cont              1.000                               1.000    1.000
##     value             1.000                               1.000    1.000
##    .control           0.651    0.055   11.826    0.000    0.651    0.394
##    .succeed           0.301    0.023   13.333    0.000    0.301    0.317
##    .learning          0.417    0.034   12.445    0.000    0.417    0.407
##    .exp_y             0.281    0.039    7.285    0.000    0.281    0.286
##    .exp_t             0.224    0.025    8.929    0.000    0.224    0.222
##    .imp_y            -0.019    0.042   -0.454    0.650   -0.019   -0.019
##    .imp_fut           0.571    0.042   13.641    0.000    0.571    0.548
##    .happy             0.833    0.046   18.069    0.000    0.833    0.755
##    .excited           0.879    0.054   16.298    0.000    0.879    0.897
##    .frustrated        0.665    0.059   11.258    0.000    0.665    0.900
##    .bored             1.077    0.058   18.644    0.000    1.077    0.841
## 
## 
## Group 6 [Laboratory]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               1.000    0.832
##     succeed           0.874    0.029   30.291    0.000    0.874    0.840
##     learning          0.843    0.031   27.630    0.000    0.843    0.820
##     exp_y             0.990    0.024   42.040    0.000    0.990    0.907
##     exp_t             0.915    0.029   31.302    0.000    0.915    0.866
##   value =~                                                              
##     imp_y             1.000                               1.000    0.959
##     imp_fut           0.692    0.043   15.977    0.000    0.692    0.714
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont              0.402    0.055    7.322    0.000    0.402    0.367
##     value             0.216    0.059    3.642    0.000    0.216    0.197
##   excited ~                                                             
##     cont              0.239    0.064    3.720    0.000    0.239    0.223
##     value             0.222    0.066    3.373    0.001    0.222    0.208
##   frustrated ~                                                          
##     cont             -0.066    0.048   -1.382    0.167   -0.066   -0.073
##     value             0.052    0.057    0.905    0.366    0.052    0.058
##   bored ~                                                               
##     cont             -0.055    0.074   -0.744    0.457   -0.055   -0.048
##     value            -0.245    0.079   -3.103    0.002   -0.245   -0.214
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.442    0.058    7.561    0.000    0.442    0.476
##    .frustrated       -0.012    0.050   -0.233    0.816   -0.012   -0.014
##    .bored            -0.116    0.059   -1.955    0.051   -0.116   -0.111
##  .excited ~~                                                            
##    .frustrated        0.071    0.051    1.391    0.164    0.071    0.080
##    .bored             0.019    0.061    0.314    0.753    0.019    0.017
##  .frustrated ~~                                                         
##    .bored             0.194    0.054    3.615    0.000    0.194    0.195
##   cont ~~                                                               
##     value             0.600    0.035   17.218    0.000    0.600    0.600
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.615    0.071   22.828    0.000    1.615    1.345
##    .imp_y             1.140    0.065   17.488    0.000    1.140    1.094
##    .succeed           1.799    0.061   29.492    0.000    1.799    1.729
##    .learning          1.579    0.061   25.884    0.000    1.579    1.536
##    .exp_y             1.674    0.068   24.740    0.000    1.674    1.533
##    .exp_t             1.762    0.064   27.680    0.000    1.762    1.668
##    .imp_fut           0.952    0.063   15.219    0.000    0.952    0.982
##    .happy             1.499    0.073   20.548    0.000    1.499    1.369
##    .excited           0.961    0.068   14.025    0.000    0.961    0.898
##    .frustrated        0.635    0.052   12.277    0.000    0.635    0.709
##    .bored             1.224    0.077   15.939    0.000    1.224    1.066
##     cont              0.000                               0.000    0.000
##     value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     cont              1.000                               1.000    1.000
##     value             1.000                               1.000    1.000
##    .control           0.443    0.055    8.023    0.000    0.443    0.307
##    .succeed           0.318    0.034    9.313    0.000    0.318    0.294
##    .learning          0.346    0.035    9.863    0.000    0.346    0.328
##    .exp_y             0.211    0.029    7.206    0.000    0.211    0.177
##    .exp_t             0.279    0.043    6.467    0.000    0.279    0.250
##    .imp_y             0.087    0.043    2.033    0.042    0.087    0.080
##    .imp_fut           0.460    0.043   10.616    0.000    0.460    0.490
##    .happy             0.886    0.059   15.086    0.000    0.886    0.739
##    .excited           0.974    0.068   14.358    0.000    0.974    0.852
##    .frustrated        0.801    0.067   11.910    0.000    0.801    0.996
##    .bored             1.239    0.059   20.983    0.000    1.239    0.940
## 
## 
## Group 7 [Group Work]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               1.000    0.826
##     succeed           0.810    0.041   19.713    0.000    0.810    0.809
##     learning          0.833    0.043   19.336    0.000    0.833    0.799
##     exp_y             0.937    0.042   22.565    0.000    0.937    0.867
##     exp_t             0.889    0.048   18.634    0.000    0.889    0.839
##   value =~                                                              
##     imp_y             1.000                               1.000    0.968
##     imp_fut           0.677    0.069    9.867    0.000    0.677    0.664
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont              0.415    0.095    4.367    0.000    0.415    0.392
##     value             0.209    0.092    2.273    0.023    0.209    0.197
##   excited ~                                                             
##     cont              0.267    0.087    3.066    0.002    0.267    0.250
##     value             0.203    0.109    1.861    0.063    0.203    0.190
##   frustrated ~                                                          
##     cont             -0.282    0.078   -3.627    0.000   -0.282   -0.313
##     value            -0.029    0.072   -0.406    0.685   -0.029   -0.033
##   bored ~                                                               
##     cont             -0.235    0.108   -2.179    0.029   -0.235   -0.198
##     value            -0.390    0.115   -3.403    0.001   -0.390   -0.328
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.402    0.067    6.045    0.000    0.402    0.457
##    .frustrated       -0.087    0.056   -1.537    0.124   -0.087   -0.114
##    .bored            -0.094    0.083   -1.138    0.255   -0.094   -0.100
##  .excited ~~                                                            
##    .frustrated        0.063    0.054    1.163    0.245    0.063    0.076
##    .bored            -0.103    0.075   -1.366    0.172   -0.103   -0.100
##  .frustrated ~~                                                         
##    .bored             0.231    0.073    3.174    0.002    0.231    0.259
##   cont ~~                                                               
##     value             0.584    0.050   11.578    0.000    0.584    0.584
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.807    0.081   22.349    0.000    1.807    1.493
##    .imp_y             1.185    0.081   14.615    0.000    1.185    1.147
##    .succeed           1.867    0.072   25.898    0.000    1.867    1.866
##    .learning          1.667    0.079   21.168    0.000    1.667    1.599
##    .exp_y             1.747    0.084   20.852    0.000    1.747    1.616
##    .exp_t             1.847    0.076   24.371    0.000    1.847    1.745
##    .imp_fut           1.004    0.082   12.198    0.000    1.004    0.983
##    .happy             1.570    0.089   17.711    0.000    1.570    1.484
##    .excited           0.976    0.085   11.426    0.000    0.976    0.914
##    .frustrated        0.594    0.076    7.777    0.000    0.594    0.661
##    .bored             1.329    0.096   13.865    0.000    1.329    1.116
##     cont              0.000                               0.000    0.000
##     value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     cont              1.000                               1.000    1.000
##     value             1.000                               1.000    1.000
##    .control           0.465    0.072    6.456    0.000    0.465    0.317
##    .succeed           0.346    0.058    5.936    0.000    0.346    0.345
##    .learning          0.393    0.058    6.806    0.000    0.393    0.362
##    .exp_y             0.291    0.048    6.026    0.000    0.291    0.249
##    .exp_t             0.331    0.069    4.829    0.000    0.331    0.295
##    .imp_y             0.068    0.074    0.914    0.361    0.068    0.063
##    .imp_fut           0.583    0.074    7.900    0.000    0.583    0.560
##    .happy             0.803    0.081    9.893    0.000    0.803    0.717
##    .excited           0.964    0.086   11.167    0.000    0.964    0.846
##    .frustrated        0.718    0.092    7.822    0.000    0.718    0.889
##    .bored             1.104    0.098   11.258    0.000    1.104    0.778
## 
## 
## Group 8 [Presentation]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               1.000    0.781
##     succeed           0.850    0.047   18.087    0.000    0.850    0.869
##     learning          0.802    0.053   15.049    0.000    0.802    0.815
##     exp_y             0.991    0.048   20.495    0.000    0.991    0.950
##     exp_t             0.978    0.049   19.772    0.000    0.978    0.931
##   value =~                                                              
##     imp_y             1.000                               1.000    0.977
##     imp_fut           0.568    0.070    8.157    0.000    0.568    0.631
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont              0.508    0.071    7.183    0.000    0.508    0.534
##     value             0.088    0.065    1.367    0.172    0.088    0.093
##   excited ~                                                             
##     cont              0.337    0.084    4.006    0.000    0.337    0.322
##     value             0.214    0.084    2.566    0.010    0.214    0.205
##   frustrated ~                                                          
##     cont             -0.180    0.096   -1.878    0.060   -0.180   -0.211
##     value             0.094    0.093    1.014    0.311    0.094    0.111
##   bored ~                                                               
##     cont             -0.182    0.102   -1.786    0.074   -0.182   -0.168
##     value            -0.303    0.107   -2.822    0.005   -0.303   -0.280
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.347    0.063    5.529    0.000    0.347    0.489
##    .frustrated       -0.058    0.051   -1.137    0.256   -0.058   -0.090
##    .bored             0.061    0.056    1.089    0.276    0.061    0.080
##  .excited ~~                                                            
##    .frustrated        0.147    0.055    2.672    0.008    0.147    0.189
##    .bored             0.159    0.068    2.320    0.020    0.159    0.173
##  .frustrated ~~                                                         
##    .bored             0.266    0.070    3.776    0.000    0.266    0.319
##   cont ~~                                                               
##     value             0.558    0.055   10.067    0.000    0.558    0.558
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.712    0.110   15.590    0.000    1.712    1.337
##    .imp_y             1.285    0.095   13.581    0.000    1.285    1.255
##    .succeed           2.000    0.089   22.365    0.000    2.000    2.044
##    .learning          2.027    0.090   22.615    0.000    2.027    2.059
##    .exp_y             2.037    0.102   19.885    0.000    2.037    1.952
##    .exp_t             2.037    0.101   20.113    0.000    2.037    1.940
##    .imp_fut           0.780    0.094    8.320    0.000    0.780    0.865
##    .happy             1.614    0.096   16.840    0.000    1.614    1.697
##    .excited           0.905    0.110    8.240    0.000    0.905    0.865
##    .frustrated        0.481    0.073    6.569    0.000    0.481    0.564
##    .bored             1.207    0.105   11.524    0.000    1.207    1.114
##     cont              0.000                               0.000    0.000
##     value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     cont              1.000                               1.000    1.000
##     value             1.000                               1.000    1.000
##    .control           0.639    0.094    6.831    0.000    0.639    0.390
##    .succeed           0.234    0.034    6.905    0.000    0.234    0.245
##    .learning          0.326    0.048    6.819    0.000    0.326    0.336
##    .exp_y             0.106    0.027    3.886    0.000    0.106    0.098
##    .exp_t             0.146    0.032    4.557    0.000    0.146    0.133
##    .imp_y             0.048    0.067    0.712    0.476    0.048    0.045
##    .imp_fut           0.488    0.055    8.866    0.000    0.488    0.602
##    .happy             0.589    0.068    8.650    0.000    0.589    0.651
##    .excited           0.856    0.086    9.932    0.000    0.856    0.781
##    .frustrated        0.706    0.108    6.555    0.000    0.706    0.969
##    .bored             0.987    0.086   11.488    0.000    0.987    0.841
library(semTools)
measurementInvariance(model = MG_EMO, data = SciMo_esm, group = "act_re")
## 
## Measurement invariance models:
## 
## Model 1 : fit.configural
## Model 2 : fit.loadings
## Model 3 : fit.intercepts
## Model 4 : fit.means
## 
## Chi Square Difference Test
## 
##                 Df    AIC    BIC   Chisq Chisq diff Df diff Pr(>Chisq)    
## fit.configural 264 102248 104449  795.82                                  
## fit.loadings   299 102225 104207  842.24      46.42      35    0.09389 .  
## fit.intercepts 362 102465 104053 1208.21     365.97      63    < 2e-16 ***
## fit.means      376 102686 104187 1457.89     249.68      14    < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## Fit measures:
## 
##                  cfi rmsea cfi.delta rmsea.delta
## fit.configural 0.969 0.065        NA          NA
## fit.loadings   0.968 0.062     0.001       0.003
## fit.intercepts 0.951 0.070     0.018       0.008
## fit.means      0.937 0.077     0.014       0.008

Multigroup SEM model

library(lavaan)

MG_EMO2 <- '
#measurement model
cont =~ control + succeed + learning + exp_y + exp_t
value =~ imp_y + imp_fut
#regressions
happy ~ cont + value
excited ~ cont + value
frustrated ~ cont + value
bored ~ cont + value
#residual correlations
happy ~~ excited + frustrated + bored
excited ~~ frustrated + bored
frustrated ~~ bored
cont ~~ value
'

fit4<-sem(MG_EMO2, data=SciMo_esm, cluster = "uniqueid", group = "act_re", se = "robust.cluster.sem")
summary(fit4, fit.measures=TRUE, standardized = TRUE)
## lavaan 0.6-3 ended normally after 165 iterations
## 
##   Optimization method                           NLMINB
##   Number of free parameters                        352
## 
##                                                   Used       Total
##   Number of observations per group         
##   Individual Work                                  633         671
##   Number of clusters [uniqueid]                    198
##   Quiz and Test                                    629         688
##   Number of clusters [uniqueid]                    179
##   NaN                                               43          51
##   Number of clusters [uniqueid]                     22
##   Non-instructional                                302         322
##   Number of clusters [uniqueid]                    159
##   Lecture                                          746         791
##   Number of clusters [uniqueid]                    202
##   Laboratory                                       941        1023
##   Number of clusters [uniqueid]                    141
##   Group Work                                       249         271
##   Number of clusters [uniqueid]                    127
##   Presentation                                     295         313
##   Number of clusters [uniqueid]                     70
## 
##   Estimator                                         ML      Robust
##   Model Fit Test Statistic                     795.825     560.718
##   Degrees of freedom                               264         264
##   P-value (Chi-square)                           0.000       0.000
##   Scaling correction factor                                  1.419
##     for the Yuan-Bentler correction (Mplus variant)
## 
## Chi-square for each group:
## 
##   Individual Work                               96.076      67.692
##   Quiz and Test                                 88.762      62.540
##   NaN                                           50.699      35.721
##   Non-instructional                             85.714      60.392
##   Lecture                                      134.137      94.510
##   Laboratory                                   156.486     110.256
##   Group Work                                    99.856      70.356
##   Presentation                                  84.094      59.251
## 
## Model test baseline model:
## 
##   Minimum Function Test Statistic            17567.287   11181.798
##   Degrees of freedom                               440         440
##   P-value                                        0.000       0.000
## 
## User model versus baseline model:
## 
##   Comparative Fit Index (CFI)                    0.969       0.972
##   Tucker-Lewis Index (TLI)                       0.948       0.954
## 
##   Robust Comparative Fit Index (CFI)                         0.975
##   Robust Tucker-Lewis Index (TLI)                            0.958
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)             -50772.212  -50772.212
##   Scaling correction factor                                  1.831
##     for the MLR correction
##   Loglikelihood unrestricted model (H1)     -50374.299  -50374.299
##   Scaling correction factor                                  1.655
##     for the MLR correction
## 
##   Number of free parameters                        352         352
##   Akaike (AIC)                              102248.423  102248.423
##   Bayesian (BIC)                            104449.376  104449.376
##   Sample-size adjusted Bayesian (BIC)       103330.884  103330.884
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.065       0.048
##   90 Percent Confidence Interval          0.060  0.070       0.044  0.053
##   P-value RMSEA <= 0.05                          0.000       0.708
## 
##   Robust RMSEA                                               0.058
##   90 Percent Confidence Interval                             0.051  0.064
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.031       0.031
## 
## Parameter Estimates:
## 
##   Information                                 Expected
##   Information saturated (h1) model          Structured
##   Standard Errors                   Robust.cluster.sem
## 
## 
## Group 1 [Individual Work]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               0.716    0.707
##     succeed           1.053    0.087   12.102    0.000    0.753    0.798
##     learning          0.995    0.076   13.105    0.000    0.712    0.727
##     exp_y             1.203    0.084   14.245    0.000    0.861    0.891
##     exp_t             1.163    0.084   13.885    0.000    0.832    0.839
##   value =~                                                              
##     imp_y             1.000                               0.960    0.961
##     imp_fut           0.751    0.076    9.858    0.000    0.721    0.722
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont              0.634    0.078    8.138    0.000    0.454    0.429
##     value             0.061    0.064    0.951    0.342    0.059    0.056
##   excited ~                                                             
##     cont              0.229    0.093    2.462    0.014    0.164    0.162
##     value             0.148    0.072    2.051    0.040    0.142    0.140
##   frustrated ~                                                          
##     cont             -0.262    0.070   -3.726    0.000   -0.188   -0.224
##     value            -0.009    0.048   -0.188    0.851   -0.009   -0.010
##   bored ~                                                               
##     cont             -0.266    0.128   -2.079    0.038   -0.191   -0.170
##     value            -0.335    0.100   -3.344    0.001   -0.321   -0.286
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.480    0.058    8.250    0.000    0.480    0.521
##    .frustrated       -0.063    0.038   -1.681    0.093   -0.063   -0.082
##    .bored            -0.175    0.053   -3.289    0.001   -0.175   -0.180
##  .excited ~~                                                            
##    .frustrated        0.031    0.043    0.707    0.480    0.031    0.038
##    .bored            -0.145    0.054   -2.705    0.007   -0.145   -0.143
##  .frustrated ~~                                                         
##    .bored             0.151    0.042    3.591    0.000    0.151    0.179
##   cont ~~                                                               
##     value             0.312    0.053    5.862    0.000    0.454    0.454
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.635    0.066   24.606    0.000    1.635    1.615
##    .succeed           1.750    0.056   31.244    0.000    1.750    1.853
##    .learning          1.659    0.056   29.650    0.000    1.659    1.695
##    .exp_y             1.712    0.064   26.555    0.000    1.712    1.771
##    .exp_t             1.701    0.064   26.398    0.000    1.701    1.716
##    .imp_y             1.166    0.071   16.468    0.000    1.166    1.167
##    .imp_fut           0.968    0.071   13.577    0.000    0.968    0.970
##    .happy             1.479    0.076   19.432    0.000    1.479    1.398
##    .excited           0.817    0.071   11.443    0.000    0.817    0.806
##    .frustrated        0.613    0.051   11.975    0.000    0.613    0.730
##    .bored             1.461    0.074   19.620    0.000    1.461    1.300
##     cont              0.000                               0.000    0.000
##     value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           0.513    0.064    8.019    0.000    0.513    0.500
##    .succeed           0.324    0.032    9.984    0.000    0.324    0.364
##    .learning          0.451    0.048    9.412    0.000    0.451    0.471
##    .exp_y             0.193    0.026    7.552    0.000    0.193    0.207
##    .exp_t             0.291    0.044    6.558    0.000    0.291    0.295
##    .imp_y             0.076    0.081    0.933    0.351    0.076    0.076
##    .imp_fut           0.477    0.062    7.687    0.000    0.477    0.479
##    .happy             0.885    0.058   15.258    0.000    0.885    0.791
##    .excited           0.960    0.074   13.019    0.000    0.960    0.933
##    .frustrated        0.668    0.053   12.587    0.000    0.668    0.948
##    .bored             1.067    0.070   15.290    0.000    1.067    0.845
##     cont              0.512    0.080    6.413    0.000    1.000    1.000
##     value             0.922    0.101    9.143    0.000    1.000    1.000
## 
## 
## Group 2 [Quiz and Test]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               0.722    0.681
##     succeed           0.955    0.059   16.280    0.000    0.690    0.771
##     learning          0.796    0.076   10.516    0.000    0.575    0.562
##     exp_y             1.082    0.059   18.294    0.000    0.781    0.860
##     exp_t             1.047    0.063   16.665    0.000    0.756    0.771
##   value =~                                                              
##     imp_y             1.000                               0.920    0.892
##     imp_fut           0.910    0.096    9.485    0.000    0.838    0.746
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont              0.599    0.087    6.876    0.000    0.432    0.398
##     value             0.019    0.074    0.250    0.803    0.017    0.016
##   excited ~                                                             
##     cont              0.325    0.076    4.278    0.000    0.235    0.238
##     value             0.047    0.060    0.781    0.435    0.043    0.044
##   frustrated ~                                                          
##     cont             -0.294    0.082   -3.588    0.000   -0.212   -0.232
##     value             0.089    0.061    1.451    0.147    0.082    0.090
##   bored ~                                                               
##     cont             -0.291    0.100   -2.922    0.003   -0.210   -0.180
##     value            -0.264    0.082   -3.220    0.001   -0.243   -0.208
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.494    0.057    8.698    0.000    0.494    0.522
##    .frustrated       -0.139    0.048   -2.899    0.004   -0.139   -0.157
##    .bored            -0.128    0.061   -2.100    0.036   -0.128   -0.117
##  .excited ~~                                                            
##    .frustrated        0.000    0.043    0.008    0.994    0.000    0.000
##    .bored            -0.009    0.056   -0.164    0.870   -0.009   -0.009
##  .frustrated ~~                                                         
##    .bored             0.283    0.052    5.417    0.000    0.283    0.286
##   cont ~~                                                               
##     value             0.296    0.052    5.712    0.000    0.446    0.446
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.696    0.066   25.614    0.000    1.696    1.600
##    .succeed           1.900    0.049   38.727    0.000    1.900    2.125
##    .learning          1.521    0.057   26.815    0.000    1.521    1.489
##    .exp_y             1.812    0.053   34.451    0.000    1.812    1.997
##    .exp_t             1.763    0.062   28.652    0.000    1.763    1.800
##    .imp_y             1.752    0.063   27.731    0.000    1.752    1.698
##    .imp_fut           1.402    0.079   17.678    0.000    1.402    1.249
##    .happy             1.380    0.073   18.782    0.000    1.380    1.270
##    .excited           0.725    0.062   11.600    0.000    0.725    0.734
##    .frustrated        0.693    0.055   12.678    0.000    0.693    0.757
##    .bored             1.364    0.075   18.245    0.000    1.364    1.167
##     cont              0.000                               0.000    0.000
##     value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           0.603    0.064    9.427    0.000    0.603    0.536
##    .succeed           0.324    0.031   10.517    0.000    0.324    0.405
##    .learning          0.714    0.067   10.635    0.000    0.714    0.684
##    .exp_y             0.214    0.032    6.734    0.000    0.214    0.260
##    .exp_t             0.389    0.051    7.566    0.000    0.389    0.405
##    .imp_y             0.218    0.087    2.503    0.012    0.218    0.205
##    .imp_fut           0.559    0.094    5.961    0.000    0.559    0.444
##    .happy             0.986    0.060   16.315    0.000    0.986    0.836
##    .excited           0.909    0.071   12.884    0.000    0.909    0.932
##    .frustrated        0.803    0.066   12.132    0.000    0.803    0.957
##    .bored             1.218    0.060   20.304    0.000    1.218    0.891
##     cont              0.521    0.067    7.782    0.000    1.000    1.000
##     value             0.846    0.109    7.778    0.000    1.000    1.000
## 
## 
## Group 3 [NaN]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               0.819    0.818
##     succeed           0.774    0.125    6.186    0.000    0.633    0.788
##     learning          0.868    0.155    5.590    0.000    0.710    0.742
##     exp_y             1.066    0.153    6.966    0.000    0.873    0.950
##     exp_t             1.034    0.141    7.326    0.000    0.846    0.917
##   value =~                                                              
##     imp_y             1.000                               0.880    1.040
##     imp_fut           0.597    0.218    2.731    0.006    0.525    0.628
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont              0.190    0.174    1.095    0.274    0.156    0.190
##     value            -0.130    0.205   -0.633    0.527   -0.114   -0.140
##   excited ~                                                             
##     cont             -0.063    0.175   -0.359    0.719   -0.051   -0.074
##     value             0.100    0.192    0.523    0.601    0.088    0.128
##   frustrated ~                                                          
##     cont             -0.226    0.089   -2.529    0.011   -0.185   -0.266
##     value             0.317    0.117    2.723    0.006    0.279    0.403
##   bored ~                                                               
##     cont             -0.228    0.256   -0.891    0.373   -0.187   -0.176
##     value            -0.347    0.174   -1.988    0.047   -0.305   -0.288
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.229    0.137    1.676    0.094    0.229    0.420
##    .frustrated       -0.038    0.056   -0.671    0.502   -0.038   -0.076
##    .bored            -0.078    0.099   -0.791    0.429   -0.078   -0.099
##  .excited ~~                                                            
##    .frustrated       -0.014    0.051   -0.282    0.778   -0.014   -0.034
##    .bored            -0.195    0.098   -1.995    0.046   -0.195   -0.288
##  .frustrated ~~                                                         
##    .bored             0.075    0.085    0.886    0.375    0.075    0.123
##   cont ~~                                                               
##     value             0.120    0.147    0.814    0.416    0.166    0.166
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.302    0.184    7.095    0.000    1.302    1.301
##    .succeed           1.651    0.139   11.920    0.000    1.651    2.055
##    .learning          1.674    0.177    9.482    0.000    1.674    1.748
##    .exp_y             1.605    0.192    8.337    0.000    1.605    1.747
##    .exp_t             1.721    0.187    9.221    0.000    1.721    1.864
##    .imp_y             0.930    0.170    5.487    0.000    0.930    1.099
##    .imp_fut           0.628    0.157    3.990    0.000    0.628    0.751
##    .happy             1.488    0.163    9.147    0.000    1.488    1.820
##    .excited           0.419    0.133    3.153    0.002    0.419    0.607
##    .frustrated        0.465    0.114    4.090    0.000    0.465    0.670
##    .bored             1.395    0.192    7.254    0.000    1.395    1.317
##     cont              0.000                               0.000    0.000
##     value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           0.331    0.110    3.016    0.003    0.331    0.331
##    .succeed           0.244    0.063    3.868    0.000    0.244    0.379
##    .learning          0.412    0.080    5.127    0.000    0.412    0.450
##    .exp_y             0.082    0.045    1.847    0.065    0.082    0.098
##    .exp_t             0.136    0.051    2.660    0.008    0.136    0.160
##    .imp_y            -0.059    0.204   -0.289    0.772   -0.059   -0.082
##    .imp_fut           0.423    0.123    3.432    0.001    0.423    0.605
##    .happy             0.637    0.146    4.373    0.000    0.637    0.953
##    .excited           0.467    0.124    3.774    0.000    0.467    0.981
##    .frustrated        0.386    0.096    4.010    0.000    0.386    0.803
##    .bored             0.976    0.166    5.884    0.000    0.976    0.869
##     cont              0.670    0.169    3.964    0.000    1.000    1.000
##     value             0.775    0.292    2.650    0.008    1.000    1.000
## 
## 
## Group 4 [Non-instructional]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               0.691    0.700
##     succeed           1.024    0.089   11.492    0.000    0.708    0.782
##     learning          0.793    0.090    8.813    0.000    0.548    0.563
##     exp_y             1.190    0.099   12.066    0.000    0.823    0.865
##     exp_t             1.164    0.104   11.183    0.000    0.805    0.848
##   value =~                                                              
##     imp_y             1.000                               0.837    0.865
##     imp_fut           0.812    0.120    6.785    0.000    0.680    0.681
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont              0.502    0.124    4.047    0.000    0.347    0.344
##     value             0.148    0.086    1.715    0.086    0.124    0.123
##   excited ~                                                             
##     cont              0.226    0.131    1.728    0.084    0.156    0.165
##     value             0.273    0.109    2.497    0.013    0.229    0.242
##   frustrated ~                                                          
##     cont             -0.218    0.102   -2.139    0.032   -0.151   -0.172
##     value             0.141    0.095    1.487    0.137    0.118    0.134
##   bored ~                                                               
##     cont             -0.385    0.133   -2.889    0.004   -0.266   -0.230
##     value            -0.121    0.124   -0.973    0.330   -0.101   -0.087
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.392    0.056    7.018    0.000    0.392    0.483
##    .frustrated       -0.152    0.051   -2.956    0.003   -0.152   -0.190
##    .bored            -0.005    0.068   -0.068    0.946   -0.005   -0.005
##  .excited ~~                                                            
##    .frustrated       -0.053    0.041   -1.290    0.197   -0.053   -0.070
##    .bored             0.029    0.061    0.473    0.636    0.029    0.030
##  .frustrated ~~                                                         
##    .bored             0.280    0.063    4.469    0.000    0.280    0.290
##   cont ~~                                                               
##     value             0.281    0.057    4.966    0.000    0.485    0.485
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.709    0.072   23.732    0.000    1.709    1.731
##    .succeed           1.772    0.065   27.191    0.000    1.772    1.958
##    .learning          1.391    0.066   20.949    0.000    1.391    1.429
##    .exp_y             1.702    0.070   24.428    0.000    1.702    1.790
##    .exp_t             1.791    0.068   26.239    0.000    1.791    1.888
##    .imp_y             1.142    0.069   16.665    0.000    1.142    1.180
##    .imp_fut           0.907    0.075   12.047    0.000    0.907    0.908
##    .happy             1.497    0.071   21.180    0.000    1.497    1.483
##    .excited           0.768    0.073   10.499    0.000    0.768    0.813
##    .frustrated        0.579    0.058    9.966    0.000    0.579    0.659
##    .bored             1.414    0.085   16.645    0.000    1.414    1.224
##     cont              0.000                               0.000    0.000
##     value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           0.497    0.063    7.893    0.000    0.497    0.509
##    .succeed           0.318    0.044    7.137    0.000    0.318    0.388
##    .learning          0.646    0.068    9.557    0.000    0.646    0.683
##    .exp_y             0.227    0.039    5.875    0.000    0.227    0.251
##    .exp_t             0.253    0.051    4.989    0.000    0.253    0.281
##    .imp_y             0.236    0.101    2.331    0.020    0.236    0.252
##    .imp_fut           0.535    0.076    7.007    0.000    0.535    0.536
##    .happy             0.840    0.078   10.722    0.000    0.840    0.825
##    .excited           0.782    0.076   10.323    0.000    0.782    0.875
##    .frustrated        0.754    0.081    9.283    0.000    0.754    0.975
##    .bored             1.228    0.074   16.508    0.000    1.228    0.920
##     cont              0.478    0.077    6.219    0.000    1.000    1.000
##     value             0.701    0.108    6.506    0.000    1.000    1.000
## 
## 
## Group 5 [Lecture]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               0.654    0.632
##     succeed           1.066    0.062   17.109    0.000    0.697    0.787
##     learning          1.030    0.064   16.150    0.000    0.674    0.722
##     exp_y             1.111    0.070   15.793    0.000    0.727    0.810
##     exp_t             1.175    0.067   17.435    0.000    0.768    0.854
##   value =~                                                              
##     imp_y             1.000                               0.949    0.997
##     imp_fut           0.705    0.080    8.812    0.000    0.669    0.667
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont              0.662    0.074    8.960    0.000    0.433    0.426
##     value             0.030    0.053    0.565    0.572    0.028    0.028
##   excited ~                                                             
##     cont              0.331    0.085    3.900    0.000    0.216    0.221
##     value             0.108    0.055    1.945    0.052    0.102    0.105
##   frustrated ~                                                          
##     cont             -0.385    0.075   -5.168    0.000   -0.252   -0.297
##     value             0.044    0.041    1.059    0.290    0.042    0.049
##   bored ~                                                               
##     cont             -0.433    0.096   -4.499    0.000   -0.283   -0.255
##     value            -0.188    0.067   -2.809    0.005   -0.179   -0.161
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.409    0.042    9.781    0.000    0.409    0.478
##    .frustrated       -0.110    0.038   -2.928    0.003   -0.110   -0.147
##    .bored            -0.152    0.049   -3.113    0.002   -0.152   -0.160
##  .excited ~~                                                            
##    .frustrated        0.013    0.035    0.363    0.717    0.013    0.017
##    .bored            -0.044    0.051   -0.855    0.393   -0.044   -0.045
##  .frustrated ~~                                                         
##    .bored             0.211    0.042    5.056    0.000    0.211    0.249
##   cont ~~                                                               
##     value             0.276    0.036    7.667    0.000    0.444    0.444
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.664    0.063   26.407    0.000    1.664    1.608
##    .succeed           2.013    0.046   43.394    0.000    2.013    2.272
##    .learning          1.981    0.049   40.565    0.000    1.981    2.123
##    .exp_y             1.909    0.048   39.632    0.000    1.909    2.129
##    .exp_t             1.956    0.050   39.176    0.000    1.956    2.174
##    .imp_y             1.247    0.056   22.159    0.000    1.247    1.309
##    .imp_fut           0.903    0.062   14.483    0.000    0.903    0.900
##    .happy             1.619    0.062   25.986    0.000    1.619    1.592
##    .excited           0.818    0.058   14.055    0.000    0.818    0.836
##    .frustrated        0.525    0.046   11.409    0.000    0.525    0.619
##    .bored             1.357    0.066   20.561    0.000    1.357    1.221
##     cont              0.000                               0.000    0.000
##     value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           0.643    0.049   13.091    0.000    0.643    0.601
##    .succeed           0.299    0.023   12.907    0.000    0.299    0.381
##    .learning          0.417    0.034   12.119    0.000    0.417    0.479
##    .exp_y             0.276    0.040    6.955    0.000    0.276    0.343
##    .exp_t             0.218    0.026    8.540    0.000    0.218    0.270
##    .imp_y             0.006    0.095    0.059    0.953    0.006    0.006
##    .imp_fut           0.559    0.060    9.338    0.000    0.559    0.556
##    .happy             0.835    0.047   17.918    0.000    0.835    0.807
##    .excited           0.879    0.054   16.260    0.000    0.879    0.920
##    .frustrated        0.665    0.059   11.266    0.000    0.665    0.923
##    .bored             1.078    0.059   18.337    0.000    1.078    0.873
##     cont              0.428    0.053    8.120    0.000    1.000    1.000
##     value             0.901    0.099    9.074    0.000    1.000    1.000
## 
## 
## Group 6 [Laboratory]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               0.794    0.765
##     succeed           0.984    0.043   22.764    0.000    0.781    0.811
##     learning          0.949    0.049   19.330    0.000    0.753    0.788
##     exp_y             1.116    0.044   25.481    0.000    0.886    0.889
##     exp_t             1.030    0.045   23.042    0.000    0.818    0.841
##   value =~                                                              
##     imp_y             1.000                               0.909    0.927
##     imp_fut           0.734    0.058   12.738    0.000    0.667    0.710
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont              0.440    0.076    5.776    0.000    0.350    0.328
##     value             0.237    0.067    3.559    0.000    0.215    0.202
##   excited ~                                                             
##     cont              0.259    0.087    2.982    0.003    0.206    0.195
##     value             0.240    0.074    3.222    0.001    0.218    0.207
##   frustrated ~                                                          
##     cont             -0.078    0.061   -1.268    0.205   -0.062   -0.069
##     value             0.058    0.064    0.919    0.358    0.053    0.059
##   bored ~                                                               
##     cont             -0.050    0.100   -0.502    0.616   -0.040   -0.035
##     value            -0.265    0.091   -2.899    0.004   -0.241   -0.211
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.439    0.059    7.494    0.000    0.439    0.474
##    .frustrated       -0.013    0.050   -0.252    0.801   -0.013   -0.015
##    .bored            -0.113    0.059   -1.916    0.055   -0.113   -0.108
##  .excited ~~                                                            
##    .frustrated        0.070    0.051    1.374    0.169    0.070    0.079
##    .bored             0.021    0.061    0.351    0.726    0.021    0.019
##  .frustrated ~~                                                         
##    .bored             0.195    0.054    3.635    0.000    0.195    0.196
##   cont ~~                                                               
##     value             0.403    0.050    7.980    0.000    0.558    0.558
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.615    0.071   22.828    0.000    1.615    1.556
##    .succeed           1.799    0.061   29.492    0.000    1.799    1.868
##    .learning          1.579    0.061   25.884    0.000    1.579    1.652
##    .exp_y             1.674    0.068   24.740    0.000    1.674    1.679
##    .exp_t             1.762    0.064   27.680    0.000    1.762    1.811
##    .imp_y             1.140    0.065   17.488    0.000    1.140    1.164
##    .imp_fut           0.952    0.063   15.219    0.000    0.952    1.013
##    .happy             1.499    0.073   20.548    0.000    1.499    1.407
##    .excited           0.961    0.068   14.025    0.000    0.961    0.911
##    .frustrated        0.635    0.052   12.277    0.000    0.635    0.709
##    .bored             1.224    0.077   15.939    0.000    1.224    1.071
##     cont              0.000                               0.000    0.000
##     value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           0.448    0.054    8.258    0.000    0.448    0.415
##    .succeed           0.318    0.035    9.195    0.000    0.318    0.342
##    .learning          0.346    0.036    9.667    0.000    0.346    0.378
##    .exp_y             0.208    0.029    7.162    0.000    0.208    0.210
##    .exp_t             0.277    0.043    6.422    0.000    0.277    0.293
##    .imp_y             0.135    0.050    2.694    0.007    0.135    0.140
##    .imp_fut           0.438    0.048    9.128    0.000    0.438    0.496
##    .happy             0.884    0.059   14.967    0.000    0.884    0.778
##    .excited           0.971    0.068   14.238    0.000    0.971    0.874
##    .frustrated        0.800    0.067   11.927    0.000    0.800    0.996
##    .bored             1.236    0.059   20.837    0.000    1.236    0.946
##     cont              0.630    0.064    9.783    0.000    1.000    1.000
##     value             0.826    0.073   11.291    0.000    1.000    1.000
## 
## 
## Group 7 [Group Work]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               0.721    0.724
##     succeed           0.982    0.076   12.951    0.000    0.708    0.770
##     learning          1.017    0.085   11.959    0.000    0.733    0.764
##     exp_y             1.134    0.089   12.708    0.000    0.817    0.834
##     exp_t             1.076    0.101   10.610    0.000    0.776    0.803
##   value =~                                                              
##     imp_y             1.000                               1.018    1.002
##     imp_fut           0.630    0.105    6.019    0.000    0.642    0.634
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont              0.522    0.151    3.459    0.001    0.376    0.366
##     value             0.182    0.090    2.036    0.042    0.186    0.181
##   excited ~                                                             
##     cont              0.353    0.137    2.585    0.010    0.254    0.242
##     value             0.170    0.103    1.645    0.100    0.173    0.164
##   frustrated ~                                                          
##     cont             -0.339    0.122   -2.778    0.005   -0.245   -0.276
##     value            -0.029    0.065   -0.444    0.657   -0.029   -0.033
##   bored ~                                                               
##     cont             -0.307    0.175   -1.755    0.079   -0.221   -0.188
##     value            -0.358    0.122   -2.927    0.003   -0.365   -0.311
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.405    0.067    6.063    0.000    0.405    0.458
##    .frustrated       -0.087    0.057   -1.529    0.126   -0.087   -0.114
##    .bored            -0.099    0.084   -1.178    0.239   -0.099   -0.105
##  .excited ~~                                                            
##    .frustrated        0.064    0.055    1.163    0.245    0.064    0.077
##    .bored            -0.109    0.076   -1.432    0.152   -0.109   -0.105
##  .frustrated ~~                                                         
##    .bored             0.231    0.072    3.188    0.001    0.231    0.258
##   cont ~~                                                               
##     value             0.390    0.057    6.787    0.000    0.531    0.531
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.807    0.081   22.349    0.000    1.807    1.815
##    .succeed           1.867    0.072   25.898    0.000    1.867    2.030
##    .learning          1.667    0.079   21.168    0.000    1.667    1.737
##    .exp_y             1.747    0.084   20.852    0.000    1.747    1.783
##    .exp_t             1.847    0.076   24.371    0.000    1.847    1.913
##    .imp_y             1.185    0.081   14.615    0.000    1.185    1.165
##    .imp_fut           1.004    0.082   12.198    0.000    1.004    0.992
##    .happy             1.570    0.089   17.711    0.000    1.570    1.528
##    .excited           0.976    0.085   11.426    0.000    0.976    0.927
##    .frustrated        0.594    0.076    7.777    0.000    0.594    0.670
##    .bored             1.329    0.096   13.865    0.000    1.329    1.133
##     cont              0.000                               0.000    0.000
##     value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           0.471    0.068    6.922    0.000    0.471    0.476
##    .succeed           0.344    0.058    5.909    0.000    0.344    0.407
##    .learning          0.383    0.057    6.667    0.000    0.383    0.416
##    .exp_y             0.292    0.049    5.980    0.000    0.292    0.304
##    .exp_t             0.330    0.070    4.713    0.000    0.330    0.354
##    .imp_y            -0.003    0.146   -0.022    0.983   -0.003   -0.003
##    .imp_fut           0.612    0.093    6.608    0.000    0.612    0.598
##    .happy             0.806    0.082    9.802    0.000    0.806    0.763
##    .excited           0.967    0.085   11.341    0.000    0.967    0.873
##    .frustrated        0.719    0.092    7.802    0.000    0.719    0.913
##    .bored             1.110    0.098   11.285    0.000    1.110    0.806
##     cont              0.520    0.082    6.337    0.000    1.000    1.000
##     value             1.037    0.157    6.595    0.000    1.000    1.000
## 
## 
## Group 8 [Presentation]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               0.664    0.645
##     succeed           1.097    0.105   10.481    0.000    0.728    0.832
##     learning          1.036    0.122    8.499    0.000    0.688    0.769
##     exp_y             1.284    0.121   10.580    0.000    0.852    0.936
##     exp_t             1.265    0.120   10.554    0.000    0.839    0.911
##   value =~                                                              
##     imp_y             1.000                               0.877    0.920
##     imp_fut           0.636    0.095    6.664    0.000    0.558    0.637
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont              0.634    0.110    5.753    0.000    0.421    0.465
##     value             0.120    0.079    1.525    0.127    0.106    0.117
##   excited ~                                                             
##     cont              0.404    0.142    2.843    0.004    0.268    0.263
##     value             0.264    0.108    2.435    0.015    0.231    0.228
##   frustrated ~                                                          
##     cont             -0.247    0.151   -1.636    0.102   -0.164   -0.193
##     value             0.117    0.112    1.046    0.296    0.103    0.121
##   bored ~                                                               
##     cont             -0.211    0.161   -1.309    0.190   -0.140   -0.131
##     value            -0.353    0.127   -2.777    0.005   -0.310   -0.291
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.343    0.063    5.429    0.000    0.343    0.486
##    .frustrated       -0.060    0.050   -1.200    0.230   -0.060   -0.094
##    .bored             0.067    0.056    1.203    0.229    0.067    0.089
##  .excited ~~                                                            
##    .frustrated        0.142    0.055    2.606    0.009    0.142    0.184
##    .bored             0.169    0.069    2.460    0.014    0.169    0.186
##  .frustrated ~~                                                         
##    .bored             0.271    0.071    3.836    0.000    0.271    0.327
##   cont ~~                                                               
##     value             0.290    0.077    3.755    0.000    0.498    0.498
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.712    0.110   15.590    0.000    1.712    1.663
##    .succeed           2.000    0.089   22.365    0.000    2.000    2.285
##    .learning          2.027    0.090   22.615    0.000    2.027    2.267
##    .exp_y             2.037    0.102   19.885    0.000    2.037    2.237
##    .exp_t             2.037    0.101   20.113    0.000    2.037    2.210
##    .imp_y             1.285    0.095   13.581    0.000    1.285    1.348
##    .imp_fut           0.780    0.094    8.320    0.000    0.780    0.889
##    .happy             1.614    0.096   16.840    0.000    1.614    1.782
##    .excited           0.905    0.110    8.240    0.000    0.905    0.890
##    .frustrated        0.481    0.073    6.569    0.000    0.481    0.566
##    .bored             1.207    0.105   11.524    0.000    1.207    1.133
##     cont              0.000                               0.000    0.000
##     value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           0.619    0.082    7.542    0.000    0.619    0.584
##    .succeed           0.236    0.034    6.925    0.000    0.236    0.308
##    .learning          0.326    0.049    6.726    0.000    0.326    0.408
##    .exp_y             0.103    0.028    3.732    0.000    0.103    0.124
##    .exp_t             0.145    0.032    4.494    0.000    0.145    0.171
##    .imp_y             0.139    0.094    1.484    0.138    0.139    0.153
##    .imp_fut           0.457    0.061    7.437    0.000    0.457    0.594
##    .happy             0.588    0.070    8.452    0.000    0.588    0.716
##    .excited           0.848    0.085    9.954    0.000    0.848    0.819
##    .frustrated        0.704    0.108    6.537    0.000    0.704    0.971
##    .bored             0.975    0.087   11.167    0.000    0.975    0.860
##     cont              0.441    0.111    3.972    0.000    1.000    1.000
##     value             0.770    0.109    7.091    0.000    1.000    1.000

MLSEM w/ activities as predictors

library(lavaan)

ML_EMO <- '
level:1
#measurement model
cont =~ succeed + control + learning + exp_y + exp_t
value =~ imp_y + imp_fut
#regressions
happy ~ cont + value + act_lec + act_indwork + act_groupwork + act_pres + act_lab + act_nonins
excited ~ cont + value + act_lec + act_indwork + act_groupwork + act_pres + act_lab + act_nonins
frustrated ~ cont + value + act_lec + act_indwork + act_groupwork + act_pres + act_lab + act_nonins
bored ~ cont + value + act_lec + act_indwork + act_groupwork + act_pres + act_lab + act_nonins
cont ~ act_lec + act_indwork + act_groupwork + act_pres + act_lab + act_nonins
value ~ act_lec + act_indwork + act_groupwork + act_pres + act_lab + act_nonins
#residual correlations
happy ~~ excited + frustrated + bored
excited ~~ frustrated + bored
frustrated ~~ bored
cont ~~ value
act_lec ~~ act_indwork + act_groupwork + act_pres + act_lab + act_nonins
act_indwork ~~ act_groupwork + act_pres + act_lab + act_nonins
act_groupwork ~~ act_pres + act_lab + act_nonins
act_pres ~~ act_lab + act_nonins
act_lab ~~ act_nonins
level:2
#measurement model
cont =~ succeed + control + learning + exp_y + exp_t
value =~ imp_y + imp_fut
#regressions
happy ~ cont + value + act_lec + act_indwork + act_groupwork + act_pres + act_lab + act_nonins
excited ~ cont + value + act_lec + act_indwork + act_groupwork + act_pres + act_lab + act_nonins
frustrated ~ cont + value + act_lec + act_indwork + act_groupwork + act_pres + act_lab + act_nonins
bored ~ cont + value + act_lec + act_indwork + act_groupwork + act_pres + act_lab + act_nonins
cont ~ act_lec + act_indwork + act_groupwork + act_pres + act_lab + act_nonins
value ~ act_lec + act_indwork + act_groupwork + act_pres + act_lab + act_nonins
#residual correlations
happy ~~ excited + frustrated + bored
excited ~~ frustrated + bored
frustrated ~~ bored
cont ~~ value
act_lec ~~ act_indwork + act_groupwork + act_pres + act_lab + act_nonins
act_indwork ~~ act_groupwork + act_pres + act_lab + act_nonins
act_groupwork ~~ act_pres + act_lab + act_nonins
act_pres ~~ act_lab + act_nonins
act_lab ~~ act_nonins
'

fit2<-sem(ML_EMO, data=SciMo_esm, cluster = "uniqueid")
summary(fit2, fit.measures=TRUE, standardized = TRUE)
## lavaan 0.6-3 ended normally after 662 iterations
## 
##   Optimization method                           NLMINB
##   Number of free parameters                        197
## 
##                                                   Used       Total
##   Number of observations                          3800        4135
##   Number of clusters [uniqueid]                    244
## 
##   Estimator                                         ML
##   Model Fit Test Statistic                     538.183
##   Degrees of freedom                               126
##   P-value (Chi-square)                           0.000
## 
## Model test baseline model:
## 
##   Minimum Function Test Statistic            16158.750
##   Degrees of freedom                               272
##   P-value                                        0.000
## 
## User model versus baseline model:
## 
##   Comparative Fit Index (CFI)                    0.974
##   Tucker-Lewis Index (TLI)                       0.944
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)             -50123.847
##   Loglikelihood unrestricted model (H1)     -49854.756
## 
##   Number of free parameters                        197
##   Akaike (AIC)                              100641.694
##   Bayesian (BIC)                            101871.517
##   Sample-size adjusted Bayesian (BIC)       101245.544
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.029
##   90 Percent Confidence Interval          0.027  0.032
##   P-value RMSEA <= 0.05                          1.000
## 
## Standardized Root Mean Square Residual (corr metric):
## 
##   SRMR (within covariance matrix)                0.018
##   SRMR (between covariance matrix)               0.047
## 
## Parameter Estimates:
## 
##   Information                                 Observed
##   Observed information based on                Hessian
##   Standard Errors                             Standard
## 
## 
## Level 1 [within]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     succeed           1.000                               0.562    0.722
##     control           0.885    0.026   34.293    0.000    0.498    0.617
##     learning          0.930    0.027   34.931    0.000    0.523    0.626
##     exp_y             1.086    0.025   43.513    0.000    0.611    0.820
##     exp_t             1.092    0.025   43.040    0.000    0.614    0.801
##   value =~                                                              
##     imp_y             1.000                               0.704    0.888
##     imp_fut           0.636    0.034   18.710    0.000    0.448    0.600
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont              0.507    0.027   18.461    0.000    0.285    0.366
##     value             0.048    0.023    2.119    0.034    0.034    0.043
##     act_lec           0.176    0.044    3.975    0.000    0.176    0.087
##     act_indwork       0.154    0.044    3.479    0.001    0.154    0.069
##     act_groupwork     0.222    0.059    3.757    0.000    0.222    0.070
##     act_pres          0.070    0.062    1.117    0.264    0.070    0.021
##     act_lab           0.241    0.045    5.393    0.000    0.241    0.113
##     act_nonins        0.149    0.056    2.678    0.007    0.149    0.051
##   excited ~                                                             
##     cont              0.332    0.028   11.762    0.000    0.187    0.234
##     value             0.120    0.024    4.963    0.000    0.085    0.106
##     act_lec           0.154    0.047    3.294    0.001    0.154    0.075
##     act_indwork       0.154    0.047    3.306    0.001    0.154    0.068
##     act_groupwork     0.201    0.062    3.217    0.001    0.201    0.062
##     act_pres          0.248    0.066    3.760    0.000    0.248    0.074
##     act_lab           0.249    0.047    5.288    0.000    0.249    0.115
##     act_nonins        0.124    0.059    2.114    0.034    0.124    0.042
##   frustrated ~                                                          
##     cont             -0.228    0.027   -8.465    0.000   -0.128   -0.172
##     value             0.077    0.023    3.323    0.001    0.054    0.072
##     act_lec          -0.114    0.045   -2.541    0.011   -0.114   -0.059
##     act_indwork      -0.074    0.045   -1.658    0.097   -0.074   -0.035
##     act_groupwork    -0.094    0.060   -1.566    0.117   -0.094   -0.031
##     act_pres         -0.140    0.063   -2.204    0.027   -0.140   -0.045
##     act_lab          -0.131    0.045   -2.885    0.004   -0.131   -0.064
##     act_nonins       -0.097    0.056   -1.721    0.085   -0.097   -0.035
##   bored ~                                                               
##     cont             -0.189    0.032   -5.993    0.000   -0.106   -0.121
##     value            -0.114    0.027   -4.212    0.000   -0.080   -0.091
##     act_lec          -0.002    0.053   -0.035    0.972   -0.002   -0.001
##     act_indwork      -0.058    0.053   -1.093    0.274   -0.058   -0.023
##     act_groupwork    -0.104    0.071   -1.471    0.141   -0.104   -0.029
##     act_pres         -0.046    0.075   -0.616    0.538   -0.046   -0.012
##     act_lab          -0.194    0.053   -3.635    0.000   -0.194   -0.081
##     act_nonins        0.054    0.067    0.808    0.419    0.054    0.016
##   cont ~                                                                
##     act_lec           0.118    0.036    3.313    0.001    0.210    0.081
##     act_indwork      -0.037    0.036   -1.030    0.303   -0.065   -0.023
##     act_groupwork     0.109    0.048    2.263    0.024    0.194    0.047
##     act_pres          0.157    0.051    3.057    0.002    0.279    0.067
##     act_lab           0.031    0.036    0.876    0.381    0.056    0.020
##     act_nonins       -0.046    0.045   -1.003    0.316   -0.081   -0.022
##   value ~                                                               
##     act_lec          -0.416    0.045   -9.260    0.000   -0.591   -0.229
##     act_indwork      -0.498    0.045  -11.045    0.000   -0.707   -0.248
##     act_groupwork    -0.462    0.061   -7.598    0.000   -0.657   -0.161
##     act_pres         -0.355    0.065   -5.471    0.000   -0.503   -0.121
##     act_lab          -0.543    0.045  -12.069    0.000   -0.771   -0.283
##     act_nonins       -0.512    0.057   -8.943    0.000   -0.727   -0.195
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.211    0.010   21.064    0.000    0.211    0.388
##    .frustrated       -0.093    0.009  -10.201    0.000   -0.093   -0.177
##    .bored            -0.074    0.011   -6.987    0.000   -0.074   -0.120
##  .excited ~~                                                            
##    .frustrated       -0.048    0.009   -5.085    0.000   -0.048   -0.086
##    .bored            -0.055    0.011   -4.912    0.000   -0.055   -0.083
##  .frustrated ~~                                                         
##    .bored             0.106    0.011    9.749    0.000    0.106    0.167
##  .cont ~~                                                               
##    .value             0.147    0.009   17.207    0.000    0.386    0.386
##   act_lec ~~                                                            
##     act_indwork      -0.034    0.002  -14.275    0.000   -0.034   -0.247
##     act_groupwork    -0.009    0.002   -5.640    0.000   -0.009   -0.095
##     act_pres         -0.027    0.002  -16.389    0.000   -0.027   -0.287
##     act_lab          -0.032    0.002  -13.008    0.000   -0.032   -0.224
##     act_nonins       -0.018    0.002  -10.206    0.000   -0.018   -0.174
##   act_indwork ~~                                                        
##     act_groupwork    -0.009    0.001   -6.175    0.000   -0.009   -0.104
##     act_pres         -0.011    0.001   -7.701    0.000   -0.011   -0.130
##     act_lab          -0.022    0.002  -10.129    0.000   -0.022   -0.172
##     act_nonins       -0.009    0.002   -5.898    0.000   -0.009   -0.099
##   act_groupwork ~~                                                      
##     act_pres         -0.003    0.001   -2.945    0.003   -0.003   -0.049
##     act_lab          -0.025    0.002  -15.761    0.000   -0.025   -0.274
##     act_nonins       -0.005    0.001   -4.581    0.000   -0.005   -0.077
##   act_pres ~~                                                           
##     act_lab          -0.004    0.001   -2.592    0.010   -0.004   -0.044
##     act_nonins       -0.011    0.001  -10.127    0.000   -0.011   -0.172
##   act_lab ~~                                                            
##     act_nonins       -0.017    0.002  -10.426    0.000   -0.017   -0.178
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .succeed           0.000                               0.000    0.000
##    .control           0.000                               0.000    0.000
##    .learning          0.000                               0.000    0.000
##    .exp_y             0.000                               0.000    0.000
##    .exp_t             0.000                               0.000    0.000
##    .imp_y             0.000                               0.000    0.000
##    .imp_fut           0.000                               0.000    0.000
##    .happy             0.000                               0.000    0.000
##    .excited           0.000                               0.000    0.000
##    .frustrated        0.000                               0.000    0.000
##    .bored             0.000                               0.000    0.000
##     act_lec           0.000                               0.000    0.000
##     act_indwork       0.000                               0.000    0.000
##     act_groupwork     0.000                               0.000    0.000
##     act_pres          0.000                               0.000    0.000
##     act_lab           0.000                               0.000    0.000
##     act_nonins        0.000                               0.000    0.000
##    .cont              0.000                               0.000    0.000
##    .value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .succeed           0.290    0.008   34.531    0.000    0.290    0.478
##    .control           0.402    0.011   38.023    0.000    0.402    0.619
##    .learning          0.425    0.011   37.797    0.000    0.425    0.609
##    .exp_y             0.182    0.006   28.351    0.000    0.182    0.327
##    .exp_t             0.210    0.007   30.201    0.000    0.210    0.358
##    .imp_y             0.133    0.025    5.418    0.000    0.133    0.212
##    .imp_fut           0.357    0.013   27.436    0.000    0.357    0.640
##    .happy             0.512    0.012   41.063    0.000    0.512    0.844
##    .excited           0.578    0.014   41.655    0.000    0.578    0.909
##    .frustrated        0.537    0.013   41.866    0.000    0.537    0.969
##    .bored             0.750    0.018   41.979    0.000    0.750    0.964
##     act_lec           0.150    0.004   42.052    0.000    0.150    1.000
##     act_indwork       0.123    0.003   42.181    0.000    0.123    1.000
##     act_groupwork     0.060    0.001   42.208    0.000    0.060    1.000
##     act_pres          0.057    0.001   42.023    0.000    0.057    1.000
##     act_lab           0.134    0.003   42.094    0.000    0.134    1.000
##     act_nonins        0.072    0.002   42.278    0.000    0.072    1.000
##    .cont              0.312    0.013   23.384    0.000    0.988    0.988
##    .value             0.464    0.028   16.651    0.000    0.935    0.935
## 
## 
## Level 2 [uniqueid]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     succeed           1.000                               0.471    0.952
##     control           1.072    0.071   15.074    0.000    0.505    0.791
##     learning          0.980    0.052   18.673    0.000    0.462    0.886
##     exp_y             1.174    0.052   22.727    0.000    0.553    0.934
##     exp_t             1.099    0.053   20.716    0.000    0.518    0.899
##   value =~                                                              
##     imp_y             1.000                               0.645    1.042
##     imp_fut           0.863    0.067   12.816    0.000    0.557    0.807
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont              0.702    0.166    4.227    0.000    0.331    0.479
##     value             0.093    0.100    0.930    0.352    0.060    0.087
##     act_lec          -1.284    2.494   -0.515    0.607   -1.284   -0.164
##     act_indwork      -0.454    1.651   -0.275    0.783   -0.454   -0.082
##     act_groupwork     3.095    3.846    0.805    0.421    3.095    0.170
##     act_pres         -0.154    1.162   -0.133    0.894   -0.154   -0.027
##     act_lab          -1.126    1.814   -0.621    0.535   -1.126   -0.372
##     act_nonins        2.190    3.006    0.729    0.466    2.190    0.115
##   excited ~                                                             
##     cont              0.364    0.183    1.988    0.047    0.172    0.277
##     value             0.167    0.110    1.519    0.129    0.108    0.174
##     act_lec          -1.895    2.780   -0.681    0.496   -1.895   -0.271
##     act_indwork       0.278    1.751    0.159    0.874    0.278    0.056
##     act_groupwork     6.153    4.273    1.440    0.150    6.153    0.378
##     act_pres          0.552    1.244    0.444    0.657    0.552    0.106
##     act_lab          -0.856    1.957   -0.437    0.662   -0.856   -0.316
##     act_nonins        1.990    3.440    0.578    0.563    1.990    0.117
##   frustrated ~                                                          
##     cont             -0.296    0.156   -1.900    0.057   -0.140   -0.293
##     value             0.086    0.097    0.886    0.376    0.055    0.116
##     act_lec           3.017    2.443    1.235    0.217    3.017    0.560
##     act_indwork       1.393    1.709    0.815    0.415    1.393    0.365
##     act_groupwork    -1.160    3.991   -0.291    0.771   -1.160   -0.093
##     act_pres          0.788    1.204    0.654    0.513    0.788    0.197
##     act_lab           2.022    1.920    1.053    0.292    2.022    0.969
##     act_nonins       -3.365    2.919   -1.153    0.249   -3.365   -0.256
##   bored ~                                                               
##     cont             -0.219    0.166   -1.315    0.189   -0.103   -0.145
##     value            -0.400    0.107   -3.732    0.000   -0.258   -0.363
##     act_lec           0.358    2.471    0.145    0.885    0.358    0.044
##     act_indwork       1.819    1.688    1.077    0.281    1.819    0.319
##     act_groupwork    -0.985    3.728   -0.264    0.792   -0.985   -0.053
##     act_pres          0.920    1.183    0.777    0.437    0.920    0.153
##     act_lab           0.814    1.802    0.451    0.652    0.814    0.261
##     act_nonins       -1.766    2.939   -0.601    0.548   -1.766   -0.090
##   cont ~                                                                
##     act_lec           0.827    1.945    0.425    0.671    1.754    0.155
##     act_indwork      -0.056    1.289   -0.043    0.965   -0.118   -0.015
##     act_groupwork    -3.897    2.864   -1.361    0.174   -8.267   -0.314
##     act_pres          0.007    0.907    0.008    0.994    0.015    0.002
##     act_lab           0.551    1.350    0.409    0.683    1.170    0.267
##     act_nonins       -0.151    2.449   -0.062    0.951   -0.321   -0.012
##   value ~                                                               
##     act_lec           0.450    2.163    0.208    0.835    0.697    0.062
##     act_indwork      -0.849    1.545   -0.550    0.583   -1.316   -0.164
##     act_groupwork    -1.409    3.394   -0.415    0.678   -2.184   -0.083
##     act_pres         -1.805    1.081   -1.669    0.095   -2.797   -0.332
##     act_lab          -0.637    1.597   -0.399    0.690   -0.987   -0.225
##     act_nonins        0.414    2.650    0.156    0.876    0.641    0.023
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.212    0.042    5.093    0.000    0.212    0.670
##    .frustrated        0.033    0.030    1.090    0.276    0.033    0.130
##    .bored            -0.020    0.032   -0.633    0.527   -0.020   -0.057
##  .excited ~~                                                            
##    .frustrated        0.104    0.032    3.224    0.001    0.104    0.433
##    .bored             0.034    0.034    0.994    0.320    0.034    0.103
##  .frustrated ~~                                                         
##    .bored             0.111    0.033    3.379    0.001    0.111    0.414
##  .cont ~~                                                               
##    .value             0.173    0.028    6.229    0.000    0.601    0.601
##   act_lec ~~                                                            
##     act_indwork       0.001    0.001    0.673    0.501    0.001    0.080
##     act_groupwork    -0.004    0.001   -5.601    0.000   -0.004   -1.129
##     act_pres          0.011    0.001    8.611    0.000    0.011    1.059
##     act_lab          -0.017    0.002   -6.814    0.000   -0.017   -0.818
##     act_nonins        0.002    0.001    3.708    0.000    0.002    0.758
##   act_indwork ~~                                                        
##     act_groupwork    -0.002    0.001   -2.782    0.005   -0.002   -0.431
##     act_pres         -0.002    0.001   -1.337    0.181   -0.002   -0.120
##     act_lab          -0.019    0.003   -6.893    0.000   -0.019   -0.679
##     act_nonins       -0.004    0.001   -4.767    0.000   -0.004   -0.853
##   act_groupwork ~~                                                      
##     act_pres         -0.002    0.001   -3.351    0.001   -0.002   -0.476
##     act_lab           0.008    0.001    6.702    0.000    0.008    0.960
##     act_nonins       -0.000    0.000   -0.375    0.708   -0.000   -0.096
##   act_pres ~~                                                           
##     act_lab          -0.015    0.002   -6.462    0.000   -0.015   -0.561
##     act_nonins        0.005    0.001    6.795    0.000    0.005    1.124
##   act_lab ~~                                                            
##     act_nonins       -0.002    0.001   -1.777    0.076   -0.002   -0.267
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .succeed           1.839    0.673    2.732    0.006    1.839    3.714
##    .control           1.634    0.722    2.264    0.024    1.634    2.556
##    .learning          1.663    0.660    2.520    0.012    1.663    3.189
##    .exp_y             1.753    0.790    2.218    0.027    1.753    2.960
##    .exp_t             1.787    0.740    2.414    0.016    1.787    3.100
##    .imp_y             1.686    0.807    2.089    0.037    1.686    2.722
##    .imp_fut           1.349    0.700    1.927    0.054    1.349    1.953
##    .happy             1.775    0.904    1.963    0.050    1.775    2.569
##    .excited           0.835    0.898    0.930    0.353    0.835    1.347
##    .frustrated       -0.397    0.866   -0.459    0.646   -0.397   -0.834
##    .bored             0.726    0.980    0.741    0.459    0.726    1.019
##     act_lec           0.196    0.008   23.190    0.000    0.196    2.217
##     act_indwork       0.168    0.010   16.984    0.000    0.168    1.345
##     act_groupwork     0.065    0.005   13.870    0.000    0.065    1.702
##     act_pres          0.077    0.009    8.934    0.000    0.077    0.645
##     act_lab           0.246    0.016   15.467    0.000    0.246    1.076
##     act_nonins        0.079    0.005   15.990    0.000    0.079    2.170
##    .cont              0.000                               0.000    0.000
##    .value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .succeed           0.023    0.005    4.161    0.000    0.023    0.093
##    .control           0.153    0.018    8.492    0.000    0.153    0.375
##    .learning          0.058    0.009    6.367    0.000    0.058    0.215
##    .exp_y             0.045    0.008    5.798    0.000    0.045    0.127
##    .exp_t             0.064    0.009    7.169    0.000    0.064    0.191
##    .imp_y            -0.033    0.025   -1.329    0.184   -0.033   -0.086
##    .imp_fut           0.167    0.026    6.532    0.000    0.167    0.349
##    .happy             0.337    0.044    7.607    0.000    0.337    0.705
##    .excited           0.298    0.052    5.775    0.000    0.298    0.776
##    .frustrated        0.193    0.040    4.829    0.000    0.193    0.851
##    .bored             0.369    0.045    8.258    0.000    0.369    0.728
##     act_lec           0.008    0.002    4.909    0.000    0.008    1.000
##     act_indwork       0.016    0.002    7.233    0.000    0.016    1.000
##     act_groupwork     0.001    0.000    3.042    0.002    0.001    1.000
##     act_pres          0.014    0.002    8.676    0.000    0.014    1.000
##     act_lab           0.052    0.006    9.327    0.000    0.052    1.000
##     act_nonins        0.001    0.001    2.495    0.013    0.001    1.000
##    .cont              0.206    0.031    6.724    0.000    0.925    0.925
##    .value             0.402    0.047    8.521    0.000    0.966    0.966
lavInspect(fit2, "icc")
##       succeed       control      learning         exp_y         exp_t 
##         0.289         0.384         0.277         0.389         0.364 
##         imp_y       imp_fut         happy       excited    frustrated 
##         0.379         0.460         0.440         0.376         0.291 
##         bored       act_lec   act_indwork act_groupwork      act_pres 
##         0.395         0.062         0.117         0.030         0.210 
##       act_lab    act_nonins 
##         0.281         0.029
lavInspect(fit2, "h1")
## $within
## $within$cov
##               succed contrl lernng exp_y  exp_t  imp_y  imp_ft happy 
## succeed        0.605                                                 
## control        0.299  0.650                                          
## learning       0.326  0.241  0.699                                   
## exp_y          0.329  0.298  0.317  0.554                            
## exp_t          0.335  0.302  0.304  0.391  0.587                     
## imp_y          0.149  0.151  0.156  0.152  0.156  0.629              
## imp_fut        0.099  0.097  0.127  0.083  0.079  0.315  0.558       
## happy          0.189  0.170  0.154  0.176  0.168  0.085  0.059  0.606
## excited        0.136  0.125  0.113  0.129  0.129  0.098  0.057  0.282
## frustrated    -0.066 -0.062 -0.054 -0.069 -0.060  0.010  0.013 -0.127
## bored         -0.088 -0.078 -0.078 -0.072 -0.083 -0.081 -0.038 -0.119
## act_lec        0.017 -0.006  0.044  0.008  0.014 -0.005 -0.007  0.013
## act_indwork   -0.017 -0.002 -0.005 -0.012 -0.014 -0.023 -0.010 -0.003
## act_groupwork  0.005  0.009  0.003  0.003  0.006 -0.003  0.000  0.006
## act_pres       0.004 -0.002  0.013  0.009  0.006  0.006 -0.002 -0.002
## act_lab       -0.001  0.003 -0.004 -0.004  0.000 -0.026 -0.021  0.013
## act_nonins    -0.008 -0.001 -0.025 -0.007 -0.004 -0.008 -0.005 -0.004
##               excitd frstrt bored  act_lc act_nd act_gr act_pr act_lb
## succeed                                                              
## control                                                              
## learning                                                             
## exp_y                                                                
## exp_t                                                                
## imp_y                                                                
## imp_fut                                                              
## happy                                                                
## excited        0.636                                                 
## frustrated    -0.072  0.554                                          
## bored         -0.093  0.118  0.778                                   
## act_lec        0.003 -0.008  0.007  0.148                            
## act_indwork   -0.004  0.002  0.003 -0.034  0.123                     
## act_groupwork  0.003 -0.001 -0.002 -0.009 -0.009  0.059              
## act_pres       0.008 -0.003 -0.003 -0.026 -0.010 -0.003  0.057       
## act_lab        0.014 -0.010 -0.020 -0.031 -0.022 -0.024 -0.004  0.134
## act_nonins    -0.007  0.001  0.011 -0.018 -0.010 -0.005 -0.010 -0.017
##               act_nn
## succeed             
## control             
## learning            
## exp_y               
## exp_t               
## imp_y               
## imp_fut             
## happy               
## excited             
## frustrated          
## bored               
## act_lec             
## act_indwork         
## act_groupwork       
## act_pres            
## act_lab             
## act_nonins     0.071
## 
## $within$mean
##       succeed       control      learning         exp_y         exp_t 
##         0.113         0.101         0.102         0.108         0.110 
##         imp_y       imp_fut         happy       excited    frustrated 
##         0.077         0.060         0.091         0.051         0.036 
##         bored       act_lec   act_indwork act_groupwork      act_pres 
##         0.081         0.012         0.010         0.004         0.005 
##       act_lab    act_nonins 
##         0.015         0.004 
## 
## 
## $uniqueid
## $uniqueid$cov
##               succed contrl lernng exp_y  exp_t  imp_y  imp_ft happy 
## succeed        0.247                                                 
## control        0.232  0.406                                          
## learning       0.218  0.239  0.268                                   
## exp_y          0.259  0.281  0.251  0.352                            
## exp_t          0.252  0.253  0.221  0.301  0.335                     
## imp_y          0.177  0.223  0.221  0.198  0.168  0.384              
## imp_fut        0.129  0.196  0.177  0.141  0.121  0.358  0.475       
## happy          0.167  0.198  0.185  0.184  0.168  0.160  0.146  0.477
## excited        0.088  0.098  0.118  0.082  0.081  0.119  0.118  0.297
## frustrated    -0.059 -0.032 -0.032 -0.044 -0.055 -0.023  0.002 -0.017
## bored         -0.130 -0.149 -0.152 -0.136 -0.111 -0.204 -0.174 -0.129
## act_lec        0.012  0.004  0.014  0.016  0.013 -0.002 -0.014  0.008
## act_indwork   -0.003 -0.005 -0.001 -0.001 -0.006  0.004  0.004 -0.002
## act_groupwork -0.004  0.000 -0.005 -0.006 -0.004 -0.003 -0.001 -0.002
## act_pres       0.007  0.006  0.014  0.011  0.011 -0.005 -0.016  0.011
## act_lab       -0.015 -0.013 -0.021 -0.022 -0.013 -0.008  0.008 -0.018
## act_nonins     0.000  0.005  0.001  0.000  0.002 -0.003 -0.002  0.004
##               excitd frstrt bored  act_lc act_nd act_gr act_pr act_lb
## succeed                                                              
## control                                                              
## learning                                                             
## exp_y                                                                
## exp_t                                                                
## imp_y                                                                
## imp_fut                                                              
## happy                                                                
## excited        0.383                                                 
## frustrated     0.075  0.227                                          
## bored         -0.036  0.144  0.508                                   
## act_lec       -0.009 -0.007 -0.001  0.010                            
## act_indwork   -0.002  0.001  0.019  0.001  0.016                     
## act_groupwork  0.005  0.001  0.001 -0.003 -0.002  0.002              
## act_pres      -0.002 -0.006 -0.006  0.010 -0.002 -0.002  0.015       
## act_lab        0.012  0.019 -0.010 -0.017 -0.019  0.008 -0.015  0.052
## act_nonins     0.001 -0.003 -0.005  0.003 -0.003  0.000  0.004 -0.002
##               act_nn
## succeed             
## control             
## learning            
## exp_y               
## exp_t               
## imp_y               
## imp_fut             
## happy               
## excited             
## frustrated          
## bored               
## act_lec             
## act_indwork         
## act_groupwork       
## act_pres            
## act_lab             
## act_nonins     0.002
## 
## $uniqueid$mean
##       succeed       control      learning         exp_y         exp_t 
##         1.751         1.560         1.584         1.674         1.704 
##         imp_y       imp_fut         happy       excited    frustrated 
##         1.201         0.936         1.419         0.788         0.567 
##         bored       act_lec   act_indwork act_groupwork      act_pres 
##         1.247         0.185         0.158         0.060         0.072 
##       act_lab    act_nonins 
##         0.230         0.075

MSEM take 2 no between level model

library(lavaan)

ML_EMO2 <- '
level:1
#measurement model
cont =~ control + succeed + learning + exp_y + exp_t
value =~ imp_y + imp_fut
#regressions
happy ~ cont + value + act_lec + act_indwork + act_groupwork + act_pres + act_lab + act_nonins
excited ~ cont + value + act_lec + act_indwork + act_groupwork + act_pres + act_lab + act_nonins
frustrated ~ cont + value + act_lec + act_indwork + act_groupwork + act_pres + act_lab + act_nonins
bored ~ cont + value + act_lec + act_indwork + act_groupwork + act_pres + act_lab + act_nonins
cont ~ act_lec + act_indwork + act_groupwork + act_pres + act_lab + act_nonins
value ~ act_lec + act_indwork + act_groupwork + act_pres + act_lab + act_nonins
#residual correlations
happy ~~ excited + frustrated + bored
excited ~~ frustrated + bored
frustrated ~~ bored
cont ~~ value
act_lec ~~ act_indwork + act_groupwork + act_pres + act_lab + act_nonins
act_indwork ~~ act_groupwork + act_pres + act_lab + act_nonins
act_groupwork ~~ act_pres + act_lab + act_nonins
act_pres ~~ act_lab + act_nonins
act_lab ~~ act_nonins
level:2
#saturated model
control ~~ control + succeed + learning + exp_y + exp_t
succeed ~~ succeed + learning + exp_y + exp_t
learning ~~ learning + exp_y + exp_t
exp_y ~~ exp_y + exp_t
exp_t ~~ exp_t
'

fit3<-sem(ML_EMO2, data=SciMo_esm, cluster = "uniqueid")
summary(fit3, fit.measures=TRUE, standardized = TRUE)
## lavaan 0.6-3 ended normally after 160 iterations
## 
##   Optimization method                           NLMINB
##   Number of free parameters                        122
## 
##                                                   Used       Total
##   Number of observations                          3800        4135
##   Number of clusters [uniqueid]                    244
## 
##   Estimator                                         ML
##   Model Fit Test Statistic                     502.839
##   Degrees of freedom                                63
##   P-value (Chi-square)                           0.000
## 
## Model test baseline model:
## 
##   Minimum Function Test Statistic            17142.821
##   Degrees of freedom                               146
##   P-value                                        0.000
## 
## User model versus baseline model:
## 
##   Comparative Fit Index (CFI)                    0.974
##   Tucker-Lewis Index (TLI)                       0.940
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)             -54389.959
##   Loglikelihood unrestricted model (H1)     -54138.540
## 
##   Number of free parameters                        122
##   Akaike (AIC)                              109023.918
##   Bayesian (BIC)                            109785.535
##   Sample-size adjusted Bayesian (BIC)       109397.876
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.043
##   90 Percent Confidence Interval          0.039  0.046
##   P-value RMSEA <= 0.05                          1.000
## 
## Standardized Root Mean Square Residual (corr metric):
## 
##   SRMR (within covariance matrix)                0.021
##   SRMR (between covariance matrix)               0.016
## 
## Parameter Estimates:
## 
##   Information                                 Observed
##   Observed information based on                Hessian
##   Standard Errors                             Standard
## 
## 
## Level 1 [within]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   cont =~                                                               
##     control           1.000                               0.566    0.667
##     succeed           1.112    0.031   35.700    0.000    0.630    0.761
##     learning          1.066    0.033   32.253    0.000    0.604    0.681
##     exp_y             1.205    0.032   37.952    0.000    0.682    0.847
##     exp_t             1.207    0.032   37.335    0.000    0.684    0.829
##   value =~                                                              
##     imp_y             1.000                               0.931    0.923
##     imp_fut           0.784    0.025   31.018    0.000    0.730    0.718
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   happy ~                                                               
##     cont              0.892    0.043   20.762    0.000    0.505    0.485
##     value             0.048    0.024    1.992    0.046    0.044    0.042
##     act_lec           0.179    0.053    3.408    0.001    0.179    0.068
##     act_indwork       0.176    0.053    3.291    0.001    0.176    0.063
##     act_groupwork     0.164    0.071    2.311    0.021    0.164    0.039
##     act_pres          0.132    0.069    1.904    0.057    0.132    0.034
##     act_lab           0.165    0.050    3.274    0.001    0.165    0.068
##     act_nonins        0.197    0.066    2.971    0.003    0.197    0.051
##   excited ~                                                             
##     cont              0.570    0.043   13.161    0.000    0.323    0.318
##     value             0.102    0.024    4.243    0.000    0.095    0.093
##     act_lec           0.091    0.054    1.707    0.088    0.091    0.036
##     act_indwork       0.182    0.055    3.326    0.001    0.182    0.067
##     act_groupwork     0.273    0.073    3.765    0.000    0.273    0.067
##     act_pres          0.152    0.070    2.178    0.029    0.152    0.040
##     act_lab           0.307    0.051    6.019    0.000    0.307    0.131
##     act_nonins        0.138    0.068    2.035    0.042    0.138    0.037
##   frustrated ~                                                          
##     cont             -0.298    0.038   -7.792    0.000   -0.169   -0.192
##     value             0.060    0.022    2.758    0.006    0.056    0.063
##     act_lec          -0.104    0.049   -2.129    0.033   -0.104   -0.047
##     act_indwork      -0.058    0.050   -1.164    0.244   -0.058   -0.025
##     act_groupwork    -0.044    0.066   -0.663    0.508   -0.044   -0.012
##     act_pres         -0.135    0.063   -2.134    0.033   -0.135   -0.041
##     act_lab          -0.023    0.046   -0.499    0.618   -0.023   -0.011
##     act_nonins       -0.090    0.062   -1.461    0.144   -0.090   -0.028
##   bored ~                                                               
##     cont             -0.318    0.049   -6.482    0.000   -0.180   -0.158
##     value            -0.266    0.028   -9.418    0.000   -0.248   -0.218
##     act_lec          -0.107    0.061   -1.752    0.080   -0.107   -0.037
##     act_indwork      -0.065    0.062   -1.044    0.297   -0.065   -0.021
##     act_groupwork    -0.155    0.083   -1.869    0.062   -0.155   -0.034
##     act_pres         -0.240    0.079   -3.038    0.002   -0.240   -0.057
##     act_lab          -0.297    0.058   -5.127    0.000   -0.297   -0.113
##     act_nonins       -0.122    0.077   -1.576    0.115   -0.122   -0.029
##   cont ~                                                                
##     act_lec           0.097    0.038    2.554    0.011    0.171    0.068
##     act_indwork      -0.054    0.038   -1.428    0.153   -0.096   -0.036
##     act_groupwork     0.061    0.049    1.230    0.219    0.107    0.027
##     act_pres          0.143    0.050    2.836    0.005    0.252    0.067
##     act_lab          -0.017    0.037   -0.465    0.642   -0.030   -0.013
##     act_nonins       -0.056    0.047   -1.200    0.230   -0.099   -0.027
##   value ~                                                               
##     act_lec          -0.519    0.054   -9.654    0.000   -0.557   -0.221
##     act_indwork      -0.574    0.056  -10.272    0.000   -0.617   -0.230
##     act_groupwork    -0.551    0.074   -7.473    0.000   -0.592   -0.146
##     act_pres         -0.512    0.070   -7.317    0.000   -0.549   -0.147
##     act_lab          -0.599    0.051  -11.668    0.000   -0.643   -0.278
##     act_nonins       -0.606    0.069   -8.786    0.000   -0.651   -0.176
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .happy ~~                                                              
##    .excited           0.385    0.017   22.575    0.000    0.385    0.458
##    .frustrated       -0.073    0.014   -5.406    0.000   -0.073   -0.095
##    .bored            -0.098    0.017   -5.697    0.000   -0.098   -0.101
##  .excited ~~                                                            
##    .frustrated        0.049    0.013    3.648    0.000    0.049    0.061
##    .bored            -0.004    0.017   -0.240    0.811   -0.004   -0.004
##  .frustrated ~~                                                         
##    .bored             0.231    0.016   14.517    0.000    0.231    0.249
##  .cont ~~                                                               
##    .value             0.265    0.014   19.245    0.000    0.519    0.519
##   act_lec ~~                                                            
##     act_indwork      -0.033    0.002  -13.300    0.000   -0.033   -0.221
##     act_groupwork    -0.013    0.002   -8.000    0.000   -0.013   -0.131
##     act_pres         -0.015    0.002   -8.749    0.000   -0.015   -0.143
##     act_lab          -0.049    0.003  -16.816    0.000   -0.049   -0.284
##     act_nonins       -0.016    0.002   -8.859    0.000   -0.016   -0.145
##   act_indwork ~~                                                        
##     act_groupwork    -0.011    0.002   -7.247    0.000   -0.011   -0.118
##     act_pres         -0.013    0.002   -7.929    0.000   -0.013   -0.130
##     act_lab          -0.041    0.003  -15.315    0.000   -0.041   -0.256
##     act_nonins       -0.013    0.002   -8.029    0.000   -0.013   -0.131
##   act_groupwork ~~                                                      
##     act_pres         -0.005    0.001   -4.722    0.000   -0.005   -0.077
##     act_lab          -0.016    0.002   -9.259    0.000   -0.016   -0.152
##     act_nonins       -0.005    0.001   -4.782    0.000   -0.005   -0.078
##   act_pres ~~                                                           
##     act_lab          -0.019    0.002  -10.121    0.000   -0.019   -0.166
##     act_nonins       -0.006    0.001   -5.236    0.000   -0.006   -0.085
##   act_lab ~~                                                            
##     act_nonins       -0.020    0.002  -10.247    0.000   -0.020   -0.169
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           0.000                               0.000    0.000
##    .succeed           0.000                               0.000    0.000
##    .learning          0.000                               0.000    0.000
##    .exp_y             0.000                               0.000    0.000
##    .exp_t             0.000                               0.000    0.000
##    .imp_y             1.751    0.040   43.944    0.000    1.751    1.735
##    .imp_fut           1.375    0.035   39.724    0.000    1.375    1.353
##    .happy             1.379    0.043   32.435    0.000    1.379    1.322
##    .excited           0.724    0.041   17.779    0.000    0.724    0.714
##    .frustrated        0.689    0.035   19.763    0.000    0.689    0.785
##    .bored             1.356    0.045   29.842    0.000    1.356    1.192
##     act_lec           0.196    0.006   30.463    0.000    0.196    0.494
##     act_indwork       0.167    0.006   27.557    0.000    0.167    0.447
##     act_groupwork     0.066    0.004   16.323    0.000    0.066    0.265
##     act_pres          0.078    0.004   17.882    0.000    0.078    0.290
##     act_lab           0.248    0.007   35.364    0.000    0.248    0.574
##     act_nonins        0.079    0.004   18.112    0.000    0.079    0.294
##    .cont              0.000                               0.000    0.000
##    .value             0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           0.401    0.011   38.005    0.000    0.401    0.556
##    .succeed           0.289    0.008   34.654    0.000    0.289    0.422
##    .learning          0.422    0.011   37.692    0.000    0.422    0.537
##    .exp_y             0.183    0.006   28.615    0.000    0.183    0.282
##    .exp_t             0.212    0.007   30.455    0.000    0.212    0.312
##    .imp_y             0.151    0.025    6.112    0.000    0.151    0.148
##    .imp_fut           0.500    0.019   26.502    0.000    0.500    0.484
##    .happy             0.805    0.021   37.659    0.000    0.805    0.740
##    .excited           0.878    0.021   41.041    0.000    0.878    0.854
##    .frustrated        0.745    0.017   42.845    0.000    0.745    0.967
##    .bored             1.154    0.027   42.609    0.000    1.154    0.890
##     act_lec           0.158    0.004   43.589    0.000    0.158    1.000
##     act_indwork       0.139    0.003   43.589    0.000    0.139    1.000
##     act_groupwork     0.061    0.001   43.589    0.000    0.061    1.000
##     act_pres          0.072    0.002   43.589    0.000    0.072    1.000
##     act_lab           0.186    0.004   43.589    0.000    0.186    1.000
##     act_nonins        0.073    0.002   43.589    0.000    0.073    1.000
##    .cont              0.317    0.017   18.606    0.000    0.987    0.987
##    .value             0.822    0.033   25.211    0.000    0.948    0.948
## 
## 
## Level 2 [uniqueid]:
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##  .control ~~                                                            
##    .succeed           0.116    0.018    6.570    0.000    0.116    0.581
##    .learning          0.107    0.017    6.124    0.000    0.107    0.553
##    .exp_y             0.154    0.022    7.064    0.000    0.154    0.605
##    .exp_t             0.134    0.021    6.300    0.000    0.134    0.524
##  .succeed ~~                                                            
##    .learning          0.102    0.014    7.261    0.000    0.102    0.731
##    .exp_y             0.148    0.018    8.313    0.000    0.148    0.806
##    .exp_t             0.152    0.018    8.411    0.000    0.152    0.818
##  .learning ~~                                                           
##    .exp_y             0.124    0.017    7.310    0.000    0.124    0.698
##    .exp_t             0.102    0.016    6.243    0.000    0.102    0.568
##  .exp_y ~~                                                              
##    .exp_t             0.194    0.022    8.760    0.000    0.194    0.825
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           1.646    0.039   42.251    0.000    1.646    3.130
##    .succeed           1.847    0.032   58.285    0.000    1.847    4.851
##    .learning          1.672    0.031   53.609    0.000    1.672    4.558
##    .exp_y             1.764    0.037   47.239    0.000    1.764    3.655
##    .exp_t             1.796    0.038   47.587    0.000    1.796    3.683
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .control           0.277    0.029    9.510    0.000    0.277    1.000
##    .succeed           0.145    0.017    8.741    0.000    0.145    1.000
##    .learning          0.135    0.017    8.090    0.000    0.135    1.000
##    .exp_y             0.233    0.024    9.601    0.000    0.233    1.000
##    .exp_t             0.238    0.025    9.587    0.000    0.238    1.000

Preparing dataset for Mplus Multilevel SEM

#scimo_emo <- select(SciMo_esm,
#                    uniqueid, signal_value, teacher_ID,
#                    control, succeed, learning, exp_y, exp_t,
#                    imp_y, imp_fut,
#                    happy, excited, frustrated, bored,
#                    act_lec, act_indwork, act_groupwork, act_pres,
#                    act_lab, act_nonins, act_test)

#Preparing data for dat file for Mplus

#MTH_132_Mplus_long$stud_id <- as.numeric(sub("_","", MTH_132_Mplus_long$stud_id))
#scimo_emo[is.na(scimo_emo)] <- -999

Writing data to csv file for mplus

#write_csv(scimo_emo, "/Volumes/educ/CEPSE/Projects/SchmidtLab/Beymer_Projects/Publications/Scimo SEM #Emotions/Mplus/scimo_emo_11_19_19.csv")