##import  dataset
tournament_data <- read.csv(here("raw data","tournamentData.csv"))

tournament_data$unspokenUnderstanding_MidTournament <- (tournament_data$unspokenUnderstanding_day1 + tournament_data$unspokenUnderstanding_day2) / 2

tournament_data$teamAura_MidTournament <- (tournament_data$teamAura_day1 + tournament_data$teamAura_day2) / 2

tournament_data$clickPictorial_MidTournament <- (tournament_data$clickPictorial_day1 + tournament_data$clickPictorial_day2) / 2

###view(tournament_data)

CFA

Since we know the 3 factors we want and know explicitly which indicators we want to link them with (e.g., visceral_interdependence_day1 with unspokenUnderstanding_day1, teamAura_day1, clickPictorial_day1), Confirmed Factors Analysis might be more appropriate in this case.

#CFA
cfa_model <- 'visceral_interdependence_day1 =~ unspokenUnderstanding_day1 + teamAura_day1 + clickPictorial_day1
              visceral_interdependence_day2 =~ unspokenUnderstanding_day2 + teamAura_day2 + clickPictorial_day2
              social_bonding_day1 =~ emotionalSupport_day1 + sharedGoal_day1 + fusionPictorialTeam_day1
              social_bonding_day2 =~ emotionalSupport_day2 + sharedGoal_day2 + fusionPictorialTeam_day2'

tournament_data_complete <- tournament_data[complete.cases(tournament_data[, c("unspokenUnderstanding_day1","teamAura_day1","clickPictorial_day1", "unspokenUnderstanding_day2", "teamAura_day2","clickPictorial_day2","emotionalSupport_day1","sharedGoal_day1","fusionPictorialTeam_day1", "emotionalSupport_day2","sharedGoal_day2","fusionPictorialTeam_day2")]), ]

fit_tournament <- cfa(cfa_model, data = tournament_data_complete)
## Warning in lav_data_full(data = data, group = group, cluster = cluster, :
## lavaan WARNING: some observed variances are (at least) a factor 1000 times
## larger than others; use varTable(fit) to investigate
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated ov
## variances are negative

This will produce output that includes the standardized factor loadings (labeled as “Std.lv”), along with other information about the model. Set rsq to TRUE, we will also get the variance explained by each latent variable.

#report factor loadings (>.3 considered adequate)
summary(fit_tournament, standardized = TRUE, rsq = TRUE)
## lavaan 0.6.15 ended normally after 382 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        30
## 
##   Number of observations                           125
## 
## Model Test User Model:
##                                                       
##   Test statistic                               199.587
##   Degrees of freedom                                48
##   P-value (Chi-square)                           0.000
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv
##   visceral_interdependence_day1 =~                                             
##     unspknUndrst_1                    1.000                               1.724
##     teamAura_day1                    -1.783    0.916   -1.947    0.052   -3.075
##     clickPctrl_dy1                    2.993   52.734    0.057    0.955    5.160
##   visceral_interdependence_day2 =~                                             
##     unspknUndrst_2                    1.000                              18.575
##     teamAura_day2                     1.213    0.114   10.606    0.000   22.540
##     clickPctrl_dy2                    0.039    0.005    8.079    0.000    0.716
##   social_bonding_day1 =~                                                       
##     emtnlSpprt_dy1                    1.000                              19.209
##     sharedGoal_dy1                    0.875    0.122    7.145    0.000   16.811
##     fsnPctrlTm_dy1                    0.015    0.004    4.345    0.000    0.298
##   social_bonding_day2 =~                                                       
##     emtnlSpprt_dy2                    1.000                              17.389
##     sharedGoal_dy2                    1.217    0.123    9.896    0.000   21.164
##     fsnPctrlTm_dy2                    0.024    0.004    6.205    0.000    0.424
##   Std.all
##          
##     0.080
##    -0.033
##     5.315
##          
##     0.841
##     0.893
##     0.679
##          
##     0.844
##     0.864
##     0.413
##          
##     0.826
##     0.887
##     0.554
## 
## Covariances:
##                                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv
##   visceral_interdependence_day1 ~~                                             
##     vscrl_ntrdpn_2                    1.505   26.711    0.056    0.955    0.047
##     socl_bndng_dy1                    0.745   13.236    0.056    0.955    0.022
##     socl_bndng_dy2                    1.304   23.149    0.056    0.955    0.043
##   visceral_interdependence_day2 ~~                                             
##     socl_bndng_dy1                   17.519   37.036    0.473    0.636    0.049
##     socl_bndng_dy2                  202.921   41.772    4.858    0.000    0.628
##   social_bonding_day1 ~~                                                       
##     socl_bndng_dy2                  136.644   39.412    3.467    0.001    0.409
##   Std.all
##          
##     0.047
##     0.022
##     0.043
##          
##     0.049
##     0.628
##          
##     0.409
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .unspknUndrst_1  459.291   78.074    5.883    0.000  459.291    0.994
##    .teamAura_day1  8775.694 1121.670    7.824    0.000 8775.694    0.999
##    .clickPctrl_dy1  -25.683  467.526   -0.055    0.956  -25.683  -27.254
##    .unspknUndrst_2  143.150   29.221    4.899    0.000  143.150    0.293
##    .teamAura_day2   129.282   36.993    3.495    0.000  129.282    0.203
##    .clickPctrl_dy2    0.600    0.086    6.992    0.000    0.600    0.540
##    .emtnlSpprt_dy1  149.162   48.613    3.068    0.002  149.162    0.288
##    .sharedGoal_dy1   95.998   36.368    2.640    0.008   95.998    0.254
##    .fsnPctrlTm_dy1    0.431    0.057    7.623    0.000    0.431    0.830
##    .emtnlSpprt_dy2  141.211   28.474    4.959    0.000  141.211    0.318
##    .sharedGoal_dy2  120.817   35.722    3.382    0.001  120.817    0.212
##    .fsnPctrlTm_dy2    0.405    0.055    7.401    0.000    0.405    0.693
##     vscrl_ntrdpn_1    2.973   52.575    0.057    0.955    1.000    1.000
##     vscrl_ntrdpn_2  345.032   63.334    5.448    0.000    1.000    1.000
##     socl_bndng_dy1  368.977   77.115    4.785    0.000    1.000    1.000
##     socl_bndng_dy2  302.383   57.629    5.247    0.000    1.000    1.000
## 
## R-Square:
##                    Estimate
##     unspknUndrst_1    0.006
##     teamAura_day1     0.001
##     clickPctrl_dy1       NA
##     unspknUndrst_2    0.707
##     teamAura_day2     0.797
##     clickPctrl_dy2    0.460
##     emtnlSpprt_dy1    0.712
##     sharedGoal_dy1    0.746
##     fsnPctrlTm_dy1    0.170
##     emtnlSpprt_dy2    0.682
##     sharedGoal_dy2    0.788
##     fsnPctrlTm_dy2    0.307
#Sum of Squares Loadings (SS Loadings) for each factor
#std_lv <- lavInspect(fit_tournament, "std.lv")
#print(std_lv)
ss_loadings <- (unlist(lavInspect(fit_tournament, "std.lv")))^2 * nrow(tournament_data_complete)
print(ss_loadings)
##      lambda1      lambda2      lambda3      lambda4      lambda5      lambda6 
## 3.715941e+02 1.181581e+03 3.328152e+03 0.000000e+00 0.000000e+00 0.000000e+00 
##      lambda7      lambda8      lambda9     lambda10     lambda11     lambda12 
## 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 
##     lambda13     lambda14     lambda15     lambda16     lambda17     lambda18 
## 0.000000e+00 0.000000e+00 0.000000e+00 4.312901e+04 6.350380e+04 6.405727e+01 
##     lambda19     lambda20     lambda21     lambda22     lambda23     lambda24 
## 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 
##     lambda25     lambda26     lambda27     lambda28     lambda29     lambda30 
## 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 
##     lambda31     lambda32     lambda33     lambda34     lambda35     lambda36 
## 4.612214e+04 3.532511e+04 1.107174e+01 0.000000e+00 0.000000e+00 0.000000e+00 
##     lambda37     lambda38     lambda39     lambda40     lambda41     lambda42 
## 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 
##     lambda43     lambda44     lambda45     lambda46     lambda47     lambda48 
## 0.000000e+00 0.000000e+00 0.000000e+00 3.779783e+04 5.599181e+04 2.242539e+01 
##       theta1       theta2       theta3       theta4       theta5       theta6 
## 2.636857e+07 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 
##       theta7       theta8       theta9      theta10      theta11      theta12 
## 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 
##      theta13      theta14      theta15      theta16      theta17      theta18 
## 0.000000e+00 9.626602e+09 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 
##      theta19      theta20      theta21      theta22      theta23      theta24 
## 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 
##      theta25      theta26      theta27      theta28      theta29      theta30 
## 0.000000e+00 0.000000e+00 8.245116e+04 0.000000e+00 0.000000e+00 0.000000e+00 
##      theta31      theta32      theta33      theta34      theta35      theta36 
## 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 
##      theta37      theta38      theta39      theta40      theta41      theta42 
## 0.000000e+00 0.000000e+00 0.000000e+00 2.561489e+06 0.000000e+00 0.000000e+00 
##      theta43      theta44      theta45      theta46      theta47      theta48 
## 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 
##      theta49      theta50      theta51      theta52      theta53      theta54 
## 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 2.089238e+06 0.000000e+00 
##      theta55      theta56      theta57      theta58      theta59      theta60 
## 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 
##      theta61      theta62      theta63      theta64      theta65      theta66 
## 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 4.506919e+01 
##      theta67      theta68      theta69      theta70      theta71      theta72 
## 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 
##      theta73      theta74      theta75      theta76      theta77      theta78 
## 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 
##      theta79      theta80      theta81      theta82      theta83      theta84 
## 2.781151e+06 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 
##      theta85      theta86      theta87      theta88      theta89      theta90 
## 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 
##      theta91      theta92      theta93      theta94      theta95      theta96 
## 0.000000e+00 1.151942e+06 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 
##      theta97      theta98      theta99     theta100     theta101     theta102 
## 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 
##     theta103     theta104     theta105     theta106     theta107     theta108 
## 0.000000e+00 0.000000e+00 2.323096e+01 0.000000e+00 0.000000e+00 0.000000e+00 
##     theta109     theta110     theta111     theta112     theta113     theta114 
## 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 
##     theta115     theta116     theta117     theta118     theta119     theta120 
## 0.000000e+00 0.000000e+00 0.000000e+00 2.492570e+06 0.000000e+00 0.000000e+00 
##     theta121     theta122     theta123     theta124     theta125     theta126 
## 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 
##     theta127     theta128     theta129     theta130     theta131     theta132 
## 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.824590e+06 0.000000e+00 
##     theta133     theta134     theta135     theta136     theta137     theta138 
## 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 
##     theta139     theta140     theta141     theta142     theta143     theta144 
## 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 2.052630e+01 
##         psi1         psi2         psi3         psi4         psi5         psi6 
## 1.250000e+02 2.758574e-01 6.325913e-02 2.363937e-01 2.758574e-01 1.250000e+02 
##         psi7         psi8         psi9        psi10        psi11        psi12 
## 3.013475e-01 4.933398e+01 6.325913e-02 3.013475e-01 1.250000e+02 2.091878e+01 
##        psi13        psi14        psi15        psi16 
## 2.363937e-01 4.933398e+01 2.091878e+01 1.250000e+02
library(psych)

# Select the variables for each group
group1_vars <- c("unspokenUnderstanding_day1", "teamAura_day1", "clickPictorial_day1")
group2_vars <- c("unspokenUnderstanding_day2", "teamAura_day2", "clickPictorial_day2")
group3_vars <- c("emotionalSupport_day1", "sharedGoal_day1", "fusionPictorialTeam_day1")
group4_vars <- c("emotionalSupport_day2", "sharedGoal_day2", "fusionPictorialTeam_day2")

cor_matrix1 <- cor(tournament_data_complete[, group1_vars])
cor_matrix2 <- cor(tournament_data_complete[, group2_vars])
cor_matrix3 <- cor(tournament_data_complete[, group3_vars])
cor_matrix4 <- cor(tournament_data_complete[, group4_vars])

# Calculate the correlation matrix and perform KMO test 
kmo1 <- KMO(cor_matrix1)

kmo2 <- KMO(cor_matrix2)

kmo3 <- KMO(cor_matrix3)

kmo4 <- KMO(cor_matrix4)

# Print the results
print(kmo1)
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = cor_matrix1)
## Overall MSA =  0.43
## MSA for each item = 
## unspokenUnderstanding_day1              teamAura_day1 
##                       0.46                       0.36 
##        clickPictorial_day1 
##                       0.44
print(kmo2)
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = cor_matrix2)
## Overall MSA =  0.68
## MSA for each item = 
## unspokenUnderstanding_day2              teamAura_day2 
##                       0.66                       0.63 
##        clickPictorial_day2 
##                       0.81
print(kmo3)
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = cor_matrix3)
## Overall MSA =  0.59
## MSA for each item = 
##    emotionalSupport_day1          sharedGoal_day1 fusionPictorialTeam_day1 
##                     0.56                     0.56                     0.82
print(kmo4)
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = cor_matrix4)
## Overall MSA =  0.61
## MSA for each item = 
##    emotionalSupport_day2          sharedGoal_day2 fusionPictorialTeam_day2 
##                     0.59                     0.57                     0.78
#Bartlett's test for each group
#bartlett1 <- bartlett.test(cor_matrix1, ncol(cor_matrix1))
#bartlett2 <- bartlett.test(cor_matrix2)
#bartlett3 <- bartlett.test(cor_matrix3)
#bartlett4 <- bartlett.test(cor_matrix4)

# Print the results
#print(bartlett1)
#print(bartlett2)
#print(bartlett3)
#print(bartlett4)

###Error in bartlett.test.default(cor_matrix1, ncol(cor_matrix1)) :
###'x' and 'g' must have the same length
# Extract the standardized factor loadings from the CFA model
#factor_loadings <- fa(fit_tournament, standardized = TRUE)$loadings
#std_lv <- lavInspect(fit_tournament, "std.lv")

# Calculate Cronbach's alpha
#alpha(factor_loadings)

# Calculate McDonald's omega
#omega(factor_loadings)

### Error in UseMethod("isSymmetric") :
### no applicable method for 'isSymmetric' applied to an object of class "S4"
#predicted scores

predicted_scores <- predict(fit_tournament, tournament_data_complete)
## Warning in lav_object_post_check(object): lavaan WARNING: some estimated ov
## variances are negative
tournament_data_complete$predicted_visceral_interdependence_day1 <- predicted_scores[,1]
tournament_data_complete$predicted_visceral_interdependence_day2 <- predicted_scores[,2]
tournament_data_complete$predicted_social_bonding_day1 <- predicted_scores[,3]
tournament_data_complete$predicted_social_bonding_day2 <- predicted_scores[,4]

head(tournament_data_complete)
##   athleteID team  sex age yearsTeam position trainingAge startingReserve  X
## 1         1  AHM male  21         2     Back           5   Starting Team NA
## 2         2  AHM male  19         3  Forward           4         Reserve NA
## 3         3  AHM male  18         0  Forward           3         Reserve NA
## 4         4  AHM male  20         1     Back           3   Starting Team NA
## 5         5  AHM male  18         2     Back           2         Reserve NA
## 6         6  AHM male  19         2     Back           5   Starting Team NA
##   tipiExtraverted tipiAgreeableness tipiConscientiousness
## 1             5.0               5.5                   5.5
## 2             2.5               5.5                   6.5
## 3             6.5               4.0                   7.0
## 4             5.5               6.0                   5.5
## 5             4.0               4.0                   3.5
## 6             5.0               4.5                   6.5
##   tipiEmotionalStability tipiOpenness injury_pre indPerformanceExpectations_pre
## 1                    4.0          5.5        100                             81
## 2                    5.0          6.0         85                             90
## 3                    7.0          3.5         92                             72
## 4                    5.5          5.5         41                             80
## 5                    4.0          4.5         84                             71
## 6                    2.5          5.0         80                             90
##   passingTech_pre supportAttack_pre indDefense_pre effectContact_pre
## 1             100               100             86                78
## 2              85                85             86                90
## 3              51                79             59                79
## 4              80                82             89                79
## 5              67                69             64                65
## 6              90                80             45                50
##   decisionAttack_pre abilityTeammatesBaseline abilityChineseProsBaseline
## 1                 80                       29                          0
## 2                 80                        1                        -24
## 3                 71                       45                         37
## 4                 81                       30                         23
## 5                 71                      -15                        -16
## 6                 60                       25                         50
##   abilityInternationalProsBaseline teamPerformanceExpectations_pre
## 1                                0                               0
## 2                              -40                              85
## 3                               35                              93
## 4                               19                              80
## 5                              -12                              68
## 6                               50                              95
##   teamAbilityChineseProvinces_pre teamDefence_pre teamAttack_pre
## 1                             -20              90             71
## 2                              20              85             91
## 3                              17              83             84
## 4                              21              41             44
## 5                               8              65             37
## 6                              25              70             90
##   teamSupportPlay_pre teamCommunication_pre reliabilityForOthers_pre
## 1                  82                   100                      100
## 2                  90                    85                       75
## 3                  82                    86                       85
## 4                  42                    50                       60
## 5                  38                    36                       62
## 6                  85                    75                       80
##   reliabilityOfOthers_pre unspokenUnderstanding_pre generalAtmosphere_pre
## 1                     100                       100                   100
## 2                      69                        88                    90
## 3                      95                        90                    93
## 4                      64                        34                    34
## 5                      82                        68                    68
## 6                      91                        90                    85
##   abilityExtended_pre clickPictorial_pre emotionalSupport_pre sharedGoal_pre
## 1                  32                  3                   78             81
## 2                  70                  5                   70             80
## 3                  93                  3                   92             92
## 4                  44                  3                   40             41
## 5                  74                  4                   49             60
## 6                 100                  4                   10             80
##   fusionOne_pre fusionTwo_pre fusionThree_pre fusionFour_pre fusionFive_pre
## 1             3             4               5              1              5
## 2             5             4               4              5              5
## 3             5             5               5              5              3
## 4             2             3               3              3              3
## 5             3             4               4              1              4
## 6             3             3               5              1              5
##   fusionSix_pre fusionSeven_pre fusionVerbal_pre groupIDOne_pre groupIDTwo_pre
## 1             5               3         3.714286              5              3
## 2             5               5         4.714286              5              2
## 3             3               3         4.142857              1              2
## 4             3               3         2.857143              5              5
## 5             4               2         3.142857              4              4
## 6             5               5         3.857143              5              5
##   groupIDThree_pre groupIDFour_pre groupIDFive_pre groupIDSix_pre groupId_pre
## 1                5               5               5              5    4.666667
## 2                5               5               5              5    4.500000
## 3                5               5               1              3    2.833333
## 4                3               5               5              5    4.666667
## 5                3               3               4              4    3.666667
## 6                3               3               3              3    3.666667
##   fusionPictorialTeam_pre fusionPictorialFamily_pre fusionPictorialCountry_pre
## 1                       5                         3                          4
## 2                       4                         5                          5
## 3                       5                         5                          5
## 4                       4                         5                          5
## 5                       5                         5                          5
## 6                       5                         4                          4
##   rankCountry_pre rankFamily_pre rankTeam_pre aroused_day1 relaxed_day1
## 1               2              3            3            8            7
## 2               3              1            2            8            7
## 3               3              2            1            8            7
## 4               1              1            2           10             
## 5               3              2            1            5            5
## 6               1              1            1           NA           10
##   excited_day1 prpe_day1 mental_day1 fatigue_day1
## 1           10 12.847826    7.336957     70.00000
## 2            9 13.000000    6.000000     45.00000
## 3            5 17.000000    6.000000     80.00000
## 4           NA 12.847826    1.554348     70.00000
## 5            5  8.434783    5.739130     65.21739
## 6           NA 14.369565    5.739130     56.52174
##   indPerformanceExpectations_day1 teamPerformanceExpectations_day1
## 1                        80.00000                         40.00000
## 2                        70.00000                         60.00000
## 3                        15.00000                         70.00000
## 4                        70.00000                         55.00000
## 5                        48.36957                         51.08696
## 6                        49.45652                         60.32609
##   unspokenUnderstanding_day1 teamAura_day1 clickPictorial_day1
## 1                   60.00000      50.00000                   3
## 2                   60.00000      70.00000                   4
## 3                   80.00000      50.00000                   3
## 4                   60.00000      75.00000                   3
## 5                   46.19565      44.56522                   3
## 6                   40.21739      50.54348                   3
##   emotionalSupport_day1 sharedGoal_day1 fusionPictorialTeam_day1 injury_day1
## 1              75.00000       100.00000                        4    85.00000
## 2              75.00000        85.00000                        4    75.00000
## 3              90.00000        90.00000                        4   100.00000
## 4              70.00000        80.00000                        4          NA
## 5              48.36957        61.95652                        5    69.56522
## 6              74.45652        55.43478                        4    53.80435
##   aroused_day2 relaxed_day2 excited_day2 prpe_day2 mental_day2 fatigue_day2
## 1            8            2            7  13.15217    5.891304     68.47826
## 2            8            8            9  14.00000    6.000000     70.00000
## 3            8            6            6  17.41304    4.445652     83.15217
## 4            1            1           NA  16.50000    5.130435     80.00000
## 5            4            3            3  16.80435    7.336957     75.00000
## 6           NA            1           NA  16.04348    6.043478     84.78261
##   indPerformance_day2 teamPerformance_day2 unspokenUnderstanding_day2
## 1            64.13043             23.91304                   60.00000
## 2            25.00000             45.00000                   60.00000
## 3            38.58696             66.30435                   64.67391
## 4            20.00000             10.00000                   70.00000
## 5            34.23913             41.30435                   41.84783
## 6            78.80435             42.93478                   40.76087
##   teamAura_day2 clickPictorial_day2 emotionalSupport_day2 sharedGoal_day2
## 1       0.00000                   1             100.00000        50.00000
## 2      70.00000                   3              60.00000        75.00000
## 3      65.76087                   4              77.71739        79.89130
## 4      75.00000                   3              50.00000        60.00000
## 5      37.50000                   3              46.73913        42.93478
## 6      52.17391                   3              75.54348        82.06522
##   fusionPictorialTeam_day2 injury_day2 injury_post aroused_post relaxed_post
## 1                        3    50.00000          60            6            5
## 2                        4    70.00000          69            8            8
## 3                        4    75.00000          85            9           10
## 4                        4          NA          22           10           10
## 5                        5    38.58696          68            6            6
## 6                        4    34.78261          80           10           10
##   excited_post prpe_post mental_post fatigue_post indPerformance_post
## 1            5        16           8           84                  66
## 2            9        15           6           43                  70
## 3            7        10           7           85                  74
## 4           10        16           6           80                  50
## 5            5        16           7           45                  36
## 6           10        16           8           70                  80
##   passingTech_post supportAttack_post indDefense_post effectContact_post
## 1               86                 93              98                 77
## 2               70                 75              80                 80
## 3               69                 80              52                 83
## 4               35                 74              75                 36
## 5               37                 63              40                 37
## 6               95                 94              80                 85
##   decisionAttack_post challengesTournamentPost teamPerformanceExpectations_post
## 1                 100                       84                               87
## 2                  70                       68                               68
## 3                  71                       80                               80
## 4                  57                       77                               24
## 5                  37                       83                               66
## 6                  90                      100                              100
##   teamDefence_post teamAttack_post teamSupportPlay_post teamCommunication_post
## 1               78              88                   62                     65
## 2               75              70                   70                     74
## 3               81              74                   79                     80
## 4               62              59                   56                     60
## 5               38              70                   67                     36
## 6               88              95                   95                     95
##   unspokenUnderstanding_post teamAura_post reliabilityForOthers_post
## 1                         70            81                       100
## 2                         75            87                        70
## 3                         95            84                        87
## 4                         37            77                        74
## 5                         66            65                        64
## 6                         90           100                        95
##   abilityExtended_post reliabilityOfOthers_post clickPictorial_post
## 1                  100                       93                   3
## 2                   45                       60                   4
## 3                   88                       96                   4
## 4                   70                       81                   3
## 5                   68                       65                   4
## 6                   95                       50                   5
##   emotionalSupport_post sharedGoal_post fusionPictorialTeam_post fusionOne_post
## 1                    95              87                        5              5
## 2                    60              68                        4              3
## 3                    92              93                        4              5
## 4                    63              74                        4              3
## 5                    67              69                        5              3
## 6                   100             100                        5              5
##   fusionTwo_post fusionThree_post fusionFour_post fusionFive_post
## 1              4                5               3               5
## 2              3                4               4               4
## 3              5                5               2               5
## 4              3                3               3               3
## 5              3                4               2               4
## 6              5                5               1               4
##   fusionSix_post fusionSeven_post fusionVerbal_post groupIDOne_post
## 1              5                4          4.428571               5
## 2              4                4          3.714286               5
## 3              5                2          4.142857               4
## 4              3                3          3.000000               3
## 5              4                3          3.285714               4
## 6              5                4          4.142857               5
##   groupIDTwo_post groupIDThree_post groupIDFour_post groupIDFive_post
## 1               3                 5                5                5
## 2               2                 5                5                5
## 3               4                 5                5                5
## 4               3                 3                3                3
## 5               4                 4                4                4
## 6               5                 5                3                5
##   groupIDSix_post groupId_post fusionPictorialFamily_post
## 1               5     4.666667                          5
## 2               3     4.166667                          5
## 3               4     4.500000                          4
## 4               3     3.000000                          5
## 5               4     4.000000                          5
## 6               3     4.333333                          5
##   fusionPictorialCountry_post rankCountry_post rankFamily_post rankTeam_post
## 1                           4                2               3             3
## 2                           3                3               1             2
## 3                           5                3               2             1
## 4                           5                1               1             2
## 5                           5                3               2             1
## 6                           3                3               1             1
##   gameNumber_game1 opponent_game1 result_game1 starting_game1 subInjury_game1
## 1                7             JT            0              1               0
## 2                7             JT            0              0               0
## 3                7             JT            0              0               0
## 4                7             JT            0              1               0
## 5                7             JT            0              0               0
## 6                7             JT            0              0               0
##   pointsFor_game1 pointsAgainst_game1 minutes_game1 indPoints_game1
## 1               7                  10            14               0
## 2               7                  10             0               0
## 3               7                  10             0               0
## 4               7                  10             8               0
## 5               7                  10             6               0
## 6               7                  10             0               0
##   cumulativeWL_game1 gameNumber_game2 opponent_game2 result_game2
## 1                 -1               13            TJM            0
## 2                 -1               13            TJM            0
## 3                 -1               13            TJM            0
## 4                 -1               13            TJM            0
## 5                 -1               13            TJM            0
## 6                 -1               13            TJM            0
##   starting_game2 subYellow_game2 subInjury_game2 pointsFor_game2
## 1              1               0               0               0
## 2              0               0               0               0
## 3              0               0               0               0
## 4              1               0               0               0
## 5              0               0               0               0
## 6              0               0               0               0
##   pointsAgainst_game2 minutes_game2 indPoints_game2 cumulativeMinutes_game2
## 1                  40            14               0                      28
## 2                  40             6               0                       6
## 3                  40             0               0                       0
## 4                  40             8               0                      16
## 5                  40             0               0                       6
## 6                  40             6               0                       6
##   cumulativePoints_game2 cumulativeWL_game2 gameNumber_game3 opponent_game3
## 1                      0                 -2               21            FJM
## 2                      0                 -2               21            FJM
## 3                      0                 -2               21            FJM
## 4                      0                 -2               21            FJM
## 5                      0                 -2               21            FJM
## 6                      0                 -2               21            FJM
##   result_game3 starting_game3 subYellow_game3 subInjury_game3 pointsFor_game3
## 1            1              1               0               0              27
## 2            1              0               0               0              27
## 3            1              0               0               0              27
## 4            1              0               0               0              27
## 5            1              0               0               0              27
## 6            1              1               0               0              27
##   pointsAgainst_game3 minutes_game3 indPoints_game3 cumulativeMinutes_game3
## 1                   0            14               0                      42
## 2                   0             0               0                       6
## 3                   0             0               0                       0
## 4                   0             6               0                      22
## 5                   0             1               0                       7
## 6                   0             8               0                      14
##   cumulativePoints_game3 cumulativeWL_game3 gameNumber_game4 opponent_game4
## 1                      0                 -1               24            BJM
## 2                      0                 -1               24            BJM
## 3                      0                 -1               24            BJM
## 4                      0                 -1               24            BJM
## 5                      0                 -1               24            BJM
## 6                      0                 -1               24            BJM
##   result_game4 starting_game4 subYellow_game4 subInjury_game4 pointsFor_game4
## 1            0              0               0               0               0
## 2            0              1               0               0               0
## 3            0              1               0               0               0
## 4            0              0               0               0               0
## 5            0              1               0               0               0
## 6            0              1               0               0               0
##   pointsAgainst_game4 minutes_game4 indPoints_game4 cumulativeMinutes_game4
## 1                  35             0               0                      42
## 2                  35             8               0                      14
## 3                  35             6               0                       6
## 4                  35             6               0                      28
## 5                  35            14               0                      21
## 6                  35             8               0                      22
##   cumulativePoints_game4 cumulativeWL_game4 gameNumber_game5 opponent_game5
## 1                      0                 -2               30            FJM
## 2                      0                 -2               30            FJM
## 3                      0                 -2               30            FJM
## 4                      0                 -2               30            FJM
## 5                      0                 -2               30            FJM
## 6                      0                 -2               30            FJM
##   result_game5 starting_game5 subYellow_game5 subInjury_game5 pointsFor_game5
## 1            1              1               0               0              22
## 2            1              1               0               0              22
## 3            1              1               0               0              22
## 4            1              0               0               0              22
## 5            1              1               0               1              22
## 6            1              1               0               0              22
##   pointsAgainst_game5 minutes_game5 indPoints_game5 cumulativeMinutes_game5
## 1                   0            14               5                      56
## 2                   0             8               0                      22
## 3                   0             6               0                      12
## 4                   0             6               0                      34
## 5                   0             6               0                      27
## 6                   0             8               0                      30
##   cumulativePoints_game5 cumulativeWL_game5 gameNumber_game6 opponent_game6
## 1                      5                 -1               36            HBM
## 2                      0                 -1               36            HBM
## 3                      0                 -1               36            HBM
## 4                      0                 -1               36            HBM
## 5                      0                 -1               36            HBM
## 6                      0                 -1               36            HBM
##   result_game6 starting_game6 subYellow_game6 subInjury_game6 pointsFor_game6
## 1            1              1               0               0              19
## 2            1              0               0               0              19
## 3            1              0               0               0              19
## 4            1              0               0               0              19
## 5            1              0               0               0              19
## 6            1              1               0               0              19
##   pointsAgainst_game6 minutes_game6 indPoints_game6 cumulativeMinutes_game6
## 1                  12            14               0                      70
## 2                  12             0               0                      22
## 3                  12             0               0                      12
## 4                  12             0               0                      34
## 5                  12             0               0                      27
## 6                  12            14               0                      44
##   cumulativePoints_game6 cumulativeWL_game6 gamesTotal minutesTotal pointsTotal
## 1                      5                  0          6           70           5
## 2                      0                  0          6           22           0
## 3                      0                  0          6           12           0
## 4                      0                  0          6           34           0
## 5                      0                  0          6           27           0
## 6                      0                  0          6           44           0
##   WL_total startingAvg cumulativeMinutes_Day1 cumulativeMinutes_day2
## 1        0   0.2500000                     28                     56
## 2        0   0.5000000                      6                     22
## 3        0   1.0000000                      0                     12
## 4        0   0.6000000                     16                     34
## 5        0   0.8333333                      6                     27
## 6        0   1.0000000                      6                     30
##   cumulativePoints_day1 cumulativePoints_day2 WL_day1 WL_day2 finalRank
## 1                     0                     5       0       0         4
## 2                     0                     0       0       0         4
## 3                     0                     0       0       0         4
## 4                     0                     0       0       0         4
## 5                     0                     0       0       0         4
## 6                     0                     0       0       0         4
##   teamPerformanceComponents_post teamPerformanceComponents_pre
## 1                      0.6864194                     0.7809592
## 2                      0.3647715                     1.0501978
## 3                      0.6458610                     0.8318607
## 4                     -0.2637021                    -0.8880669
## 5                     -0.4150587                    -1.0531050
## 6                      1.4497511                     0.7992097
##   indPerformanceComponents_post teamClick_post socialBonding_post
## 1                     1.5064683     0.22675461          0.5315840
## 2                     0.6493488    -0.01358004         -1.0364085
## 3                     0.5956892     0.90349839          0.4702404
## 4                    -0.1070546    -0.92017449         -0.8973874
## 5                    -0.7292898    -0.36857145         -0.7848899
## 6                     1.4020583     1.00405539          0.9632656
##   socialBonding_pre fatigueFactor_post indPerformanceExpectations_preNorm
## 1         0.1816229          0.6045565                         0.56669437
## 2         0.1318736         -0.5009079                         0.98878396
## 3         0.6810516         -0.4855037                         0.14460477
## 4        -1.4207263          0.3768963                         0.51979552
## 5        -0.7680741         -0.2148382                         0.09770592
## 6        -0.7397663          0.3375862                         0.98878396
##   indPerformanceExpectations_day1Norm indPerformanceExpectations_day2Norm
## 1                           1.3827708                           0.7058322
## 2                           0.9853669                          -0.8692098
## 3                          -1.2003549                          -0.3223202
## 4                           0.9853669                          -1.0704652
## 5                           0.1257648                          -0.4973249
## 6                           0.1689609                           1.2964729
##   indPerformanceExpectations_postNorm teamPerformanceExpectations_preNorm
## 1                           0.4108446                          -3.2520881
## 2                           0.5812476                           0.6353253
## 3                           0.7516506                           1.0011995
## 4                          -0.2707675                           0.4066539
## 5                          -0.8671781                          -0.1421574
## 6                           1.0072551                           1.0926681
##   teamPerformanceExpectations_day1Norm teamPerformanceExpectations_day2Norm
## 1                          -0.80824428                           -1.2670837
## 2                          -0.03758367                           -0.5270855
## 3                           0.34774664                            0.2205416
## 4                          -0.23024882                           -1.7553300
## 5                          -0.38103025                           -0.6567759
## 6                          -0.02501855                           -0.5995595
##   teamPerformanceExpectations_postNorm objectiveCompetenceFactor
## 1                            0.9587160                0.01490811
## 2                            0.1539832               -0.17421958
## 3                            0.6622355               -1.32101507
## 4                           -1.7096085               -0.71270435
## 5                            0.0692745               -0.78637241
## 6                            1.5093227               -0.85023179
##   subjectiveCompetenceFactor fusionPictorialFamilyChange
## 1                 -0.6909715                           2
## 2                 -2.0061019                           0
## 3                  1.2749742                          -1
## 4                  0.4328477                           0
## 5                 -1.4072495                           0
## 6                  1.7249003                           1
##   teamPerformanceComponentsPrePost_pre teamPerformanceComponentsPrePost_post
## 1                            0.8507844                             0.4972990
## 2                            1.1194659                             0.3234245
## 3                            0.8957069                             0.6039347
## 4                           -0.9696120                            -0.2751380
## 5                           -1.0944980                            -0.3745075
## 6                            0.8291875                             1.3712542
##   indPerformanceComponentsPrePost_pre indPerformanceComponents_post.1
## 1                           1.2778512                       1.3158036
## 2                           0.9983334                       0.5124933
## 3                           0.3284804                       0.4659734
## 4                           0.8580448                      -0.2337555
## 5                           0.2001746                      -0.7960595
## 6                           0.2314547                       1.2554505
##   teamClickPrePost_pre teamClickPrePost_post socialBondingPrePost_pre
## 1            0.9172223            0.33426870               0.05188940
## 2            0.6657200            0.04032163              -0.06575643
## 3            0.8898100            0.93907889               0.61717935
## 4           -1.7399060           -0.82518066              -1.75035467
## 5           -0.1426176           -0.32711326              -1.03868256
## 6            0.8637609            0.99041284              -1.20466647
##   socialBondingPrePost_post fatiguePrePost_pre fatiguePrePost_post
## 1                 0.5917504        -0.08051824          0.83755038
## 2                -0.6510972        -0.44429115         -0.02606701
## 3                 0.5697324         0.89868447         -0.53656863
## 4                -0.5449662        -0.39571188          0.67658452
## 5                -0.4813802        -1.20986392          0.27651588
## 6                 0.9497229        -0.00468708          0.65572005
##   teamPerformanceComponentsChange indPerformanceComponentsChange
## 1                      -0.3534853                     0.03795234
## 2                      -0.7960414                    -0.48584006
## 3                      -0.2917722                     0.13749296
## 4                       0.6944741                    -1.09180025
## 5                       0.7199905                    -0.99623406
## 6                       0.5420668                     1.02399575
##   teamClickChange socialBondingChange fatigueChange
## 1     -0.58295361          0.53986102     0.9180686
## 2     -0.62539835         -0.58534073     0.4182241
## 3      0.04926885         -0.04744695    -1.4352531
## 4      0.91472536          1.20538850     1.0722964
## 5     -0.18449569          0.55730239     1.4863798
## 6      0.12665193          2.15438942     0.6604071
##   unspokenUnderstanding_MidTournament teamAura_MidTournament
## 1                            60.00000               25.00000
## 2                            60.00000               70.00000
## 3                            72.33696               57.88043
## 4                            65.00000               75.00000
## 5                            44.02174               41.03261
## 6                            40.48913               51.35870
##   clickPictorial_MidTournament predicted_visceral_interdependence_day1
## 1                          2.0                               -6.695276
## 2                          3.5                                2.835342
## 3                          3.5                              -16.659172
## 4                          3.0                               -9.819551
## 5                          3.0                               -3.098275
## 6                          3.0                               -3.953598
##   predicted_visceral_interdependence_day2 predicted_social_bonding_day1
## 1                              -36.154383                     7.7480265
## 2                               -4.413756                    -0.7697906
## 3                               -2.414695                     7.3022878
## 4                               -1.516309                    -6.5543438
## 5                              -22.978742                   -20.6851345
## 6                              -15.061615                   -14.2735321
##   predicted_social_bonding_day2
## 1                    -13.774182
## 2                     -8.705139
## 3                     -1.774874
## 4                    -16.932507
## 5                    -26.021705
## 6                     -5.076659

LMER Models

lme() is in the nlme package in R. It is used to fit linear mixed-effects models with both fixed and random effects. The syntax of lme() is similar to lmer() from the lme4 package, but lme() uses maximum likelihood estimation by default instead of restricted maximum likelihood estimation (REML) used by lmer().

Outcome (Y1) - Visceral Interdependence: Visceral Interdependence Factor - Day 1

Predictor (X) - Team performance ← Fixed effect (x) - Perceptions of team performance relative to prior expectations teamPerformanceExpectations_day1Norm

library(nlme)
## 
## Attaching package: 'nlme'
## The following object is masked from 'package:lme4':
## 
##     lmList
## The following object is masked from 'package:dplyr':
## 
##     collapse
y1d1 <- lme(predicted_visceral_interdependence_day1 ~
              teamPerformanceExpectations_day1Norm +
              indPerformanceExpectations_day1Norm +
              #indPerformanceExpectations_day2Norm +
              #indPerformance_average + 
              objectiveCompetenceFactor +
              subjectiveCompetenceFactor + 
              finalRank + 
              minutesTotal + 
              pointsTotal + 
              fatigue_day1 + 
              #fatigue_day2 + 
              #fatigue_average + 
              tipiExtraverted, 
            data = tournament_data_complete, 
            random = ~ 1|team, 
            na.action = na.exclude)

summary(y1d1)
## Linear mixed-effects model fit by REML
##   Data: tournament_data_complete 
##        AIC      BIC    logLik
##   698.2709 726.7042 -337.1354
## 
## Random effects:
##  Formula: ~1 | team
##         (Intercept) Residual
## StdDev:    1.931353 11.48562
## 
## Fixed effects:  predicted_visceral_interdependence_day1 ~ teamPerformanceExpectations_day1Norm +      indPerformanceExpectations_day1Norm + objectiveCompetenceFactor +      subjectiveCompetenceFactor + finalRank + minutesTotal + pointsTotal +      fatigue_day1 + tipiExtraverted 
##                                           Value Std.Error DF    t-value p-value
## (Intercept)                          -2.9528938  7.826925 68 -0.3772738  0.7071
## teamPerformanceExpectations_day1Norm  1.9860845  1.500475 68  1.3236372  0.1901
## indPerformanceExpectations_day1Norm   0.4941000  1.440712 68  0.3429554  0.7327
## objectiveCompetenceFactor             1.0132782  1.709670 68  0.5926748  0.5554
## subjectiveCompetenceFactor            1.8252545  1.252243 68  1.4575877  0.1496
## finalRank                             0.5660130  0.755520 11  0.7491701  0.4695
## minutesTotal                         -0.0141503  0.082815 68 -0.1708666  0.8648
## pointsTotal                           0.0135198  0.108499 68  0.1246069  0.9012
## fatigue_day1                         -0.0487659  0.058502 68 -0.8335738  0.4074
## tipiExtraverted                       0.4549187  0.925675 68  0.4914455  0.6247
##  Correlation: 
##                                      (Intr) tPE_1N iPE_1N objcCF sbjcCF fnlRnk
## teamPerformanceExpectations_day1Norm -0.217                                   
## indPerformanceExpectations_day1Norm   0.051 -0.366                            
## objectiveCompetenceFactor             0.217 -0.236 -0.083                     
## subjectiveCompetenceFactor            0.117  0.053 -0.057  0.193              
## finalRank                            -0.613  0.125 -0.009 -0.330 -0.155       
## minutesTotal                         -0.326  0.358 -0.122 -0.239 -0.002  0.106
## pointsTotal                           0.161 -0.144  0.025 -0.062 -0.041 -0.298
## fatigue_day1                         -0.414  0.048 -0.169  0.077 -0.033  0.181
## tipiExtraverted                      -0.622 -0.020  0.100  0.062 -0.033  0.093
##                                      mntsTt pntsTt ftg_d1
## teamPerformanceExpectations_day1Norm                     
## indPerformanceExpectations_day1Norm                      
## objectiveCompetenceFactor                                
## subjectiveCompetenceFactor                               
## finalRank                                                
## minutesTotal                                             
## pointsTotal                          -0.382              
## fatigue_day1                         -0.278  0.114       
## tipiExtraverted                      -0.091 -0.031  0.073
## 
## Standardized Within-Group Residuals:
##         Min          Q1         Med          Q3         Max 
## -2.84151566 -0.58923213 -0.03316593  0.53098778  3.29822039 
## 
## Number of Observations: 89
## Number of Groups: 13
library(r2glmm)
# Calculate R-squared
r2beta(y1d1)
##                                  Effect   Rsq upper.CL lower.CL
## 1                                 Model 0.121    0.354    0.083
## 5            subjectiveCompetenceFactor 0.028    0.144    0.000
## 2  teamPerformanceExpectations_day1Norm 0.025    0.137    0.000
## 9                          fatigue_day1 0.009    0.101    0.000
## 6                             finalRank 0.009    0.099    0.000
## 4             objectiveCompetenceFactor 0.005    0.087    0.000
## 10                      tipiExtraverted 0.003    0.081    0.000
## 3   indPerformanceExpectations_day1Norm 0.002    0.074    0.000
## 7                          minutesTotal 0.000    0.069    0.000
## 8                           pointsTotal 0.000    0.068    0.000