Roation Magnitude (Tracking)

m.RotationMagnitude.tracking.1.formula <- brmsformula(
  RotationAbs | trunc(ub = 1.02) ~ SignalingType * ResourceSpeed +
    SignalingType:ResourceSpeed:Detector +
    SignalingType:ResourceSpeed:DistFromRes +
    SignalingType:ResourceSpeed:withSocInfo:SocPosInFOV +
    SignalingType:ResourceSpeed:withSocInfo:SocMovDir +
    SignalingType:ResourceSpeed:withSocInfo:SocQual:SocPosInFOV +
    SignalingType:ResourceSpeed:withSocInfo:SocQual:SocMovDir +
    (1 + Detector + withSocInfo:SocPosInFOV + withSocInfo:SocMovDir + withSocInfo:SocQual:SocPosInFOV + withSocInfo:SocQual:SocMovDir | Participant),
  family = exponential()
)

m.RotationMagnitude.tracking.1.formula_comparison <- brmsformula(
  RotationAbs | trunc(ub = 1.02) ~ SignalingType * ResourceSpeed +
    SignalingType:ResourceSpeed:Detector +
    SignalingType:ResourceSpeed:DistFromRes +
    SignalingType:ResourceSpeed:withSocInfo:SocPosInFOV +
    SignalingType:ResourceSpeed:withSocInfo:SocMovDir +
    SignalingType:ResourceSpeed:withSocInfo:SocQual:SocPosInFOV +
    SignalingType:ResourceSpeed:withSocInfo:SocQual:SocMovDir,
  family = exponential()
)
m.RotationMagnitude.tracking.1.priors <-
  prior(normal(0, 1), class = "Intercept") +
  prior(normal(0, 0.1), class = "sd") +
  prior(normal(0, 0.5), class = b) +

  prior(constant(0), class = "sd", coef = "withSocInfo0:SocMovDir", group = "Participant") +
  prior(constant(0), class = "sd", coef = "withSocInfo0:SocPosInFOV", group = "Participant") +
  prior(constant(0), class = "sd", coef = "withSocInfo0:SocMovDir:SocQual", group = "Participant") +
  prior(constant(0), class = "sd", coef = "withSocInfo0:SocPosInFOV:SocQual", group = "Participant") +

  # no soc info priors
  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedfast:withSocInfo0:SocMovDir") +
  prior(constant(0), class = b, coef = "SignalingTypeNP:ResourceSpeedfast:withSocInfo0:SocMovDir") +
  prior(constant(0), class = b, coef = "SignalingTypeVP:ResourceSpeedfast:withSocInfo0:SocMovDir") +
  prior(constant(0), class = b, coef = "SignalingTypeFP:ResourceSpeedfast:withSocInfo0:SocMovDir") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedslow:withSocInfo0:SocMovDir") +
  prior(constant(0), class = b, coef = "SignalingTypeNP:ResourceSpeedslow:withSocInfo0:SocMovDir") +
  prior(constant(0), class = b, coef = "SignalingTypeVP:ResourceSpeedslow:withSocInfo0:SocMovDir") +
  prior(constant(0), class = b, coef = "SignalingTypeFP:ResourceSpeedslow:withSocInfo0:SocMovDir") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedfast:withSocInfo0:SocPosInFOV") +
  prior(constant(0), class = b, coef = "SignalingTypeNP:ResourceSpeedfast:withSocInfo0:SocPosInFOV") +
  prior(constant(0), class = b, coef = "SignalingTypeVP:ResourceSpeedfast:withSocInfo0:SocPosInFOV") +
  prior(constant(0), class = b, coef = "SignalingTypeFP:ResourceSpeedfast:withSocInfo0:SocPosInFOV") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedslow:withSocInfo0:SocPosInFOV") +
  prior(constant(0), class = b, coef = "SignalingTypeNP:ResourceSpeedslow:withSocInfo0:SocPosInFOV") +
  prior(constant(0), class = b, coef = "SignalingTypeVP:ResourceSpeedslow:withSocInfo0:SocPosInFOV") +
  prior(constant(0), class = b, coef = "SignalingTypeFP:ResourceSpeedslow:withSocInfo0:SocPosInFOV") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedfast:withSocInfo0:SocMovDir:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeNP:ResourceSpeedfast:withSocInfo0:SocMovDir:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeVP:ResourceSpeedfast:withSocInfo0:SocMovDir:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeFP:ResourceSpeedfast:withSocInfo0:SocMovDir:SocQual") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedslow:withSocInfo0:SocMovDir:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeNP:ResourceSpeedslow:withSocInfo0:SocMovDir:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeVP:ResourceSpeedslow:withSocInfo0:SocMovDir:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeFP:ResourceSpeedslow:withSocInfo0:SocMovDir:SocQual") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedfast:withSocInfo0:SocPosInFOV:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeNP:ResourceSpeedfast:withSocInfo0:SocPosInFOV:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeVP:ResourceSpeedfast:withSocInfo0:SocPosInFOV:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeFP:ResourceSpeedfast:withSocInfo0:SocPosInFOV:SocQual") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedslow:withSocInfo0:SocPosInFOV:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeNP:ResourceSpeedslow:withSocInfo0:SocPosInFOV:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeVP:ResourceSpeedslow:withSocInfo0:SocPosInFOV:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeFP:ResourceSpeedslow:withSocInfo0:SocPosInFOV:SocQual") +
  # A priors
  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocPosInFOV:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedfast:withSocInfo1:SocPosInFOV:SocQual") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocMovDir:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedfast:withSocInfo1:SocMovDir:SocQual") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedfast:withSocInfo1:SocPosInFOV") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocMovDir")

Prior predictive checks

m.RotationMagnitude.tracking.1.fit_prior <- brm(
  formula = m.RotationMagnitude.tracking.1.formula,
  data = m.RotationMagnitude.tracking.data,
  prior = m.RotationMagnitude.tracking.1.priors,
  chains = 4,
  cores = 4,
  seed = 42,
  iter = 2000,
  file = paste0(fits_path, "rotation_magnitude_tracking_1_prior.rds"),
  sample_prior = "only",
  backend = "cmdstanr",
  threads = threading(100),
  control = list(adapt_delta = 0.95),
  save_pars = save_pars(all = TRUE)
)

m.RotationMagnitude.tracking.1.y <- m.RotationMagnitude.tracking.data$RotationAbs
pp_check(m.RotationMagnitude.tracking.1.fit_prior, prefix = "ppd", ndraw = 20)

Model fitting (~9.5h)

m.RotationMagnitude.tracking.1.fit <- brm(
  formula = m.RotationMagnitude.tracking.1.formula,
  data = m.RotationMagnitude.tracking.data,
  prior = m.RotationMagnitude.tracking.1.priors,
  chains = 4,
  cores = 4,
  seed = 4242,
  warmup = 2000,
  iter = 5000,
  file = paste0(fits_path, "rotation_magnitude_tracking_1.rds"),
  backend = "cmdstanr",
  threads = threading(100),
  save_pars = save_pars(all = FALSE)
)
summary(m.RotationMagnitude.tracking.1.fit, ask = F)
##  Family: exponential 
##   Links: mu = log 
## Formula: RotationAbs | trunc(ub = 1.02) ~ SignalingType * ResourceSpeed + SignalingType:ResourceSpeed:Detector + SignalingType:ResourceSpeed:DistFromRes + SignalingType:ResourceSpeed:withSocInfo:SocPosInFOV + SignalingType:ResourceSpeed:withSocInfo:SocMovDir + SignalingType:ResourceSpeed:withSocInfo:SocQual:SocPosInFOV + SignalingType:ResourceSpeed:withSocInfo:SocQual:SocMovDir + (1 + Detector + withSocInfo:SocPosInFOV + withSocInfo:SocMovDir + withSocInfo:SocQual:SocPosInFOV + withSocInfo:SocQual:SocMovDir | Participant) 
##    Data: m.RotationMagnitude.tracking.data (Number of observations: 276674) 
##   Draws: 4 chains, each with iter = 5000; warmup = 2000; thin = 1;
##          total post-warmup draws = 12000
## 
## Multilevel Hyperparameters:
## ~Participant (Number of levels: 621) 
##                                                                        Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sd(Intercept)                                                              0.60      0.02     0.56     0.63 1.00     1030     1750
## sd(Detector)                                                               0.46      0.01     0.43     0.49 1.00     2043     3974
## sd(withSocInfo0:SocPosInFOV)                                               0.00      0.00     0.00     0.00   NA       NA       NA
## sd(withSocInfo1:SocPosInFOV)                                               0.26      0.01     0.24     0.29 1.00     4641     7837
## sd(withSocInfo0:SocMovDir)                                                 0.00      0.00     0.00     0.00   NA       NA       NA
## sd(withSocInfo1:SocMovDir)                                                 0.23      0.01     0.21     0.26 1.00     5132     8107
## sd(withSocInfo0:SocPosInFOV:SocQual)                                       0.00      0.00     0.00     0.00   NA       NA       NA
## sd(withSocInfo1:SocPosInFOV:SocQual)                                       0.24      0.01     0.22     0.27 1.00     5743     8540
## sd(withSocInfo0:SocMovDir:SocQual)                                         0.00      0.00     0.00     0.00   NA       NA       NA
## sd(withSocInfo1:SocMovDir:SocQual)                                         0.25      0.01     0.22     0.27 1.00     6124     8998
## cor(Intercept,Detector)                                                    0.44      0.03     0.37     0.50 1.00     1445     3134
## cor(Intercept,withSocInfo0:SocPosInFOV)                                    0.00      0.30    -0.57     0.58 1.00    21318     8527
## cor(Detector,withSocInfo0:SocPosInFOV)                                     0.00      0.30    -0.57     0.57 1.00    20636     8656
## cor(Intercept,withSocInfo1:SocPosInFOV)                                    0.09      0.06    -0.02     0.19 1.00     4369     6943
## cor(Detector,withSocInfo1:SocPosInFOV)                                    -0.43      0.05    -0.53    -0.33 1.00     4157     7468
## cor(withSocInfo0:SocPosInFOV,withSocInfo1:SocPosInFOV)                    -0.01      0.29    -0.56     0.55 1.03      110      317
## cor(Intercept,withSocInfo0:SocMovDir)                                     -0.00      0.31    -0.58     0.58 1.00    21847     8325
## cor(Detector,withSocInfo0:SocMovDir)                                       0.00      0.31    -0.59     0.58 1.00    21387     7988
## cor(withSocInfo0:SocPosInFOV,withSocInfo0:SocMovDir)                       0.00      0.30    -0.58     0.58 1.00    12240     8830
## cor(withSocInfo1:SocPosInFOV,withSocInfo0:SocMovDir)                      -0.00      0.31    -0.59     0.58 1.00    21413     8460
## cor(Intercept,withSocInfo1:SocMovDir)                                      0.53      0.05     0.44     0.61 1.00     5488     7812
## cor(Detector,withSocInfo1:SocMovDir)                                       0.11      0.06    -0.00     0.22 1.00     3803     7170
## cor(withSocInfo0:SocPosInFOV,withSocInfo1:SocMovDir)                      -0.02      0.29    -0.57     0.53 1.02      196      474
## cor(withSocInfo1:SocPosInFOV,withSocInfo1:SocMovDir)                       0.12      0.07    -0.01     0.25 1.00     5075     7628
## cor(withSocInfo0:SocMovDir,withSocInfo1:SocMovDir)                         0.02      0.30    -0.56     0.59 1.02      185      529
## cor(Intercept,withSocInfo0:SocPosInFOV:SocQual)                           -0.00      0.30    -0.58     0.57 1.00    21693     8914
## cor(Detector,withSocInfo0:SocPosInFOV:SocQual)                            -0.00      0.31    -0.59     0.58 1.00    23111     8645
## cor(withSocInfo0:SocPosInFOV,withSocInfo0:SocPosInFOV:SocQual)            -0.00      0.30    -0.57     0.57 1.00    12116     8575
## cor(withSocInfo1:SocPosInFOV,withSocInfo0:SocPosInFOV:SocQual)            -0.00      0.30    -0.58     0.58 1.00    22311     8351
## cor(withSocInfo0:SocMovDir,withSocInfo0:SocPosInFOV:SocQual)               0.00      0.30    -0.58     0.58 1.00     9745     9705
## cor(withSocInfo1:SocMovDir,withSocInfo0:SocPosInFOV:SocQual)              -0.00      0.30    -0.58     0.57 1.00    22894     8544
## cor(Intercept,withSocInfo1:SocPosInFOV:SocQual)                            0.22      0.06     0.10     0.34 1.00     8064     8651
## cor(Detector,withSocInfo1:SocPosInFOV:SocQual)                             0.03      0.07    -0.10     0.16 1.00     7641     8154
## cor(withSocInfo0:SocPosInFOV,withSocInfo1:SocPosInFOV:SocQual)             0.08      0.28    -0.49     0.59 1.03      172      460
## cor(withSocInfo1:SocPosInFOV,withSocInfo1:SocPosInFOV:SocQual)            -0.06      0.07    -0.21     0.08 1.00     5890     8622
## cor(withSocInfo0:SocMovDir,withSocInfo1:SocPosInFOV:SocQual)               0.03      0.30    -0.54     0.61 1.02      188      625
## cor(withSocInfo1:SocMovDir,withSocInfo1:SocPosInFOV:SocQual)               0.10      0.07    -0.04     0.25 1.00     5785     8437
## cor(withSocInfo0:SocPosInFOV:SocQual,withSocInfo1:SocPosInFOV:SocQual)     0.02      0.30    -0.55     0.59 1.02      264      906
## cor(Intercept,withSocInfo0:SocMovDir:SocQual)                             -0.00      0.30    -0.58     0.57 1.00    19058     8591
## cor(Detector,withSocInfo0:SocMovDir:SocQual)                              -0.00      0.30    -0.57     0.57 1.00    19995     8221
## cor(withSocInfo0:SocPosInFOV,withSocInfo0:SocMovDir:SocQual)               0.00      0.30    -0.57     0.57 1.00    13150     9540
## cor(withSocInfo1:SocPosInFOV,withSocInfo0:SocMovDir:SocQual)               0.00      0.30    -0.58     0.57 1.00    19945     8065
## cor(withSocInfo0:SocMovDir,withSocInfo0:SocMovDir:SocQual)                 0.00      0.30    -0.56     0.57 1.00     9310     8809
## cor(withSocInfo1:SocMovDir,withSocInfo0:SocMovDir:SocQual)                -0.00      0.30    -0.58     0.58 1.00    17813     9162
## cor(withSocInfo0:SocPosInFOV:SocQual,withSocInfo0:SocMovDir:SocQual)       0.00      0.30    -0.57     0.57 1.00     7640     9458
## cor(withSocInfo1:SocPosInFOV:SocQual,withSocInfo0:SocMovDir:SocQual)      -0.00      0.31    -0.58     0.58 1.00    20888     9414
## cor(Intercept,withSocInfo1:SocMovDir:SocQual)                              0.49      0.05     0.39     0.59 1.00     7733     8850
## cor(Detector,withSocInfo1:SocMovDir:SocQual)                               0.15      0.06     0.03     0.27 1.00     5245     8917
## cor(withSocInfo0:SocPosInFOV,withSocInfo1:SocMovDir:SocQual)               0.05      0.29    -0.54     0.59 1.03      243      642
## cor(withSocInfo1:SocPosInFOV,withSocInfo1:SocMovDir:SocQual)               0.11      0.07    -0.03     0.24 1.00     5663     7336
## cor(withSocInfo0:SocMovDir,withSocInfo1:SocMovDir:SocQual)                 0.01      0.30    -0.57     0.57 1.02      201      748
## cor(withSocInfo1:SocMovDir,withSocInfo1:SocMovDir:SocQual)                 0.09      0.07    -0.04     0.24 1.00     5805     8803
## cor(withSocInfo0:SocPosInFOV:SocQual,withSocInfo1:SocMovDir:SocQual)       0.01      0.30    -0.57     0.58 1.01      283      991
## cor(withSocInfo1:SocPosInFOV:SocQual,withSocInfo1:SocMovDir:SocQual)       0.06      0.08    -0.10     0.22 1.00     5109     8154
## cor(withSocInfo0:SocMovDir:SocQual,withSocInfo1:SocMovDir:SocQual)        -0.01      0.30    -0.58     0.58 1.01      294     1622
## 
## Regression Coefficients:
##                                                                    Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## Intercept                                                             -1.68      0.07    -1.81    -1.54 1.01      615     1388
## SignalingTypeNP                                                        0.13      0.10    -0.06     0.31 1.00      641     1611
## SignalingTypeVP                                                       -0.16      0.09    -0.34     0.01 1.01      561     1005
## SignalingTypeFP                                                        0.41      0.10     0.21     0.60 1.00      586     1216
## ResourceSpeedslow                                                      0.11      0.10    -0.08     0.30 1.01      530     1191
## SignalingTypeNP:ResourceSpeedslow                                     -0.03      0.13    -0.29     0.23 1.01      447     1368
## SignalingTypeVP:ResourceSpeedslow                                      0.45      0.13     0.19     0.70 1.01      505     1152
## SignalingTypeFP:ResourceSpeedslow                                      0.16      0.13    -0.08     0.41 1.01      568     1322
## SignalingTypeA:ResourceSpeedfast:Detector                              1.49      0.06     1.38     1.60 1.01     1365     2661
## SignalingTypeNP:ResourceSpeedfast:Detector                             1.24      0.06     1.13     1.35 1.00     1518     3081
## SignalingTypeVP:ResourceSpeedfast:Detector                             1.06      0.05     0.96     1.16 1.00     1226     2682
## SignalingTypeFP:ResourceSpeedfast:Detector                             1.01      0.06     0.90     1.12 1.00     1108     2159
## SignalingTypeA:ResourceSpeedslow:Detector                              1.82      0.06     1.71     1.92 1.01     1197     2781
## SignalingTypeNP:ResourceSpeedslow:Detector                             1.47      0.05     1.37     1.57 1.00      554     1604
## SignalingTypeVP:ResourceSpeedslow:Detector                             1.34      0.05     1.23     1.44 1.00      651     1714
## SignalingTypeFP:ResourceSpeedslow:Detector                             1.23      0.05     1.13     1.33 1.00      770     1717
## SignalingTypeA:ResourceSpeedfast:DistFromRes                           0.27      0.02     0.23     0.31 1.00    18609     8717
## SignalingTypeNP:ResourceSpeedfast:DistFromRes                          0.51      0.02     0.47     0.56 1.00    18392     9656
## SignalingTypeVP:ResourceSpeedfast:DistFromRes                          0.68      0.02     0.64     0.72 1.00    16618     9545
## SignalingTypeFP:ResourceSpeedfast:DistFromRes                          0.45      0.02     0.41     0.48 1.00    18106     9526
## SignalingTypeA:ResourceSpeedslow:DistFromRes                           0.35      0.02     0.31     0.38 1.00    16827     9205
## SignalingTypeNP:ResourceSpeedslow:DistFromRes                          0.63      0.01     0.60     0.66 1.00    18495     9200
## SignalingTypeVP:ResourceSpeedslow:DistFromRes                          0.42      0.01     0.39     0.45 1.00    20124     9018
## SignalingTypeFP:ResourceSpeedslow:DistFromRes                          0.53      0.02     0.50     0.56 1.00    18454     9513
## SignalingTypeA:ResourceSpeedfast:withSocInfo0:SocPosInFOV              0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedfast:withSocInfo0:SocPosInFOV             0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeVP:ResourceSpeedfast:withSocInfo0:SocPosInFOV             0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeFP:ResourceSpeedfast:withSocInfo0:SocPosInFOV             0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeA:ResourceSpeedslow:withSocInfo0:SocPosInFOV              0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedslow:withSocInfo0:SocPosInFOV             0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeVP:ResourceSpeedslow:withSocInfo0:SocPosInFOV             0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeFP:ResourceSpeedslow:withSocInfo0:SocPosInFOV             0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeA:ResourceSpeedfast:withSocInfo1:SocPosInFOV              0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedfast:withSocInfo1:SocPosInFOV             0.13      0.05     0.04     0.23 1.00     5148     8481
## SignalingTypeVP:ResourceSpeedfast:withSocInfo1:SocPosInFOV             0.25      0.04     0.18     0.33 1.00     3984     6995
## SignalingTypeFP:ResourceSpeedfast:withSocInfo1:SocPosInFOV             0.37      0.04     0.29     0.44 1.00     3275     6084
## SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocPosInFOV              0.00      0.49    -0.97     0.98 1.00    20554     7732
## SignalingTypeNP:ResourceSpeedslow:withSocInfo1:SocPosInFOV             0.19      0.03     0.13     0.26 1.00     1976     4818
## SignalingTypeVP:ResourceSpeedslow:withSocInfo1:SocPosInFOV             0.18      0.03     0.12     0.25 1.00     2130     4659
## SignalingTypeFP:ResourceSpeedslow:withSocInfo1:SocPosInFOV             0.28      0.03     0.21     0.34 1.00     1941     4556
## SignalingTypeA:ResourceSpeedfast:withSocInfo0:SocMovDir                0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedfast:withSocInfo0:SocMovDir               0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeVP:ResourceSpeedfast:withSocInfo0:SocMovDir               0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeFP:ResourceSpeedfast:withSocInfo0:SocMovDir               0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeA:ResourceSpeedslow:withSocInfo0:SocMovDir                0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedslow:withSocInfo0:SocMovDir               0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeVP:ResourceSpeedslow:withSocInfo0:SocMovDir               0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeFP:ResourceSpeedslow:withSocInfo0:SocMovDir               0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeA:ResourceSpeedfast:withSocInfo1:SocMovDir               -0.00      0.50    -1.00     0.97 1.00    24641     8304
## SignalingTypeNP:ResourceSpeedfast:withSocInfo1:SocMovDir               0.07      0.04    -0.02     0.15 1.00     4058     7968
## SignalingTypeVP:ResourceSpeedfast:withSocInfo1:SocMovDir               0.09      0.03     0.03     0.16 1.00     3044     6202
## SignalingTypeFP:ResourceSpeedfast:withSocInfo1:SocMovDir               0.33      0.03     0.26     0.39 1.00     2761     4993
## SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocMovDir                0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedslow:withSocInfo1:SocMovDir               0.23      0.03     0.17     0.29 1.00     1061     3255
## SignalingTypeVP:ResourceSpeedslow:withSocInfo1:SocMovDir               0.23      0.03     0.17     0.29 1.00     1208     2954
## SignalingTypeFP:ResourceSpeedslow:withSocInfo1:SocMovDir               0.36      0.03     0.31     0.42 1.00     1162     3260
## SignalingTypeA:ResourceSpeedfast:withSocInfo0:SocPosInFOV:SocQual      0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedfast:withSocInfo0:SocPosInFOV:SocQual     0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeVP:ResourceSpeedfast:withSocInfo0:SocPosInFOV:SocQual     0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeFP:ResourceSpeedfast:withSocInfo0:SocPosInFOV:SocQual     0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeA:ResourceSpeedslow:withSocInfo0:SocPosInFOV:SocQual      0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedslow:withSocInfo0:SocPosInFOV:SocQual     0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeVP:ResourceSpeedslow:withSocInfo0:SocPosInFOV:SocQual     0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeFP:ResourceSpeedslow:withSocInfo0:SocPosInFOV:SocQual     0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeA:ResourceSpeedfast:withSocInfo1:SocPosInFOV:SocQual      0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedfast:withSocInfo1:SocPosInFOV:SocQual     0.02      0.05    -0.08     0.11 1.00     9371     9319
## SignalingTypeVP:ResourceSpeedfast:withSocInfo1:SocPosInFOV:SocQual     0.09      0.04     0.01     0.16 1.00     8045     8956
## SignalingTypeFP:ResourceSpeedfast:withSocInfo1:SocPosInFOV:SocQual     0.26      0.04     0.18     0.33 1.00     7528     9123
## SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocPosInFOV:SocQual      0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedslow:withSocInfo1:SocPosInFOV:SocQual     0.06      0.03    -0.01     0.12 1.00     5368     8649
## SignalingTypeVP:ResourceSpeedslow:withSocInfo1:SocPosInFOV:SocQual     0.12      0.03     0.06     0.19 1.00     5475     7902
## SignalingTypeFP:ResourceSpeedslow:withSocInfo1:SocPosInFOV:SocQual     0.19      0.03     0.13     0.26 1.00     4746     8148
## SignalingTypeA:ResourceSpeedfast:withSocInfo0:SocMovDir:SocQual        0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedfast:withSocInfo0:SocMovDir:SocQual       0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeVP:ResourceSpeedfast:withSocInfo0:SocMovDir:SocQual       0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeFP:ResourceSpeedfast:withSocInfo0:SocMovDir:SocQual       0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeA:ResourceSpeedslow:withSocInfo0:SocMovDir:SocQual        0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedslow:withSocInfo0:SocMovDir:SocQual       0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeVP:ResourceSpeedslow:withSocInfo0:SocMovDir:SocQual       0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeFP:ResourceSpeedslow:withSocInfo0:SocMovDir:SocQual       0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeA:ResourceSpeedfast:withSocInfo1:SocMovDir:SocQual        0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedfast:withSocInfo1:SocMovDir:SocQual      -0.01      0.05    -0.10     0.09 1.00     4475     7733
## SignalingTypeVP:ResourceSpeedfast:withSocInfo1:SocMovDir:SocQual       0.04      0.04    -0.03     0.12 1.00     4008     7658
## SignalingTypeFP:ResourceSpeedfast:withSocInfo1:SocMovDir:SocQual       0.19      0.04     0.11     0.26 1.00     3578     7510
## SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocMovDir:SocQual        0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedslow:withSocInfo1:SocMovDir:SocQual       0.07      0.03     0.00     0.14 1.00     1505     4203
## SignalingTypeVP:ResourceSpeedslow:withSocInfo1:SocMovDir:SocQual       0.11      0.03     0.05     0.18 1.00     2179     5980
## SignalingTypeFP:ResourceSpeedslow:withSocInfo1:SocMovDir:SocQual       0.23      0.03     0.17     0.30 1.00     1669     5119
## 
## Draws were sampled using sample(hmc). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).

Model diagnostics

m.RotationMagnitude.tracking.1.y <- m.RotationMagnitude.tracking.data$RotationAbs
m.RotationMagnitude.tracking.1.yrep <- posterior_predict(m.RotationMagnitude.tracking.1.fit, draws = 10)
ppc_dens_overlay(m.RotationMagnitude.tracking.1.y, m.RotationMagnitude.tracking.1.yrep[1:10, ])

ppc_dens_overlay_grouped(m.RotationMagnitude.tracking.1.y,
  m.RotationMagnitude.tracking.1.yrep[1:10, ],
  group = m.RotationMagnitude.tracking.data$ResourceSpeed
)

ppc_dens_overlay_grouped(m.RotationMagnitude.tracking.1.y,
  m.RotationMagnitude.tracking.1.yrep[1:10, ],
  group = m.RotationMagnitude.tracking.data$SignalingType
)

group <- m.RotationMagnitude.tracking.data$SignalingType
mask <- m.RotationMagnitude.tracking.data$ResourceSpeed == "fast"

ppc_dens_overlay_grouped(m.RotationMagnitude.tracking.1.y[mask],
  m.RotationMagnitude.tracking.1.yrep[1:10, mask],
  group = group[mask]
)

group <- m.RotationMagnitude.tracking.data$SignalingType
mask <- m.RotationMagnitude.tracking.data$ResourceSpeed == "slow"

ppc_dens_overlay_grouped(m.RotationMagnitude.tracking.1.y[mask],
  m.RotationMagnitude.tracking.1.yrep[1:10, mask],
  group = group[mask]
)

Model predictions

m.RotationMagnitude.tracking.1.df_fit <- as.data.frame(m.RotationMagnitude.tracking.1.fit)
mcmc_areas(
  m.RotationMagnitude.tracking.1.df_fit %>% dplyr::select(
    starts_with("b_"), -c("b_Intercept"), -contains("withSocInfo0"),
    -contains("SignalingTypeA:ResourceSpeedslow:withSocInfo1"),
    -contains("SignalingTypeA:ResourceSpeedfast:withSocInfo1"),
  ),
  prob = 0.95, # 95% intervals
  prob_outer = 0.99, # 99%
  point_est = "mean"
) + ggplot2::labs(
  title = "Posterior parameter distributions",
  subtitle = "with medians and 95% intervals"
)

m.RotationMagnitude.tracking.1.draws <- m.RotationMagnitude.tracking.data %>%
  group_by() %>%
  data_grid(
    SignalingType = c("NP", "VP", "FP"),
    ResourceSpeed,
    withSocInfo = c(1),
    SocQual = c(-1, -0.5, 0.5, 1),
    SocMovDir = seq(-1, 1, 0.4),
    SocPosInFOV = seq(-1, 1, 0.2),
    Detector = seq(-1, 1, 0.2),
    DistFromRes = seq(-1, 1, 0.4),
  ) %>%
  tidybayes::add_epred_draws(m.RotationMagnitude.tracking.1.fit,
    allow_new_levels = TRUE,
    re_formula = m.RotationMagnitude.tracking.1.formula_comparison
  )
.variable .value .lower .upper .width .point .interval
b_Intercept -1.68 -1.79 -1.57 0.9 mean hdci
b_ResourceSpeedslow 0.11 -0.05 0.26 0.9 mean hdci
b_SignalingTypeA:ResourceSpeedfast:Detector 1.49 1.39 1.59 0.9 mean hdci
b_SignalingTypeA:ResourceSpeedfast:DistFromRes 0.27 0.23 0.30 0.9 mean hdci
b_SignalingTypeA:ResourceSpeedfast:withSocInfo0:SocMovDir 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeA:ResourceSpeedfast:withSocInfo0:SocMovDir:SocQual 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeA:ResourceSpeedfast:withSocInfo0:SocPosInFOV 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeA:ResourceSpeedfast:withSocInfo0:SocPosInFOV:SocQual 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeA:ResourceSpeedfast:withSocInfo1:SocMovDir 0.00 -0.82 0.82 0.9 mean hdci
b_SignalingTypeA:ResourceSpeedfast:withSocInfo1:SocMovDir:SocQual 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeA:ResourceSpeedfast:withSocInfo1:SocPosInFOV 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeA:ResourceSpeedfast:withSocInfo1:SocPosInFOV:SocQual 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeA:ResourceSpeedslow:Detector 1.82 1.72 1.91 0.9 mean hdci
b_SignalingTypeA:ResourceSpeedslow:DistFromRes 0.35 0.32 0.38 0.9 mean hdci
b_SignalingTypeA:ResourceSpeedslow:withSocInfo0:SocMovDir 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeA:ResourceSpeedslow:withSocInfo0:SocMovDir:SocQual 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeA:ResourceSpeedslow:withSocInfo0:SocPosInFOV 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeA:ResourceSpeedslow:withSocInfo0:SocPosInFOV:SocQual 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocMovDir 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocMovDir:SocQual 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocPosInFOV 0.00 -0.82 0.80 0.9 mean hdci
b_SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocPosInFOV:SocQual 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeFP 0.41 0.24 0.57 0.9 mean hdci
b_SignalingTypeFP:ResourceSpeedfast:Detector 1.01 0.92 1.10 0.9 mean hdci
b_SignalingTypeFP:ResourceSpeedfast:DistFromRes 0.45 0.42 0.48 0.9 mean hdci
b_SignalingTypeFP:ResourceSpeedfast:withSocInfo0:SocMovDir 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeFP:ResourceSpeedfast:withSocInfo0:SocMovDir:SocQual 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeFP:ResourceSpeedfast:withSocInfo0:SocPosInFOV 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeFP:ResourceSpeedfast:withSocInfo0:SocPosInFOV:SocQual 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeFP:ResourceSpeedfast:withSocInfo1:SocMovDir 0.33 0.27 0.38 0.9 mean hdci
b_SignalingTypeFP:ResourceSpeedfast:withSocInfo1:SocMovDir:SocQual 0.19 0.12 0.25 0.9 mean hdci
b_SignalingTypeFP:ResourceSpeedfast:withSocInfo1:SocPosInFOV 0.37 0.31 0.43 0.9 mean hdci
b_SignalingTypeFP:ResourceSpeedfast:withSocInfo1:SocPosInFOV:SocQual 0.26 0.19 0.32 0.9 mean hdci
b_SignalingTypeFP:ResourceSpeedslow 0.16 -0.05 0.36 0.9 mean hdci
b_SignalingTypeFP:ResourceSpeedslow:Detector 1.23 1.15 1.31 0.9 mean hdci
b_SignalingTypeFP:ResourceSpeedslow:DistFromRes 0.53 0.50 0.56 0.9 mean hdci
b_SignalingTypeFP:ResourceSpeedslow:withSocInfo0:SocMovDir 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeFP:ResourceSpeedslow:withSocInfo0:SocMovDir:SocQual 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeFP:ResourceSpeedslow:withSocInfo0:SocPosInFOV 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeFP:ResourceSpeedslow:withSocInfo0:SocPosInFOV:SocQual 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeFP:ResourceSpeedslow:withSocInfo1:SocMovDir 0.36 0.32 0.41 0.9 mean hdci
b_SignalingTypeFP:ResourceSpeedslow:withSocInfo1:SocMovDir:SocQual 0.23 0.18 0.29 0.9 mean hdci
b_SignalingTypeFP:ResourceSpeedslow:withSocInfo1:SocPosInFOV 0.28 0.23 0.33 0.9 mean hdci
b_SignalingTypeFP:ResourceSpeedslow:withSocInfo1:SocPosInFOV:SocQual 0.19 0.14 0.25 0.9 mean hdci
b_SignalingTypeNP 0.13 -0.02 0.29 0.9 mean hdci
b_SignalingTypeNP:ResourceSpeedfast:Detector 1.24 1.14 1.33 0.9 mean hdci
b_SignalingTypeNP:ResourceSpeedfast:DistFromRes 0.51 0.47 0.56 0.9 mean hdci
b_SignalingTypeNP:ResourceSpeedfast:withSocInfo0:SocMovDir 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeNP:ResourceSpeedfast:withSocInfo0:SocMovDir:SocQual 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeNP:ResourceSpeedfast:withSocInfo0:SocPosInFOV 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeNP:ResourceSpeedfast:withSocInfo0:SocPosInFOV:SocQual 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeNP:ResourceSpeedfast:withSocInfo1:SocMovDir 0.07 0.00 0.14 0.9 mean hdci
b_SignalingTypeNP:ResourceSpeedfast:withSocInfo1:SocMovDir:SocQual -0.01 -0.09 0.07 0.9 mean hdci
b_SignalingTypeNP:ResourceSpeedfast:withSocInfo1:SocPosInFOV 0.13 0.06 0.21 0.9 mean hdci
b_SignalingTypeNP:ResourceSpeedfast:withSocInfo1:SocPosInFOV:SocQual 0.02 -0.06 0.10 0.9 mean hdci
b_SignalingTypeNP:ResourceSpeedslow -0.03 -0.24 0.20 0.9 mean hdci
b_SignalingTypeNP:ResourceSpeedslow:Detector 1.47 1.38 1.56 0.9 mean hdci
b_SignalingTypeNP:ResourceSpeedslow:DistFromRes 0.63 0.61 0.66 0.9 mean hdci
b_SignalingTypeNP:ResourceSpeedslow:withSocInfo0:SocMovDir 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeNP:ResourceSpeedslow:withSocInfo0:SocMovDir:SocQual 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeNP:ResourceSpeedslow:withSocInfo0:SocPosInFOV 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeNP:ResourceSpeedslow:withSocInfo0:SocPosInFOV:SocQual 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeNP:ResourceSpeedslow:withSocInfo1:SocMovDir 0.23 0.18 0.28 0.9 mean hdci
b_SignalingTypeNP:ResourceSpeedslow:withSocInfo1:SocMovDir:SocQual 0.07 0.02 0.13 0.9 mean hdci
b_SignalingTypeNP:ResourceSpeedslow:withSocInfo1:SocPosInFOV 0.19 0.14 0.25 0.9 mean hdci
b_SignalingTypeNP:ResourceSpeedslow:withSocInfo1:SocPosInFOV:SocQual 0.06 0.00 0.11 0.9 mean hdci
b_SignalingTypeVP -0.16 -0.30 -0.01 0.9 mean hdci
b_SignalingTypeVP:ResourceSpeedfast:Detector 1.06 0.97 1.14 0.9 mean hdci
b_SignalingTypeVP:ResourceSpeedfast:DistFromRes 0.68 0.64 0.71 0.9 mean hdci
b_SignalingTypeVP:ResourceSpeedfast:withSocInfo0:SocMovDir 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeVP:ResourceSpeedfast:withSocInfo0:SocMovDir:SocQual 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeVP:ResourceSpeedfast:withSocInfo0:SocPosInFOV 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeVP:ResourceSpeedfast:withSocInfo0:SocPosInFOV:SocQual 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeVP:ResourceSpeedfast:withSocInfo1:SocMovDir 0.09 0.04 0.15 0.9 mean hdci
b_SignalingTypeVP:ResourceSpeedfast:withSocInfo1:SocMovDir:SocQual 0.04 -0.02 0.11 0.9 mean hdci
b_SignalingTypeVP:ResourceSpeedfast:withSocInfo1:SocPosInFOV 0.25 0.19 0.32 0.9 mean hdci
b_SignalingTypeVP:ResourceSpeedfast:withSocInfo1:SocPosInFOV:SocQual 0.09 0.02 0.15 0.9 mean hdci
b_SignalingTypeVP:ResourceSpeedslow 0.45 0.23 0.66 0.9 mean hdci
b_SignalingTypeVP:ResourceSpeedslow:Detector 1.34 1.25 1.42 0.9 mean hdci
b_SignalingTypeVP:ResourceSpeedslow:DistFromRes 0.42 0.40 0.45 0.9 mean hdci
b_SignalingTypeVP:ResourceSpeedslow:withSocInfo0:SocMovDir 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeVP:ResourceSpeedslow:withSocInfo0:SocMovDir:SocQual 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeVP:ResourceSpeedslow:withSocInfo0:SocPosInFOV 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeVP:ResourceSpeedslow:withSocInfo0:SocPosInFOV:SocQual 0.00 0.00 0.00 0.9 mean hdci
b_SignalingTypeVP:ResourceSpeedslow:withSocInfo1:SocMovDir 0.23 0.18 0.28 0.9 mean hdci
b_SignalingTypeVP:ResourceSpeedslow:withSocInfo1:SocMovDir:SocQual 0.11 0.06 0.17 0.9 mean hdci
b_SignalingTypeVP:ResourceSpeedslow:withSocInfo1:SocPosInFOV 0.18 0.13 0.24 0.9 mean hdci
b_SignalingTypeVP:ResourceSpeedslow:withSocInfo1:SocPosInFOV:SocQual 0.12 0.07 0.18 0.9 mean hdci
m.RotationMagnitude.tracking.1.tidy_draws2 <- m.RotationMagnitude.tracking.1.tidy_draws %>%
  # separate_wider_delim(.variable, delim = ":")
  filter(str_detect(.variable, "b_SignalingType")) %>%
  mutate(signaling = factor(case_when(
    str_detect(.variable, "b_SignalingTypeNP") ~ "NP",
    str_detect(.variable, "b_SignalingTypeVP") ~ "VP",
    str_detect(.variable, "b_SignalingTypeFP") ~ "FP",
    str_detect(.variable, "b_SignalingTypeA") ~ "A",
  ), levels = c("A", "NP", "VP", "FP"))) %>%
  mutate(resource = factor(case_when(
    str_detect(.variable, "ResourceSpeedfast") ~ "fast",
    str_detect(.variable, "ResourceSpeedslow") ~ "slow",
  ), levels = c("fast", "slow"))) %>%
  mutate(socInfo = case_when(
    str_detect(.variable, "withSocInfo0") ~ 0,
    str_detect(.variable, "withSocInfo1") ~ 1,
  )) %>%
  filter(((socInfo == 1) | is.na(socInfo)), ((signaling == "A") & is.na(socInfo)) | (signaling != "A")) %>%
  mutate(weight = factor(case_when(
    str_detect(.variable, ":Detector") ~ "Detector Change",
    str_detect(.variable, ":DistFromRes") ~ "Distance", #  to Resource Center
    str_detect(.variable, ":SocPosInFOV:SocQual") ~ "Position x Quality",
    str_detect(.variable, ":SocMovDir:SocQual") ~ "Movement x Quality", # Direction
    str_detect(.variable, ":SocPosInFOV") ~ "Position", #  of others
    str_detect(.variable, ":SocMovDir") ~ "Movement", #  direction of others
  ), levels = c(
    "Detector Change",
    "Distance",
    "Position",
    "Movement",
    "Position x Quality",
    "Movement x Quality"
  )))

head(m.RotationMagnitude.tracking.1.tidy_draws2)

Figures

Random Effects

Model Tracking Efficiency

m.RotationMagnitude.tracking.1.re.pcr.det.formula <- brmsformula(
  PCR_0_1 ~ SignalingType * ResourceSpeed + SignalingType:ResourceSpeed:Detector_r_eff,
  phi ~ ResourceSpeed + SignalingType,
  family = Beta()
)

m.RotationMagnitude.tracking.1.re.pcr.soc_pos.formula <- brmsformula(
  PCR_0_1 ~ SignalingType * ResourceSpeed + SignalingType:ResourceSpeed:SocInfoPos_r_eff,
  phi ~ ResourceSpeed + SignalingType,
  family = Beta()
)

m.RotationMagnitude.tracking.1.re.pcr.soc_pos_qual.formula <- brmsformula(
  PCR_0_1 ~ SignalingType * ResourceSpeed + SignalingType:ResourceSpeed:SocInfoQualityPos_r_eff,
  phi ~ ResourceSpeed + SignalingType,
  family = Beta()
)

m.RotationMagnitude.tracking.1.re.pcr.soc_mov.formula <- brmsformula(
  PCR_0_1 ~ SignalingType * ResourceSpeed + SignalingType:ResourceSpeed:SocInfoMov_r_eff,
  phi ~ ResourceSpeed + SignalingType,
  family = Beta()
)

m.RotationMagnitude.tracking.1.re.pcr.soc_mov_qual.formula <- brmsformula(
  PCR_0_1 ~ SignalingType * ResourceSpeed + SignalingType:ResourceSpeed:SocInfoQualityMov_r_eff,
  phi ~ ResourceSpeed + SignalingType,
  family = Beta()
)


m.RotationMagnitude.tracking.1.re.pcr.priors <-
  prior(normal(0, 0.5), class = b) +
  prior(normal(0, 1), class = Intercept) +
  prior(gamma(4, 0.1), class = Intercept, dpar = phi, lb = 0)
m.RotationMagnitude.tracking.1.re.pcr.det.fit <- brm(
  formula = m.RotationMagnitude.tracking.1.re.pcr.det.formula,
  data = m.RotationMagnitude.tracking.1.re.data,
  prior = m.RotationMagnitude.tracking.1.re.pcr.priors,
  chains = 4,
  cores = 4,
  seed = 42,
  iter = 2000,
  file = paste0(fits_path, "rotation_magnitude_tracking_1_random_effects_pcr_det.rds"),
  backend = "cmdstanr",
  threads = threading(100),
  save_pars = save_pars(all = TRUE)
)

m.RotationMagnitude.tracking.1.re.pcr.soc_pos.fit <- brm(
  formula = m.RotationMagnitude.tracking.1.re.pcr.soc_pos.formula,
  data = m.RotationMagnitude.tracking.1.re.data %>% filter(SignalingType != "A"),
  prior = m.RotationMagnitude.tracking.1.re.pcr.priors,
  chains = 4,
  cores = 4,
  seed = 42,
  iter = 2000,
  file = paste0(fits_path, "rotation_magnitude_tracking_1_random_effects_pcr_soc_pos.rds"),
  backend = "cmdstanr",
  threads = threading(100),
  save_pars = save_pars(all = TRUE)
)

m.RotationMagnitude.tracking.1.re.pcr.soc_pos_qual.fit <- brm(
  formula = m.RotationMagnitude.tracking.1.re.pcr.soc_pos_qual.formula,
  data = m.RotationMagnitude.tracking.1.re.data %>% filter(SignalingType != "A"),
  prior = m.RotationMagnitude.tracking.1.re.pcr.priors,
  chains = 4,
  cores = 4,
  seed = 42,
  iter = 2000,
  file = paste0(fits_path, "rotation_magnitude_tracking_1_random_effects_pcr_soc_pos_qual.rds"),
  backend = "cmdstanr",
  threads = threading(100),
  save_pars = save_pars(all = TRUE)
)

m.RotationMagnitude.tracking.1.re.pcr.soc_mov.fit <- brm(
  formula = m.RotationMagnitude.tracking.1.re.pcr.soc_mov.formula,
  data = m.RotationMagnitude.tracking.1.re.data %>% filter(SignalingType != "A"),
  prior = m.RotationMagnitude.tracking.1.re.pcr.priors,
  chains = 4,
  cores = 4,
  seed = 42,
  iter = 2000,
  file = paste0(fits_path, "rotation_magnitude_tracking_1_random_effects_pcr_soc_mov.rds"),
  backend = "cmdstanr",
  threads = threading(100),
  save_pars = save_pars(all = TRUE)
)


m.RotationMagnitude.tracking.1.re.pcr.soc_mov_qual.fit <- brm(
  formula = m.RotationMagnitude.tracking.1.re.pcr.soc_mov_qual.formula,
  data = m.RotationMagnitude.tracking.1.re.data %>% filter(SignalingType != "A"),
  prior = m.RotationMagnitude.tracking.1.re.pcr.priors,
  chains = 4,
  cores = 4,
  seed = 42,
  iter = 2000,
  file = paste0(fits_path, "rotation_magnitude_tracking_1_random_effects_pcr_soc_mov_qual.rds"),
  backend = "cmdstanr",
  threads = threading(100),
  save_pars = save_pars(all = TRUE)
)
m.RotationMagnitude.tracking.1.re.pcr.tidy_draws <- bind_rows(
  m.RotationMagnitude.tracking.1.re.pcr.det.fit %>%
    tidy_draws() %>%
    gather_variables() %>%
    filter(grepl("SignalingType", .variable) | grepl("ResourceSpeed", .variable) | grepl("b_Intercept", .variable)),
  m.RotationMagnitude.tracking.1.re.pcr.soc_pos.fit %>%
    tidy_draws() %>%
    gather_variables() %>%
    filter(grepl("SignalingType", .variable) | grepl("ResourceSpeed", .variable) | grepl("b_Intercept", .variable)),
  m.RotationMagnitude.tracking.1.re.pcr.soc_pos_qual.fit %>%
    tidy_draws() %>%
    gather_variables() %>%
    filter(grepl("SignalingType", .variable) | grepl("ResourceSpeed", .variable) | grepl("b_Intercept", .variable)),
  m.RotationMagnitude.tracking.1.re.pcr.soc_mov.fit %>%
    tidy_draws() %>%
    gather_variables() %>%
    filter(grepl("SignalingType", .variable) | grepl("ResourceSpeed", .variable) | grepl("b_Intercept", .variable)),
  m.RotationMagnitude.tracking.1.re.pcr.soc_mov_qual.fit %>%
    tidy_draws() %>%
    gather_variables() %>%
    filter(grepl("SignalingType", .variable) | grepl("ResourceSpeed", .variable) | grepl("b_Intercept", .variable))
)
m.RotationMagnitude.tracking.1.re.pcr.tidy_draws2 <- m.RotationMagnitude.tracking.1.re.pcr.tidy_draws %>%
  filter(str_detect(.variable, "SignalingType") & str_detect(.variable, "ResourceSpeed")) %>%
  mutate(signaling = factor(case_when(
    str_detect(.variable, "SignalingTypeNP") ~ "NP",
    str_detect(.variable, "SignalingTypeVP") ~ "VP",
    str_detect(.variable, "SignalingTypeFP") ~ "FP",
    str_detect(.variable, "SignalingTypeA") ~ "A",
  ), levels = c("A", "NP", "VP", "FP"))) %>%
  mutate(resource = factor(case_when(
    str_detect(.variable, "ResourceSpeedfast") ~ "fast",
    str_detect(.variable, "ResourceSpeedslow") ~ "slow",
  ), levels = c("fast", "slow"))) %>%
  mutate(weight = factor(case_when(
    str_detect(.variable, ":Detector_r_eff") ~ "Detector Sensitivity",
    str_detect(.variable, ":SocInfoQualityPos_r_eff") ~ "Position x Quality",
    str_detect(.variable, ":SocInfoQualityMov_r_eff") ~ "Movement Direction x Quality",
    str_detect(.variable, ":SocInfoPos_r_eff") ~ "Position of others",
    str_detect(.variable, ":SocInfoMov_r_eff") ~ "Movement direction of others",
    .default = "NONONONO"
  ), levels = c(
    "Intercept Rot Mag",
    "Detector Sensitivity",
    "Distance to Resource Center",
    "Position of others",
    "Position x Quality",
    "Movement direction of others",
    "Movement Direction x Quality",
    "NONONONO"
  ))) %>%
  filter(weight != "NONONONO", !((signaling == "A") & !(weight %in% c("Detector Sensitivity", "Intercept Rot Mag"))))

head(m.RotationMagnitude.tracking.1.re.pcr.tidy_draws2, 50)
rotation_magnitude_tracking_random_effects_pcr_fig <- m.RotationMagnitude.tracking.1.re.pcr.tidy_draws2 %>%
  filter(!is.na(resource), !is.na(weight)) %>%
  mutate(weight = factor(weight, levels = c(
    "Detector Sensitivity",
    "Position of others",
    "Position x Quality",
    "Movement direction of others",
    "Movement Direction x Quality"
  ))) %>%
  ggplot(aes(y = weight, x = .value, color = signaling, fill = signaling)) +
  stat_pointinterval(alpha = 0.5, .width = c(.90), point_interval = "mean_hdi", position = "dodge") +
  geom_vline(xintercept = 0, linetype = "dashed") +
  scale_color_manual(
    breaks = c("A", "NP", "VP", "FP"),
    aesthetics = c("colour", "fill"),
    values = c("#000000", "#DF536B", "#61D04F", "#2297E6"),
    guide = guide_legend(title = "Payoff Condition"),
  ) +
  # Add horizontal lines at each weight level
  geom_hline(aes(yintercept = as.numeric(weight) + 0.5), color = "grey80", linetype = "solid") +
  scale_y_discrete(limits = rev) +
  facet_grid(cols = vars(resource)) +
  theme_clean() +
  panel_border() +
  theme(
    panel.grid.major = element_blank(), # Remove major grid lines
    panel.grid.minor = element_blank(), # Remove minor grid lines
    legend.position = "bottom"
  ) +
  labs(x = "Posterior parameter estimate", y = "", title = "") #  "PCR ~ random effects"


rotation_magnitude_tracking_random_effects_pcr_fig

Model Score

m.RotationMagnitude.tracking.1.re.score.det.formula <- brmsformula(
  Score_0_1 ~ SignalingType * ResourceSpeed + SignalingType:ResourceSpeed:Detector_r_eff,
  phi ~ ResourceSpeed + SignalingType,
  family = Beta()
)

m.RotationMagnitude.tracking.1.re.score.soc_pos.formula <- brmsformula(
  Score_0_1 ~ SignalingType * ResourceSpeed + SignalingType:ResourceSpeed:SocInfoPos_r_eff,
  phi ~ ResourceSpeed + SignalingType,
  family = Beta()
)

m.RotationMagnitude.tracking.1.re.score.soc_pos_qual.formula <- brmsformula(
  Score_0_1 ~ SignalingType * ResourceSpeed + SignalingType:ResourceSpeed:SocInfoQualityPos_r_eff,
  phi ~ ResourceSpeed + SignalingType,
  family = Beta()
)

m.RotationMagnitude.tracking.1.re.score.soc_mov.formula <- brmsformula(
  Score_0_1 ~ SignalingType * ResourceSpeed + SignalingType:ResourceSpeed:SocInfoMov_r_eff,
  phi ~ ResourceSpeed + SignalingType,
  family = Beta()
)

m.RotationMagnitude.tracking.1.re.score.soc_mov_qual.formula <- brmsformula(
  Score_0_1 ~ SignalingType * ResourceSpeed + SignalingType:ResourceSpeed:SocInfoQualityMov_r_eff,
  phi ~ ResourceSpeed + SignalingType,
  family = Beta()
)


m.RotationMagnitude.tracking.1.re.score.priors <-
  prior(normal(0, 0.5), class = b) +
  prior(normal(0, 1), class = Intercept) +
  prior(gamma(4, 0.1), class = Intercept, dpar = phi, lb = 0)
m.RotationMagnitude.tracking.1.re.score.det.fit <- brm(
  formula = m.RotationMagnitude.tracking.1.re.score.det.formula,
  data = m.RotationMagnitude.tracking.1.re.data,
  prior = m.RotationMagnitude.tracking.1.re.score.priors,
  chains = 4,
  cores = 4,
  seed = 42,
  iter = 2000,
  file = paste0(fits_path, "rotation_magnitude_tracking_1_random_effects_score_det.rds"),
  backend = "cmdstanr",
  threads = threading(100),
  save_pars = save_pars(all = TRUE)
)

m.RotationMagnitude.tracking.1.re.score.soc_pos.fit <- brm(
  formula = m.RotationMagnitude.tracking.1.re.score.soc_pos.formula,
  data = m.RotationMagnitude.tracking.1.re.data %>% filter(SignalingType != "A"),
  prior = m.RotationMagnitude.tracking.1.re.score.priors,
  chains = 4,
  cores = 4,
  seed = 42,
  iter = 2000,
  file = paste0(fits_path, "rotation_magnitude_tracking_1_random_effects_score_soc_pos.rds"),
  backend = "cmdstanr",
  threads = threading(100),
  save_pars = save_pars(all = TRUE)
)

m.RotationMagnitude.tracking.1.re.score.soc_pos_qual.fit <- brm(
  formula = m.RotationMagnitude.tracking.1.re.score.soc_pos_qual.formula,
  data = m.RotationMagnitude.tracking.1.re.data %>% filter(SignalingType != "A"),
  prior = m.RotationMagnitude.tracking.1.re.score.priors,
  chains = 4,
  cores = 4,
  seed = 42,
  iter = 2000,
  file = paste0(fits_path, "rotation_magnitude_tracking_1_random_effects_score_soc_pos_qual.rds"),
  backend = "cmdstanr",
  threads = threading(100),
  save_pars = save_pars(all = TRUE)
)

m.RotationMagnitude.tracking.1.re.score.soc_mov.fit <- brm(
  formula = m.RotationMagnitude.tracking.1.re.score.soc_mov.formula,
  data = m.RotationMagnitude.tracking.1.re.data %>% filter(SignalingType != "A"),
  prior = m.RotationMagnitude.tracking.1.re.score.priors,
  chains = 4,
  cores = 4,
  seed = 42,
  iter = 2000,
  file = paste0(fits_path, "rotation_magnitude_tracking_1_random_effects_score_soc_mov.rds"),
  backend = "cmdstanr",
  threads = threading(100),
  save_pars = save_pars(all = TRUE)
)


m.RotationMagnitude.tracking.1.re.score.soc_mov_qual.fit <- brm(
  formula = m.RotationMagnitude.tracking.1.re.score.soc_mov_qual.formula,
  data = m.RotationMagnitude.tracking.1.re.data %>% filter(SignalingType != "A"),
  prior = m.RotationMagnitude.tracking.1.re.score.priors,
  chains = 4,
  cores = 4,
  seed = 42,
  iter = 2000,
  file = paste0(fits_path, "rotation_magnitude_tracking_1_random_effects_score_soc_mov_qual.rds"),
  backend = "cmdstanr",
  threads = threading(100),
  save_pars = save_pars(all = TRUE)
)
m.RotationMagnitude.tracking.1.re.score.tidy_draws <- bind_rows(
  m.RotationMagnitude.tracking.1.re.score.det.fit %>%
    tidy_draws() %>%
    gather_variables() %>%
    filter(grepl("SignalingType", .variable) | grepl("ResourceSpeed", .variable) | grepl("b_Intercept", .variable)),
  m.RotationMagnitude.tracking.1.re.score.soc_pos.fit %>%
    tidy_draws() %>%
    gather_variables() %>%
    filter(grepl("SignalingType", .variable) | grepl("ResourceSpeed", .variable) | grepl("b_Intercept", .variable)),
  m.RotationMagnitude.tracking.1.re.score.soc_pos_qual.fit %>%
    tidy_draws() %>%
    gather_variables() %>%
    filter(grepl("SignalingType", .variable) | grepl("ResourceSpeed", .variable) | grepl("b_Intercept", .variable)),
  m.RotationMagnitude.tracking.1.re.score.soc_mov.fit %>%
    tidy_draws() %>%
    gather_variables() %>%
    filter(grepl("SignalingType", .variable) | grepl("ResourceSpeed", .variable) | grepl("b_Intercept", .variable)),
  m.RotationMagnitude.tracking.1.re.score.soc_mov_qual.fit %>%
    tidy_draws() %>%
    gather_variables() %>%
    filter(grepl("SignalingType", .variable) | grepl("ResourceSpeed", .variable) | grepl("b_Intercept", .variable))
)
m.RotationMagnitude.tracking.1.re.score.tidy_draws2 <- m.RotationMagnitude.tracking.1.re.score.tidy_draws %>%
  filter(str_detect(.variable, "SignalingType") & str_detect(.variable, "ResourceSpeed")) %>%
  mutate(signaling = factor(case_when(
    str_detect(.variable, "SignalingTypeNP") ~ "NP",
    str_detect(.variable, "SignalingTypeVP") ~ "VP",
    str_detect(.variable, "SignalingTypeFP") ~ "FP",
    str_detect(.variable, "SignalingTypeA") ~ "A",
  ), levels = c("A", "NP", "VP", "FP"))) %>%
  mutate(resource = factor(case_when(
    str_detect(.variable, "ResourceSpeedfast") ~ "fast",
    str_detect(.variable, "ResourceSpeedslow") ~ "slow",
  ), levels = c("fast", "slow"))) %>%
  mutate(weight = factor(case_when(
    str_detect(.variable, ":Detector_r_eff") ~ "Detector Sensitivity",
    str_detect(.variable, ":SocInfoQualityPos_r_eff") ~ "Position x Quality",
    str_detect(.variable, ":SocInfoQualityMov_r_eff") ~ "Movement Direction x Quality",
    str_detect(.variable, ":SocInfoPos_r_eff") ~ "Position of others",
    str_detect(.variable, ":SocInfoMov_r_eff") ~ "Movement direction of others",
    .default = "NONONONO"
  ), levels = c(
    "Intercept Rot Mag",
    "Detector Sensitivity",
    "Distance to Resource Center",
    "Position of others",
    "Position x Quality",
    "Movement direction of others",
    "Movement Direction x Quality",
    "NONONONO"
  ))) %>%
  filter(weight != "NONONONO", !((signaling == "A") & !(weight %in% c("Detector Sensitivity", "Intercept Rot Mag"))))

head(m.RotationMagnitude.tracking.1.re.score.tidy_draws2, 50)
rotation_magnitude_tracking_random_effects_score_fig <- m.RotationMagnitude.tracking.1.re.score.tidy_draws2 %>%
  filter(!is.na(resource), !is.na(weight)) %>%
  mutate(weight = factor(weight, levels = c(
    "Detector Sensitivity",
    "Position of others",
    "Position x Quality",
    "Movement direction of others",
    "Movement Direction x Quality"
  ))) %>%
  ggplot(aes(y = weight, x = .value, color = signaling, fill = signaling)) +
  stat_pointinterval(alpha = 0.5, .width = c(.90), point_interval = "mean_hdi", position = "dodge") +
  geom_vline(xintercept = 0, linetype = "dashed") +
  scale_color_manual(
    breaks = c("A", "NP", "VP", "FP"),
    aesthetics = c("colour", "fill"),
    values = c("#000000", "#DF536B", "#61D04F", "#2297E6"),
    guide = guide_legend(title = "Payoff Condition"),
  ) +
  # Add horizontal lines at each weight level
  geom_hline(aes(yintercept = as.numeric(weight) + 0.5), color = "grey80", linetype = "solid") +
  scale_y_discrete(limits = rev) +
  facet_grid(cols = vars(resource)) +
  theme_clean() +
  panel_border() +
  theme(
    panel.grid.major = element_blank(), # Remove major grid lines
    panel.grid.minor = element_blank(), # Remove minor grid lines
    legend.position = "bottom"
  ) +
  labs(x = "Posterior parameter estimate", y = "")


rotation_magnitude_tracking_random_effects_score_fig

Random Effects Correlations

mcmc_areas(
  m.RotationMagnitude.tracking.1.df_fit %>% dplyr::select(
    starts_with("cor_"),
    -contains("withSocInfo0"),
  ) %>%
    rename(
      `cor(Intercept, Detector)` = `cor_Participant__Intercept__Detector`,
      `cor(Intercept, Position)` = `cor_Participant__Intercept__withSocInfo1:SocPosInFOV`,
      `cor(Intercept, Movement)` = `cor_Participant__Intercept__withSocInfo1:SocMovDir`,
      `cor(Intercept, Position x Quality)` = `cor_Participant__Intercept__withSocInfo1:SocPosInFOV:SocQual`,
      `cor(Intercept, Movement x Quality)` = `cor_Participant__Intercept__withSocInfo1:SocMovDir:SocQual`,
      `cor(Detector, Position)` = `cor_Participant__Detector__withSocInfo1:SocPosInFOV`,
      `cor(Detector, Movement)` = `cor_Participant__Detector__withSocInfo1:SocMovDir`,
      `cor(Detector, Position x Quality)` = `cor_Participant__Detector__withSocInfo1:SocPosInFOV:SocQual`,
      `cor(Detector, Movement x Quality)` = `cor_Participant__Detector__withSocInfo1:SocMovDir:SocQual`,
      `cor(Position, Movement)` = `cor_Participant__withSocInfo1:SocPosInFOV__withSocInfo1:SocMovDir`,
      `cor(Position, Position x Quality)` = `cor_Participant__withSocInfo1:SocPosInFOV__withSocInfo1:SocPosInFOV:SocQual`,
      `cor(Position, Movement x Quality)` = `cor_Participant__withSocInfo1:SocPosInFOV__withSocInfo1:SocMovDir:SocQual`,
      `cor(Movement, Position x Quality)` = `cor_Participant__withSocInfo1:SocMovDir__withSocInfo1:SocPosInFOV:SocQual`,
      `cor(Movement, Movement x Quality)` = `cor_Participant__withSocInfo1:SocMovDir__withSocInfo1:SocMovDir:SocQual`,
      `cor(Position x Quality, Movement x Quality)` = `cor_Participant__withSocInfo1:SocPosInFOV:SocQual__withSocInfo1:SocMovDir:SocQual`
    ) %>%
    dplyr::select( # Ensure the order is correct
      `cor(Intercept, Detector)`,
      `cor(Intercept, Position)`,
      `cor(Intercept, Movement)`,
      `cor(Intercept, Position x Quality)`,
      `cor(Intercept, Movement x Quality)`,
      `cor(Detector, Position)`,
      `cor(Detector, Movement)`,
      `cor(Detector, Position x Quality)`,
      `cor(Detector, Movement x Quality)`,
      `cor(Position, Movement)`,
      `cor(Position, Position x Quality)`,
      `cor(Position, Movement x Quality)`,
      `cor(Movement, Position x Quality)`,
      `cor(Movement, Movement x Quality)`,
      `cor(Position x Quality, Movement x Quality)`
    ),
  prob = 0.95, # 95% intervals
  prob_outer = 0.99, # 99%
  point_est = "mean"
) + ggplot2::labs(
  title = "Posterior parameter distributions",
  subtitle = "with medians and 95% intervals"
)

Random Effects Visualization

# 1. Extract raw random effects for social features
m.RotationMagnitude.tracking.1.r_effs_long <- m.RotationMagnitude.tracking.1.fit %>%
  spread_draws(r_Participant[Participant, term]) %>%
  # Filter for social features requested by the user
  filter(term %in% c(
    "Detector",
    "withSocInfo1:SocPosInFOV",
    "withSocInfo1:SocMovDir",
    "withSocInfo1:SocPosInFOV:SocQual",
    "withSocInfo1:SocMovDir:SocQual"
  )) %>%
  # Map to human-readable names
  mutate(term_label = case_when(
    term == "Detector" ~ "Detector",
    term == "withSocInfo1:SocPosInFOV" ~ "Position",
    term == "withSocInfo1:SocMovDir" ~ "Movement",
    term == "withSocInfo1:SocPosInFOV:SocQual" ~ "Position x Quality",
    term == "withSocInfo1:SocMovDir:SocQual" ~ "Movement x Quality"
  )) %>%
  mutate(term_label = factor(term_label, levels = c(
    "Detector", "Position", "Movement",
    "Position x Quality", "Movement x Quality"
  )))

# 2. Summarize draws and merge with condition metadata & tracking efficiency (PCR)
m.RotationMagnitude.tracking.1.r_effs_data_plot <- m.RotationMagnitude.tracking.1.r_effs_long %>%
  group_by(Participant, term_label) %>%
  summarise(
    mean_val = mean(r_Participant),
    lower = quantile(r_Participant, 0.05),
    upper = quantile(r_Participant, 0.95),
    .groups = "drop"
  ) %>%
  left_join(subj_data %>% select(Participant, SignalingType, ResourceSpeed, PCR), by = "Participant") %>%
  # Coloring logic: black if interval does not overlap with 0, gray otherwise
  mutate(hpdi_overlaps_0 = factor(ifelse(lower > 0 | upper < 0, "Yes", "No"),
    levels = c("No", "Yes")
  ))

# 3. Sort participants by tracking efficiency (PCR) within each condition
m.RotationMagnitude.tracking.1.r_effs_order <- m.RotationMagnitude.tracking.1.r_effs_data_plot %>%
  filter(term_label == "Detector") %>%
  arrange(SignalingType, ResourceSpeed, PCR) %>%
  mutate(sort_rank = row_number()) %>%
  select(Participant, sort_rank)

m.RotationMagnitude.tracking.1.r_effs_data_plot <- m.RotationMagnitude.tracking.1.r_effs_data_plot %>%
  left_join(m.RotationMagnitude.tracking.1.r_effs_order, by = "Participant") %>%
  mutate(Participant = reorder(Participant, sort_rank))
# 4. Generate the grouped Caterpillar plot
m.RotationMagnitude.tracking.1.social_strategy_caterpillar <- m.RotationMagnitude.tracking.1.r_effs_data_plot %>%
  filter(SignalingType != "A") %>% 
  ggplot(aes(y = Participant, x = mean_val, color = hpdi_overlaps_0)) +  # PCR
  geom_pointinterval(aes(xmin = lower, xmax = upper), size = 0.01, fatten_point = 1.5) +
  geom_vline(xintercept = 0, linetype = "dashed", color = "red", alpha = 0.5) +
  # Grouping by Signaling and Speed; space="free_y" ensures unique rows per facet
  facet_grid(SignalingType + ResourceSpeed ~ term_label, scales = "free_y", space = "free_y") +
  scale_color_manual(
    values = c("No" = "gray75", "Yes" = "black"),
    guide = guide_legend(title = "90% HPDI overlaps with 0")
  ) +
  theme_clean() +
  panel_border() +
  theme(
    panel.grid.major = element_blank(),
    panel.grid.minor = element_blank(),
    axis.text.y = element_blank(),
    axis.ticks.y = element_blank(),
    legend.position = "bottom"
  ) +
  labs(
    x = "Raw Random Effect Estimate (Participant-level Offset)",
    y = "Participant (sorted by Tracking Efficiency, high=top)"
  )

m.RotationMagnitude.tracking.1.social_strategy_caterpillar

Model 2: Temporal Dynamics

m.RotationMagnitude.tracking.temporal.data <- m.RotationMagnitude.tracking.data %>%
  mutate(Epoch = factor(ifelse(Time <= 440, "First Half", "Second Half"), levels = c("First Half", "Second Half")))
m.RotationMagnitude.tracking.temporal.formula <- brmsformula(
  RotationAbs | trunc(ub = 1.02) ~ SignalingType * ResourceSpeed * Epoch +
    SignalingType:ResourceSpeed:Detector +
    SignalingType:ResourceSpeed:DistFromRes +
    SignalingType:ResourceSpeed:withSocInfo:SocPosInFOV +
    SignalingType:ResourceSpeed:withSocInfo:SocMovDir +
    SignalingType:ResourceSpeed:withSocInfo:SocQual:SocPosInFOV +
    SignalingType:ResourceSpeed:withSocInfo:SocQual:SocMovDir +
    SignalingType:ResourceSpeed:Epoch:Detector +
    SignalingType:ResourceSpeed:Epoch:DistFromRes +
    SignalingType:ResourceSpeed:Epoch:withSocInfo:SocPosInFOV +
    SignalingType:ResourceSpeed:Epoch:withSocInfo:SocMovDir +
    SignalingType:ResourceSpeed:Epoch:withSocInfo:SocQual:SocPosInFOV +
    SignalingType:ResourceSpeed:Epoch:withSocInfo:SocQual:SocMovDir +
    (1 + Detector + withSocInfo:SocPosInFOV + withSocInfo:SocMovDir + withSocInfo:SocQual:SocPosInFOV + withSocInfo:SocQual:SocMovDir | Participant),
  family = exponential()
)

m.RotationMagnitude.tracking.temporal.formula_comparison <- brmsformula(
  RotationAbs | trunc(ub = 1.02) ~ SignalingType * ResourceSpeed * Epoch +
    SignalingType:ResourceSpeed:Detector +
    SignalingType:ResourceSpeed:DistFromRes +
    SignalingType:ResourceSpeed:withSocInfo:SocPosInFOV +
    SignalingType:ResourceSpeed:withSocInfo:SocMovDir +
    SignalingType:ResourceSpeed:withSocInfo:SocQual:SocPosInFOV +
    SignalingType:ResourceSpeed:withSocInfo:SocQual:SocMovDir +
    SignalingType:ResourceSpeed:Epoch:Detector +
    SignalingType:ResourceSpeed:Epoch:DistFromRes +
    SignalingType:ResourceSpeed:Epoch:withSocInfo:SocPosInFOV +
    SignalingType:ResourceSpeed:Epoch:withSocInfo:SocMovDir +
    SignalingType:ResourceSpeed:Epoch:withSocInfo:SocQual:SocPosInFOV +
    SignalingType:ResourceSpeed:Epoch:withSocInfo:SocQual:SocMovDir,
  family = exponential()
)
m.RotationMagnitude.tracking.temporal.priors <-
  prior(normal(0, 1), class = "Intercept") +
  prior(normal(0, 0.1), class = "sd") +
  prior(normal(0, 0.5), class = b) +

  prior(constant(0), class = "sd", coef = "withSocInfo0:SocMovDir", group = "Participant") +
  prior(constant(0), class = "sd", coef = "withSocInfo0:SocPosInFOV", group = "Participant") +
  prior(constant(0), class = "sd", coef = "withSocInfo0:SocMovDir:SocQual", group = "Participant") +
  prior(constant(0), class = "sd", coef = "withSocInfo0:SocPosInFOV:SocQual", group = "Participant") +

  # base no soc info priors
  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedfast:withSocInfo0:SocMovDir") +
  prior(constant(0), class = b, coef = "SignalingTypeNP:ResourceSpeedfast:withSocInfo0:SocMovDir") +
  prior(constant(0), class = b, coef = "SignalingTypeVP:ResourceSpeedfast:withSocInfo0:SocMovDir") +
  prior(constant(0), class = b, coef = "SignalingTypeFP:ResourceSpeedfast:withSocInfo0:SocMovDir") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedslow:withSocInfo0:SocMovDir") +
  prior(constant(0), class = b, coef = "SignalingTypeNP:ResourceSpeedslow:withSocInfo0:SocMovDir") +
  prior(constant(0), class = b, coef = "SignalingTypeVP:ResourceSpeedslow:withSocInfo0:SocMovDir") +
  prior(constant(0), class = b, coef = "SignalingTypeFP:ResourceSpeedslow:withSocInfo0:SocMovDir") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedfast:withSocInfo0:SocPosInFOV") +
  prior(constant(0), class = b, coef = "SignalingTypeNP:ResourceSpeedfast:withSocInfo0:SocPosInFOV") +
  prior(constant(0), class = b, coef = "SignalingTypeVP:ResourceSpeedfast:withSocInfo0:SocPosInFOV") +
  prior(constant(0), class = b, coef = "SignalingTypeFP:ResourceSpeedfast:withSocInfo0:SocPosInFOV") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedslow:withSocInfo0:SocPosInFOV") +
  prior(constant(0), class = b, coef = "SignalingTypeNP:ResourceSpeedslow:withSocInfo0:SocPosInFOV") +
  prior(constant(0), class = b, coef = "SignalingTypeVP:ResourceSpeedslow:withSocInfo0:SocPosInFOV") +
  prior(constant(0), class = b, coef = "SignalingTypeFP:ResourceSpeedslow:withSocInfo0:SocPosInFOV") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedfast:withSocInfo0:SocMovDir:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeNP:ResourceSpeedfast:withSocInfo0:SocMovDir:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeVP:ResourceSpeedfast:withSocInfo0:SocMovDir:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeFP:ResourceSpeedfast:withSocInfo0:SocMovDir:SocQual") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedslow:withSocInfo0:SocMovDir:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeNP:ResourceSpeedslow:withSocInfo0:SocMovDir:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeVP:ResourceSpeedslow:withSocInfo0:SocMovDir:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeFP:ResourceSpeedslow:withSocInfo0:SocMovDir:SocQual") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedfast:withSocInfo0:SocPosInFOV:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeNP:ResourceSpeedfast:withSocInfo0:SocPosInFOV:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeVP:ResourceSpeedfast:withSocInfo0:SocPosInFOV:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeFP:ResourceSpeedfast:withSocInfo0:SocPosInFOV:SocQual") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedslow:withSocInfo0:SocPosInFOV:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeNP:ResourceSpeedslow:withSocInfo0:SocPosInFOV:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeVP:ResourceSpeedslow:withSocInfo0:SocPosInFOV:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeFP:ResourceSpeedslow:withSocInfo0:SocPosInFOV:SocQual") +

  # epoch no soc info priors
  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocMovDir") +
  prior(constant(0), class = b, coef = "SignalingTypeNP:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocMovDir") +
  prior(constant(0), class = b, coef = "SignalingTypeVP:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocMovDir") +
  prior(constant(0), class = b, coef = "SignalingTypeFP:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocMovDir") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocMovDir") +
  prior(constant(0), class = b, coef = "SignalingTypeNP:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocMovDir") +
  prior(constant(0), class = b, coef = "SignalingTypeVP:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocMovDir") +
  prior(constant(0), class = b, coef = "SignalingTypeFP:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocMovDir") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocPosInFOV") +
  prior(constant(0), class = b, coef = "SignalingTypeNP:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocPosInFOV") +
  prior(constant(0), class = b, coef = "SignalingTypeVP:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocPosInFOV") +
  prior(constant(0), class = b, coef = "SignalingTypeFP:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocPosInFOV") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocPosInFOV") +
  prior(constant(0), class = b, coef = "SignalingTypeNP:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocPosInFOV") +
  prior(constant(0), class = b, coef = "SignalingTypeVP:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocPosInFOV") +
  prior(constant(0), class = b, coef = "SignalingTypeFP:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocPosInFOV") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocMovDir:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeNP:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocMovDir:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeVP:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocMovDir:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeFP:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocMovDir:SocQual") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocMovDir:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeNP:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocMovDir:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeVP:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocMovDir:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeFP:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocMovDir:SocQual") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocPosInFOV:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeNP:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocPosInFOV:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeVP:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocPosInFOV:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeFP:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocPosInFOV:SocQual") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocPosInFOV:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeNP:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocPosInFOV:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeVP:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocPosInFOV:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeFP:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocPosInFOV:SocQual") +

  # base A priors
  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocPosInFOV:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedfast:withSocInfo1:SocPosInFOV:SocQual") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocMovDir:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedfast:withSocInfo1:SocMovDir:SocQual") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedfast:withSocInfo1:SocPosInFOV") +
  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocPosInFOV") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedfast:withSocInfo1:SocMovDir") +
  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocMovDir") +

  # epoch A priors
  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedslow:EpochSecondHalf:withSocInfo1:SocPosInFOV:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocPosInFOV:SocQual") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedslow:EpochSecondHalf:withSocInfo1:SocMovDir:SocQual") +
  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocMovDir:SocQual") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocPosInFOV") +
  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedslow:EpochSecondHalf:withSocInfo1:SocPosInFOV") +

  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocMovDir") +
  prior(constant(0), class = b, coef = "SignalingTypeA:ResourceSpeedslow:EpochSecondHalf:withSocInfo1:SocMovDir")
m.RotationMagnitude.tracking.temporal.fit <- brm(
  formula = m.RotationMagnitude.tracking.temporal.formula,
  data = m.RotationMagnitude.tracking.temporal.data,
  prior = m.RotationMagnitude.tracking.temporal.priors,
  chains = 4,
  cores = 4,
  seed = 4242,
  warmup = 1000,
  iter = 2000,
  file = paste0(fits_path, "rotation_magnitude_tracking_temporal.rds"),
  backend = "cmdstanr",
  threads = threading(100),
  save_pars = save_pars(all = FALSE)
)
summary(m.RotationMagnitude.tracking.temporal.fit, ask = F)
##  Family: exponential 
##   Links: mu = log 
## Formula: RotationAbs | trunc(ub = 1.02) ~ SignalingType * ResourceSpeed * Epoch + SignalingType:ResourceSpeed:Detector + SignalingType:ResourceSpeed:DistFromRes + SignalingType:ResourceSpeed:withSocInfo:SocPosInFOV + SignalingType:ResourceSpeed:withSocInfo:SocMovDir + SignalingType:ResourceSpeed:withSocInfo:SocQual:SocPosInFOV + SignalingType:ResourceSpeed:withSocInfo:SocQual:SocMovDir + SignalingType:ResourceSpeed:Epoch:Detector + SignalingType:ResourceSpeed:Epoch:DistFromRes + SignalingType:ResourceSpeed:Epoch:withSocInfo:SocPosInFOV + SignalingType:ResourceSpeed:Epoch:withSocInfo:SocMovDir + SignalingType:ResourceSpeed:Epoch:withSocInfo:SocQual:SocPosInFOV + SignalingType:ResourceSpeed:Epoch:withSocInfo:SocQual:SocMovDir + (1 + Detector + withSocInfo:SocPosInFOV + withSocInfo:SocMovDir + withSocInfo:SocQual:SocPosInFOV + withSocInfo:SocQual:SocMovDir | Participant) 
##    Data: m.RotationMagnitude.tracking.temporal.data (Number of observations: 276674) 
##   Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
##          total post-warmup draws = 4000
## 
## Multilevel Hyperparameters:
## ~Participant (Number of levels: 621) 
##                                                                        Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sd(Intercept)                                                              0.59      0.02     0.56     0.63 1.01      330      736
## sd(Detector)                                                               0.46      0.01     0.43     0.49 1.00      739     1272
## sd(withSocInfo0:SocPosInFOV)                                               0.00      0.00     0.00     0.00   NA       NA       NA
## sd(withSocInfo1:SocPosInFOV)                                               0.26      0.01     0.24     0.29 1.00     1457     2247
## sd(withSocInfo0:SocMovDir)                                                 0.00      0.00     0.00     0.00   NA       NA       NA
## sd(withSocInfo1:SocMovDir)                                                 0.23      0.01     0.21     0.25 1.00     2042     3214
## sd(withSocInfo0:SocPosInFOV:SocQual)                                       0.00      0.00     0.00     0.00   NA       NA       NA
## sd(withSocInfo1:SocPosInFOV:SocQual)                                       0.25      0.01     0.22     0.28 1.00     1926     2471
## sd(withSocInfo0:SocMovDir:SocQual)                                         0.00      0.00     0.00     0.00   NA       NA       NA
## sd(withSocInfo1:SocMovDir:SocQual)                                         0.24      0.01     0.22     0.27 1.00     2006     2697
## cor(Intercept,Detector)                                                    0.44      0.03     0.37     0.50 1.01      572     1044
## cor(Intercept,withSocInfo0:SocPosInFOV)                                   -0.00      0.29    -0.57     0.56 1.00     6915     3139
## cor(Detector,withSocInfo0:SocPosInFOV)                                     0.00      0.30    -0.59     0.57 1.00     8156     2880
## cor(Intercept,withSocInfo1:SocPosInFOV)                                    0.08      0.05    -0.02     0.19 1.00     1724     2616
## cor(Detector,withSocInfo1:SocPosInFOV)                                    -0.43      0.05    -0.53    -0.32 1.00     1472     2357
## cor(withSocInfo0:SocPosInFOV,withSocInfo1:SocPosInFOV)                     0.03      0.30    -0.59     0.56 1.10       30       34
## cor(Intercept,withSocInfo0:SocMovDir)                                      0.01      0.30    -0.57     0.59 1.00     8511     3138
## cor(Detector,withSocInfo0:SocMovDir)                                      -0.00      0.30    -0.58     0.58 1.00     7949     2670
## cor(withSocInfo0:SocPosInFOV,withSocInfo0:SocMovDir)                       0.00      0.30    -0.57     0.58 1.00     4958     3140
## cor(withSocInfo1:SocPosInFOV,withSocInfo0:SocMovDir)                      -0.00      0.30    -0.57     0.57 1.00     7404     2557
## cor(Intercept,withSocInfo1:SocMovDir)                                      0.53      0.05     0.43     0.61 1.00     1989     2792
## cor(Detector,withSocInfo1:SocMovDir)                                       0.10      0.06    -0.01     0.21 1.00     1675     2654
## cor(withSocInfo0:SocPosInFOV,withSocInfo1:SocMovDir)                      -0.01      0.30    -0.58     0.57 1.09       33      158
## cor(withSocInfo1:SocPosInFOV,withSocInfo1:SocMovDir)                       0.12      0.07    -0.01     0.25 1.00     1522     2499
## cor(withSocInfo0:SocMovDir,withSocInfo1:SocMovDir)                         0.04      0.29    -0.54     0.59 1.02      101      222
## cor(Intercept,withSocInfo0:SocPosInFOV:SocQual)                           -0.00      0.30    -0.58     0.57 1.00     8481     2691
## cor(Detector,withSocInfo0:SocPosInFOV:SocQual)                             0.00      0.30    -0.57     0.57 1.00     7956     3357
## cor(withSocInfo0:SocPosInFOV,withSocInfo0:SocPosInFOV:SocQual)            -0.00      0.30    -0.59     0.58 1.00     4684     3048
## cor(withSocInfo1:SocPosInFOV,withSocInfo0:SocPosInFOV:SocQual)            -0.00      0.31    -0.59     0.60 1.00     7587     2763
## cor(withSocInfo0:SocMovDir,withSocInfo0:SocPosInFOV:SocQual)               0.00      0.30    -0.58     0.58 1.00     3203     2922
## cor(withSocInfo1:SocMovDir,withSocInfo0:SocPosInFOV:SocQual)              -0.00      0.31    -0.59     0.58 1.00     7517     2944
## cor(Intercept,withSocInfo1:SocPosInFOV:SocQual)                            0.22      0.06     0.10     0.33 1.00     2592     3040
## cor(Detector,withSocInfo1:SocPosInFOV:SocQual)                             0.03      0.07    -0.11     0.16 1.00     2331     2757
## cor(withSocInfo0:SocPosInFOV,withSocInfo1:SocPosInFOV:SocQual)             0.02      0.26    -0.48     0.50 1.07       44      232
## cor(withSocInfo1:SocPosInFOV,withSocInfo1:SocPosInFOV:SocQual)            -0.07      0.07    -0.21     0.08 1.00     1863     3066
## cor(withSocInfo0:SocMovDir,withSocInfo1:SocPosInFOV:SocQual)              -0.03      0.29    -0.60     0.53 1.10       32      200
## cor(withSocInfo1:SocMovDir,withSocInfo1:SocPosInFOV:SocQual)               0.10      0.07    -0.05     0.24 1.00     1835     2862
## cor(withSocInfo0:SocPosInFOV:SocQual,withSocInfo1:SocPosInFOV:SocQual)    -0.04      0.30    -0.59     0.53 1.06       49      126
## cor(Intercept,withSocInfo0:SocMovDir:SocQual)                             -0.00      0.30    -0.56     0.56 1.00     8312     3108
## cor(Detector,withSocInfo0:SocMovDir:SocQual)                              -0.00      0.30    -0.57     0.57 1.00     8762     3217
## cor(withSocInfo0:SocPosInFOV,withSocInfo0:SocMovDir:SocQual)               0.00      0.30    -0.57     0.57 1.00     4840     2786
## cor(withSocInfo1:SocPosInFOV,withSocInfo0:SocMovDir:SocQual)              -0.00      0.30    -0.58     0.57 1.00     6791     3363
## cor(withSocInfo0:SocMovDir,withSocInfo0:SocMovDir:SocQual)                 0.01      0.30    -0.56     0.58 1.00     3106     3028
## cor(withSocInfo1:SocMovDir,withSocInfo0:SocMovDir:SocQual)                -0.01      0.30    -0.58     0.55 1.00     7781     2743
## cor(withSocInfo0:SocPosInFOV:SocQual,withSocInfo0:SocMovDir:SocQual)       0.00      0.30    -0.58     0.57 1.00     2555     2890
## cor(withSocInfo1:SocPosInFOV:SocQual,withSocInfo0:SocMovDir:SocQual)       0.00      0.31    -0.58     0.58 1.00     5720     3314
## cor(Intercept,withSocInfo1:SocMovDir:SocQual)                              0.49      0.05     0.39     0.58 1.00     2174     2821
## cor(Detector,withSocInfo1:SocMovDir:SocQual)                               0.15      0.06     0.03     0.27 1.00     2011     2643
## cor(withSocInfo0:SocPosInFOV,withSocInfo1:SocMovDir:SocQual)               0.03      0.29    -0.54     0.58 1.05       64      230
## cor(withSocInfo1:SocPosInFOV,withSocInfo1:SocMovDir:SocQual)               0.11      0.07    -0.04     0.25 1.00     2443     3068
## cor(withSocInfo0:SocMovDir,withSocInfo1:SocMovDir:SocQual)                -0.01      0.29    -0.58     0.54 1.04       82      308
## cor(withSocInfo1:SocMovDir,withSocInfo1:SocMovDir:SocQual)                 0.10      0.07    -0.04     0.23 1.00     1787     2622
## cor(withSocInfo0:SocPosInFOV:SocQual,withSocInfo1:SocMovDir:SocQual)      -0.02      0.30    -0.58     0.56 1.02      101      318
## cor(withSocInfo1:SocPosInFOV:SocQual,withSocInfo1:SocMovDir:SocQual)       0.05      0.08    -0.10     0.21 1.00     1897     2995
## cor(withSocInfo0:SocMovDir:SocQual,withSocInfo1:SocMovDir:SocQual)        -0.06      0.30    -0.61     0.51 1.03      158      591
## 
## Regression Coefficients:
##                                                                                    Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## Intercept                                                                             -1.63      0.07    -1.76    -1.50 1.03      224      339
## SignalingTypeNP                                                                        0.14      0.10    -0.06     0.34 1.03      244      437
## SignalingTypeVP                                                                       -0.17      0.10    -0.36     0.01 1.03      219      535
## SignalingTypeFP                                                                        0.35      0.10     0.15     0.55 1.01      182      232
## ResourceSpeedslow                                                                      0.05      0.10    -0.13     0.24 1.08       50      402
## EpochSecondHalf                                                                       -0.11      0.02    -0.15    -0.07 1.01     1158     1768
## SignalingTypeNP:ResourceSpeedslow                                                     -0.03      0.14    -0.30     0.25 1.04      140      344
## SignalingTypeVP:ResourceSpeedslow                                                      0.47      0.13     0.21     0.71 1.03      131      367
## SignalingTypeFP:ResourceSpeedslow                                                      0.20      0.14    -0.07     0.48 1.08       70      284
## SignalingTypeNP:EpochSecondHalf                                                        0.01      0.04    -0.07     0.08 1.01     1472     2458
## SignalingTypeVP:EpochSecondHalf                                                        0.05      0.03    -0.02     0.11 1.00     1448     2063
## SignalingTypeFP:EpochSecondHalf                                                        0.13      0.03     0.07     0.20 1.01     1446     2469
## ResourceSpeedslow:EpochSecondHalf                                                      0.16      0.03     0.11     0.22 1.00     1147     2022
## SignalingTypeNP:ResourceSpeedslow:EpochSecondHalf                                     -0.02      0.04    -0.11     0.07 1.00     1386     2533
## SignalingTypeVP:ResourceSpeedslow:EpochSecondHalf                                     -0.05      0.04    -0.13     0.03 1.00     1348     1808
## SignalingTypeFP:ResourceSpeedslow:EpochSecondHalf                                     -0.15      0.04    -0.23    -0.07 1.01     1330     2393
## SignalingTypeA:ResourceSpeedfast:Detector                                              1.56      0.06     1.43     1.67 1.02      523      854
## SignalingTypeNP:ResourceSpeedfast:Detector                                             1.31      0.07     1.18     1.43 1.01      617     1397
## SignalingTypeVP:ResourceSpeedfast:Detector                                             1.06      0.05     0.96     1.17 1.01      475     1054
## SignalingTypeFP:ResourceSpeedfast:Detector                                             1.06      0.06     0.94     1.18 1.01      290      850
## SignalingTypeA:ResourceSpeedslow:Detector                                              1.90      0.06     1.77     2.01 1.02      350      686
## SignalingTypeNP:ResourceSpeedslow:Detector                                             1.55      0.06     1.43     1.66 1.01      249      376
## SignalingTypeVP:ResourceSpeedslow:Detector                                             1.36      0.05     1.26     1.47 1.04      140      459
## SignalingTypeFP:ResourceSpeedslow:Detector                                             1.27      0.05     1.17     1.37 1.02      246      637
## SignalingTypeA:ResourceSpeedfast:DistFromRes                                           0.24      0.03     0.18     0.30 1.00     3584     3420
## SignalingTypeNP:ResourceSpeedfast:DistFromRes                                          0.56      0.04     0.49     0.64 1.00     3508     3069
## SignalingTypeVP:ResourceSpeedfast:DistFromRes                                          0.67      0.03     0.61     0.72 1.00     3285     3329
## SignalingTypeFP:ResourceSpeedfast:DistFromRes                                          0.44      0.03     0.39     0.50 1.00     3815     3088
## SignalingTypeA:ResourceSpeedslow:DistFromRes                                           0.33      0.02     0.28     0.38 1.00     3124     2572
## SignalingTypeNP:ResourceSpeedslow:DistFromRes                                          0.60      0.02     0.56     0.64 1.00     3847     2945
## SignalingTypeVP:ResourceSpeedslow:DistFromRes                                          0.41      0.02     0.37     0.45 1.00     3705     3161
## SignalingTypeFP:ResourceSpeedslow:DistFromRes                                          0.60      0.02     0.55     0.64 1.00     3509     3065
## SignalingTypeA:ResourceSpeedfast:withSocInfo0:SocPosInFOV                              0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedfast:withSocInfo0:SocPosInFOV                             0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeVP:ResourceSpeedfast:withSocInfo0:SocPosInFOV                             0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeFP:ResourceSpeedfast:withSocInfo0:SocPosInFOV                             0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeA:ResourceSpeedslow:withSocInfo0:SocPosInFOV                              0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedslow:withSocInfo0:SocPosInFOV                             0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeVP:ResourceSpeedslow:withSocInfo0:SocPosInFOV                             0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeFP:ResourceSpeedslow:withSocInfo0:SocPosInFOV                             0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeA:ResourceSpeedfast:withSocInfo1:SocPosInFOV                              0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedfast:withSocInfo1:SocPosInFOV                             0.16      0.07     0.03     0.29 1.00     2061     2876
## SignalingTypeVP:ResourceSpeedfast:withSocInfo1:SocPosInFOV                             0.23      0.05     0.14     0.32 1.00     1638     2401
## SignalingTypeFP:ResourceSpeedfast:withSocInfo1:SocPosInFOV                             0.34      0.04     0.25     0.42 1.00     1165     2514
## SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocPosInFOV                              0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedslow:withSocInfo1:SocPosInFOV                             0.20      0.04     0.14     0.27 1.00      801     1920
## SignalingTypeVP:ResourceSpeedslow:withSocInfo1:SocPosInFOV                             0.18      0.04     0.11     0.25 1.00      959     1821
## SignalingTypeFP:ResourceSpeedslow:withSocInfo1:SocPosInFOV                             0.23      0.03     0.17     0.30 1.00     1064     2037
## SignalingTypeA:ResourceSpeedfast:withSocInfo0:SocMovDir                                0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedfast:withSocInfo0:SocMovDir                               0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeVP:ResourceSpeedfast:withSocInfo0:SocMovDir                               0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeFP:ResourceSpeedfast:withSocInfo0:SocMovDir                               0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeA:ResourceSpeedslow:withSocInfo0:SocMovDir                                0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedslow:withSocInfo0:SocMovDir                               0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeVP:ResourceSpeedslow:withSocInfo0:SocMovDir                               0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeFP:ResourceSpeedslow:withSocInfo0:SocMovDir                               0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeA:ResourceSpeedfast:withSocInfo1:SocMovDir                                0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedfast:withSocInfo1:SocMovDir                               0.08      0.06    -0.03     0.20 1.00     1862     3063
## SignalingTypeVP:ResourceSpeedfast:withSocInfo1:SocMovDir                               0.11      0.04     0.03     0.20 1.00     1235     2253
## SignalingTypeFP:ResourceSpeedfast:withSocInfo1:SocMovDir                               0.31      0.04     0.23     0.39 1.00      755     1627
## SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocMovDir                                0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedslow:withSocInfo1:SocMovDir                               0.19      0.03     0.13     0.26 1.00      780     1774
## SignalingTypeVP:ResourceSpeedslow:withSocInfo1:SocMovDir                               0.21      0.03     0.15     0.27 1.01      646     1717
## SignalingTypeFP:ResourceSpeedslow:withSocInfo1:SocMovDir                               0.35      0.03     0.29     0.41 1.01      470     1127
## SignalingTypeA:ResourceSpeedfast:EpochSecondHalf:Detector                             -0.14      0.04    -0.21    -0.06 1.00     2911     2841
## SignalingTypeNP:ResourceSpeedfast:EpochSecondHalf:Detector                            -0.11      0.04    -0.19    -0.02 1.00     3673     2854
## SignalingTypeVP:ResourceSpeedfast:EpochSecondHalf:Detector                            -0.01      0.03    -0.07     0.06 1.00     4714     3350
## SignalingTypeFP:ResourceSpeedfast:EpochSecondHalf:Detector                            -0.09      0.03    -0.14    -0.03 1.00     5529     3247
## SignalingTypeA:ResourceSpeedslow:EpochSecondHalf:Detector                             -0.14      0.03    -0.21    -0.07 1.00     4008     3221
## SignalingTypeNP:ResourceSpeedslow:EpochSecondHalf:Detector                            -0.13      0.02    -0.18    -0.08 1.00     5718     2698
## SignalingTypeVP:ResourceSpeedslow:EpochSecondHalf:Detector                            -0.05      0.02    -0.10    -0.01 1.00     5097     3035
## SignalingTypeFP:ResourceSpeedslow:EpochSecondHalf:Detector                            -0.08      0.02    -0.13    -0.03 1.00     5134     3063
## SignalingTypeA:ResourceSpeedfast:EpochSecondHalf:DistFromRes                           0.05      0.04    -0.02     0.13 1.00     3261     2846
## SignalingTypeNP:ResourceSpeedfast:EpochSecondHalf:DistFromRes                         -0.08      0.05    -0.18     0.01 1.00     3413     3229
## SignalingTypeVP:ResourceSpeedfast:EpochSecondHalf:DistFromRes                          0.03      0.04    -0.05     0.10 1.00     3755     3289
## SignalingTypeFP:ResourceSpeedfast:EpochSecondHalf:DistFromRes                          0.01      0.04    -0.06     0.09 1.00     3874     2824
## SignalingTypeA:ResourceSpeedslow:EpochSecondHalf:DistFromRes                           0.02      0.03    -0.04     0.08 1.00     3226     2802
## SignalingTypeNP:ResourceSpeedslow:EpochSecondHalf:DistFromRes                          0.06      0.03     0.01     0.11 1.00     3788     3128
## SignalingTypeVP:ResourceSpeedslow:EpochSecondHalf:DistFromRes                          0.02      0.03    -0.03     0.08 1.00     3859     3353
## SignalingTypeFP:ResourceSpeedslow:EpochSecondHalf:DistFromRes                         -0.14      0.03    -0.20    -0.08 1.00     3212     3156
## SignalingTypeA:ResourceSpeedfast:withSocInfo0:SocPosInFOV:SocQual                      0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedfast:withSocInfo0:SocPosInFOV:SocQual                     0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeVP:ResourceSpeedfast:withSocInfo0:SocPosInFOV:SocQual                     0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeFP:ResourceSpeedfast:withSocInfo0:SocPosInFOV:SocQual                     0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeA:ResourceSpeedslow:withSocInfo0:SocPosInFOV:SocQual                      0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedslow:withSocInfo0:SocPosInFOV:SocQual                     0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeVP:ResourceSpeedslow:withSocInfo0:SocPosInFOV:SocQual                     0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeFP:ResourceSpeedslow:withSocInfo0:SocPosInFOV:SocQual                     0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeA:ResourceSpeedfast:withSocInfo1:SocPosInFOV:SocQual                      0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedfast:withSocInfo1:SocPosInFOV:SocQual                     0.04      0.07    -0.10     0.17 1.00     2355     2862
## SignalingTypeVP:ResourceSpeedfast:withSocInfo1:SocPosInFOV:SocQual                     0.05      0.05    -0.05     0.15 1.00     3137     2913
## SignalingTypeFP:ResourceSpeedfast:withSocInfo1:SocPosInFOV:SocQual                     0.23      0.05     0.13     0.33 1.00     2613     2982
## SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocPosInFOV:SocQual                      0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedslow:withSocInfo1:SocPosInFOV:SocQual                     0.03      0.04    -0.04     0.11 1.00     2548     3246
## SignalingTypeVP:ResourceSpeedslow:withSocInfo1:SocPosInFOV:SocQual                     0.18      0.04     0.10     0.25 1.00     2292     2346
## SignalingTypeFP:ResourceSpeedslow:withSocInfo1:SocPosInFOV:SocQual                     0.18      0.04     0.11     0.26 1.00     2328     2943
## SignalingTypeA:ResourceSpeedfast:withSocInfo0:SocMovDir:SocQual                        0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedfast:withSocInfo0:SocMovDir:SocQual                       0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeVP:ResourceSpeedfast:withSocInfo0:SocMovDir:SocQual                       0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeFP:ResourceSpeedfast:withSocInfo0:SocMovDir:SocQual                       0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeA:ResourceSpeedslow:withSocInfo0:SocMovDir:SocQual                        0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedslow:withSocInfo0:SocMovDir:SocQual                       0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeVP:ResourceSpeedslow:withSocInfo0:SocMovDir:SocQual                       0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeFP:ResourceSpeedslow:withSocInfo0:SocMovDir:SocQual                       0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeA:ResourceSpeedfast:withSocInfo1:SocMovDir:SocQual                        0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedfast:withSocInfo1:SocMovDir:SocQual                       0.01      0.06    -0.12     0.13 1.00     2172     2459
## SignalingTypeVP:ResourceSpeedfast:withSocInfo1:SocMovDir:SocQual                       0.05      0.05    -0.04     0.15 1.00     2315     2711
## SignalingTypeFP:ResourceSpeedfast:withSocInfo1:SocMovDir:SocQual                       0.18      0.05     0.09     0.28 1.00     1239     2219
## SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocMovDir:SocQual                        0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedslow:withSocInfo1:SocMovDir:SocQual                       0.07      0.04    -0.01     0.14 1.00      767     1991
## SignalingTypeVP:ResourceSpeedslow:withSocInfo1:SocMovDir:SocQual                       0.10      0.04     0.03     0.17 1.00      909     2534
## SignalingTypeFP:ResourceSpeedslow:withSocInfo1:SocMovDir:SocQual                       0.17      0.04     0.10     0.25 1.00      717     1677
## SignalingTypeA:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocPosInFOV              0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocPosInFOV             0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeVP:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocPosInFOV             0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeFP:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocPosInFOV             0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeA:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocPosInFOV              0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocPosInFOV             0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeVP:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocPosInFOV             0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeFP:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocPosInFOV             0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeA:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocPosInFOV              0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocPosInFOV            -0.04      0.07    -0.18     0.09 1.00     2671     2947
## SignalingTypeVP:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocPosInFOV             0.05      0.05    -0.06     0.14 1.00     3580     3073
## SignalingTypeFP:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocPosInFOV             0.06      0.04    -0.03     0.14 1.00     3888     3121
## SignalingTypeA:ResourceSpeedslow:EpochSecondHalf:withSocInfo1:SocPosInFOV              0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedslow:EpochSecondHalf:withSocInfo1:SocPosInFOV            -0.02      0.03    -0.07     0.04 1.00     5232     3154
## SignalingTypeVP:ResourceSpeedslow:EpochSecondHalf:withSocInfo1:SocPosInFOV             0.00      0.03    -0.05     0.06 1.00     5327     3179
## SignalingTypeFP:ResourceSpeedslow:EpochSecondHalf:withSocInfo1:SocPosInFOV             0.09      0.03     0.04     0.14 1.00     5545     3292
## SignalingTypeA:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocMovDir                0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocMovDir               0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeVP:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocMovDir               0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeFP:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocMovDir               0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeA:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocMovDir                0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocMovDir               0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeVP:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocMovDir               0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeFP:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocMovDir               0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeA:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocMovDir                0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocMovDir              -0.03      0.07    -0.16     0.10 1.00     2766     3115
## SignalingTypeVP:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocMovDir              -0.04      0.05    -0.12     0.05 1.00     3401     3081
## SignalingTypeFP:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocMovDir               0.03      0.04    -0.05     0.11 1.00     4541     3448
## SignalingTypeA:ResourceSpeedslow:EpochSecondHalf:withSocInfo1:SocMovDir                0.00      0.00     0.00     0.00   NA       NA       NA
## SignalingTypeNP:ResourceSpeedslow:EpochSecondHalf:withSocInfo1:SocMovDir               0.08      0.03     0.03     0.14 1.00     5150     3086
##  [ reached 'max' / getOption("max.print") -- omitted 34 rows ]
## 
## Draws were sampled using sample(hmc). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).

Temporal Figures

m.RotationMagnitude.tracking.temporal.tidy_draws <- m.RotationMagnitude.tracking.temporal.fit %>%
  tidy_draws() %>%
  gather_variables() %>%
  filter(grepl("b_SignalingType", .variable) & grepl("Epoch", .variable)) %>%
  filter(!grepl("Intercept", .variable) & grepl(":Epoch", .variable))

m.RotationMagnitude.tracking.temporal.tidy_draws2 <- m.RotationMagnitude.tracking.temporal.tidy_draws %>%
  mutate(signaling = factor(case_when(
    str_detect(.variable, "SignalingTypeNP") ~ "NP",
    str_detect(.variable, "SignalingTypeVP") ~ "VP",
    str_detect(.variable, "SignalingTypeFP") ~ "FP",
    str_detect(.variable, "SignalingTypeA") ~ "A",
  ), levels = c("A", "NP", "VP", "FP"))) %>%
  mutate(resource = factor(case_when(
    str_detect(.variable, "ResourceSpeedfast") ~ "fast",
    str_detect(.variable, "ResourceSpeedslow") ~ "slow",
  ), levels = c("fast", "slow"))) %>%
  mutate(epoch_term = factor(case_when(
    str_detect(.variable, "EpochFirstHalf") ~ "First Half",
    str_detect(.variable, "EpochSecondHalf") ~ "Second Half",
  ), levels = c("First Half", "Second Half"))) %>%
  mutate(socInfo = case_when(
    str_detect(.variable, "withSocInfo0") ~ 0,
    str_detect(.variable, "withSocInfo1") ~ 1,
  )) %>%
  filter(((socInfo == 1) | is.na(socInfo)), ((signaling == "A") & is.na(socInfo)) | (signaling != "A")) %>%
  mutate(weight = factor(case_when(
    str_detect(.variable, ":Detector") ~ "Detector Change",
    str_detect(.variable, ":DistFromRes") ~ "Distance",
    str_detect(.variable, ":SocPosInFOV:SocQual") ~ "Position x Quality",
    str_detect(.variable, ":SocMovDir:SocQual") ~ "Movement x Quality",
    str_detect(.variable, ":SocPosInFOV") ~ "Position",
    str_detect(.variable, ":SocMovDir") ~ "Movement"
  ), levels = c("Detector Change", "Distance", "Position", "Movement", "Position x Quality", "Movement x Quality"))) %>%
  filter(!is.na(weight))
fig_temporal_combined

Temporal Condition Comparisons

m.RotationMagnitude.tracking.temporal.base_draws <- m.RotationMagnitude.tracking.temporal.fit %>%
  tidy_draws() %>%
  gather_variables() %>%
  filter(grepl("EpochSecondHalf", .variable) & !grepl("Detector|DistFromRes|SocPos|SocMov", .variable)) %>%
  filter(!grepl("Intercept|sigma|sd", .variable)) %>%
  mutate(
    signaling = factor(case_when(
      grepl("A", .variable) ~ "A",
      grepl("NP", .variable) ~ "NP",
      grepl("VP", .variable) ~ "VP",
      grepl("FP", .variable) ~ "FP",
      TRUE ~ "."
    ), levels = c(".", "A", "NP", "VP", "FP")),
    resource = factor(case_when(
      grepl("slow", .variable) ~ "slow",
      grepl("fast", .variable) ~ "fast",
      TRUE ~ "."
    ), levels = c(".", "fast", "slow")),
    weight = "."
  )

m.RotationMagnitude.tracking.temporal.base_summary <- m.RotationMagnitude.tracking.temporal.base_draws %>%
  group_by(resource, signaling, weight) %>%
  ggdist::mean_hdci(.value, .width = 0.9) %>%
  mutate(.value = round(.value, 2), .lower = round(.lower, 2), .upper = round(.upper, 2)) %>%
  ungroup()

m.RotationMagnitude.tracking.temporal.weights_summary <- m.RotationMagnitude.tracking.temporal.tidy_draws2 %>%
  group_by(resource, signaling, weight) %>%
  ggdist::mean_hdci(.value, .width = 0.9) %>%
  mutate(.value = round(.value, 2), .lower = round(.lower, 2), .upper = round(.upper, 2)) %>%
  ungroup()
m.RotationMagnitude.tracking.temporal.base_summary %>%
  knitr::kable("html", digits = 2) %>%
  kable_classic(full_width = T, position = "center")
resource signaling weight .value .lower .upper .width .point .interval
. . . -0.11 -0.15 -0.07 0.9 mean hdci
. NP . 0.01 -0.06 0.07 0.9 mean hdci
. VP . 0.05 -0.01 0.10 0.9 mean hdci
. FP . 0.13 0.08 0.18 0.9 mean hdci
slow . . 0.16 0.12 0.21 0.9 mean hdci
slow NP . -0.02 -0.09 0.06 0.9 mean hdci
slow VP . -0.05 -0.11 0.02 0.9 mean hdci
slow FP . -0.15 -0.22 -0.09 0.9 mean hdci
m.RotationMagnitude.tracking.temporal.weights_summary %>%
  knitr::kable("html", digits = 2) %>%
  kable_classic(full_width = T, position = "center")
resource signaling weight .value .lower .upper .width .point .interval
fast A Detector Change -0.14 -0.20 -0.08 0.9 mean hdci
fast A Distance 0.05 -0.01 0.12 0.9 mean hdci
fast NP Detector Change -0.11 -0.18 -0.04 0.9 mean hdci
fast NP Distance -0.08 -0.17 -0.01 0.9 mean hdci
fast NP Position -0.04 -0.16 0.07 0.9 mean hdci
fast NP Movement -0.03 -0.13 0.08 0.9 mean hdci
fast NP Position x Quality -0.04 -0.18 0.08 0.9 mean hdci
fast NP Movement x Quality -0.03 -0.15 0.09 0.9 mean hdci
fast VP Detector Change -0.01 -0.06 0.04 0.9 mean hdci
fast VP Distance 0.03 -0.03 0.09 0.9 mean hdci
fast VP Position 0.05 -0.04 0.13 0.9 mean hdci
fast VP Movement -0.04 -0.11 0.04 0.9 mean hdci
fast VP Position x Quality 0.08 -0.03 0.17 0.9 mean hdci
fast VP Movement x Quality -0.02 -0.11 0.07 0.9 mean hdci
fast FP Detector Change -0.09 -0.13 -0.04 0.9 mean hdci
fast FP Distance 0.01 -0.05 0.07 0.9 mean hdci
fast FP Position 0.06 -0.01 0.13 0.9 mean hdci
fast FP Movement 0.03 -0.03 0.10 0.9 mean hdci
fast FP Position x Quality 0.05 -0.03 0.14 0.9 mean hdci
fast FP Movement x Quality 0.01 -0.09 0.09 0.9 mean hdci
slow A Detector Change -0.14 -0.19 -0.08 0.9 mean hdci
slow A Distance 0.02 -0.03 0.07 0.9 mean hdci
slow NP Detector Change -0.13 -0.17 -0.09 0.9 mean hdci
slow NP Distance 0.06 0.02 0.10 0.9 mean hdci
slow NP Position -0.02 -0.06 0.02 0.9 mean hdci
slow NP Movement 0.08 0.04 0.13 0.9 mean hdci
slow NP Position x Quality 0.05 -0.01 0.11 0.9 mean hdci
slow NP Movement x Quality 0.01 -0.04 0.08 0.9 mean hdci
slow VP Detector Change -0.05 -0.09 -0.02 0.9 mean hdci
slow VP Distance 0.02 -0.02 0.07 0.9 mean hdci
slow VP Position 0.00 -0.04 0.05 0.9 mean hdci
slow VP Movement 0.04 0.00 0.09 0.9 mean hdci
slow VP Position x Quality -0.10 -0.17 -0.04 0.9 mean hdci
slow VP Movement x Quality 0.04 -0.02 0.09 0.9 mean hdci
slow FP Detector Change -0.08 -0.12 -0.04 0.9 mean hdci
slow FP Distance -0.14 -0.19 -0.09 0.9 mean hdci
slow FP Position 0.09 0.05 0.13 0.9 mean hdci
slow FP Movement 0.02 -0.02 0.07 0.9 mean hdci
slow FP Position x Quality 0.00 -0.06 0.06 0.9 mean hdci
slow FP Movement x Quality 0.11 0.05 0.18 0.9 mean hdci
# Arranging Table for Readability
m.RotationMagnitude.tracking.temporal.combined_table <- bind_rows(
  m.RotationMagnitude.tracking.temporal.base_summary,
  m.RotationMagnitude.tracking.temporal.weights_summary
) %>%
  filter(!(.value == 0 & .lower == 0 & .upper == 0)) %>%
  # Create sort factors
  mutate(
    weight_order = factor(weight, levels = c(
      ".", "Detector Change", "Distance", "Position", "Movement",
      "Position x Quality", "Movement x Quality"
    )),
    resource = factor(resource, levels = c(".", "slow", "fast")),
    signaling = factor(signaling, levels = c(".", "A", "NP", "VP", "FP"))
  ) %>%
  arrange(resource, signaling, weight_order) %>%
  mutate(contrast = "Second - First Half") %>%
  mutate(
    # resource = ifelse(as.character(resource) == ".", "Overall", as.character(resource)),
    # signaling = ifelse(as.character(signaling) == ".", "Overall", as.character(signaling)),
    # weight = ifelse(as.character(weight) == ".", "Overall", as.character(weight)),
    sig = (.lower * .upper) > 0,
    Estimate = sprintf("%.2f", .value),
    Estimate = ifelse(sig, paste0("\\textbf{", Estimate, "}"), Estimate),
    hpdi = sprintf("[%.2f, %.2f]", .lower, .upper),
    hpdi = ifelse(sig, paste0("\\textbf{", hpdi, "}"), hpdi)
  )

# Prepare kable
kbl_data <- m.RotationMagnitude.tracking.temporal.combined_table %>%
  select(resource, signaling, weight, contrast, Estimate, hpdi)

colnames(kbl_data) <- c(
  "Resource Speed", "Payoff Condition", "Decision Weight", "Contrast", "Mean", "90\\% HPDI"
)

kbl <- kable(
  kbl_data,
  format = "latex",
  booktabs = TRUE,
  align = c("l", "l", "l", "l", "r", "r"),
  caption = "Posterior Estimates for Temporal Dynamics (Second Half vs. First Half)",
  escape = FALSE
) %>%
  kable_styling(latex_options = c("hold_position", "scale_down")) %>%
  row_spec(0, bold = TRUE)

# Group rows by Resource Speed for better hierarchy
unique_speeds <- unique(kbl_data$`Resource Speed`)
curr_row <- 1
for (speed in unique_speeds) {
  n_rows <- sum(kbl_data$`Resource Speed` == speed)
  kbl <- group_rows(kbl, paste("Resource Speed:", speed), curr_row, curr_row + n_rows - 1)
  curr_row <- curr_row + n_rows
}

writeLines(kbl, paste0(comparisons, "rotation_magnitude_tracking_temporal_comparison_combined.tex"))
# Display result in Rmd
# kbl_data %>%
#   knitr::kable("html", digits = 2) %>%
#   kable_classic(full_width = T, position = "center")

Model 3: Social Cohesion & Group Spread Effects (OutDegree > 1)

m.RotationMagnitude.tracking.3.data %>%
  count(ResourceSpeed) %>% # SignalingType,
  mutate(Percentage = (n / sum(n)) * 100)
table(m.RotationMagnitude.tracking.3.data$SocMovDirCohesion)
0     1 

29115 39804

m.RotationMagnitude.tracking.3.formula <- brmsformula(
  RotationAbs | trunc(ub = 1.02) ~ SignalingType * ResourceSpeed +
    SignalingType:ResourceSpeed:Detector +
    SignalingType:ResourceSpeed:DistFromRes +
    SignalingType:ResourceSpeed:SocPosInFOV +
    SignalingType:ResourceSpeed:SocMovDir +
    SignalingType:ResourceSpeed:SocQual:SocPosInFOV +
    SignalingType:ResourceSpeed:SocQual:SocMovDir +
    SignalingType:ResourceSpeed:OutDegree:SocPosInFOV +
    SignalingType:ResourceSpeed:OutDegree:SocMovDir +
    SignalingType:ResourceSpeed:SocMovDirCohesion:SocPosInFOV +
    SignalingType:ResourceSpeed:SocMovDirCohesion:SocMovDir +
    SignalingType:ResourceSpeed:SocMovDirCohesion:SocQual:SocPosInFOV +
    SignalingType:ResourceSpeed:SocMovDirCohesion:SocQual:SocMovDir +
    (1 + Detector + SocPosInFOV + SocMovDir + SocQual:SocPosInFOV + SocQual:SocMovDir | Participant),
  family = exponential()
)

m.RotationMagnitude.tracking.3.formula_comparison <- brmsformula(
  RotationAbs | trunc(ub = 1.02) ~ SignalingType * ResourceSpeed +
    SignalingType:ResourceSpeed:Detector +
    SignalingType:ResourceSpeed:DistFromRes +
    SignalingType:ResourceSpeed:SocPosInFOV +
    SignalingType:ResourceSpeed:SocMovDir +
    SignalingType:ResourceSpeed:SocQual:SocPosInFOV +
    SignalingType:ResourceSpeed:SocQual:SocMovDir +
    SignalingType:ResourceSpeed:OutDegree:SocPosInFOV +
    SignalingType:ResourceSpeed:OutDegree:SocMovDir +
    SignalingType:ResourceSpeed:SocMovDirCohesion:SocPosInFOV +
    SignalingType:ResourceSpeed:SocMovDirCohesion:SocMovDir +
    SignalingType:ResourceSpeed:SocMovDirCohesion:SocQual:SocPosInFOV +
    SignalingType:ResourceSpeed:SocMovDirCohesion:SocQual:SocMovDir,
  family = exponential()
)
m.RotationMagnitude.tracking.3.priors <-
  prior(normal(0, 1), class = "Intercept") +
  prior(normal(0, 0.1), class = "sd") +
  prior(normal(0, 0.5), class = b)
m.RotationMagnitude.tracking.3.fit <- brm(
  formula = m.RotationMagnitude.tracking.3.formula,
  data = m.RotationMagnitude.tracking.3.data,
  prior = m.RotationMagnitude.tracking.3.priors,
  chains = 4,
  cores = 4,
  seed = 4242,
  warmup = 1000,
  iter = 2000,
  file = paste0(fits_path, "rotation_magnitude_tracking_3.rds"),
  backend = "cmdstanr",
  threads = threading(100),
  save_pars = save_pars(all = FALSE)
)
summary(m.RotationMagnitude.tracking.3.fit, ask = F)
##  Family: exponential 
##   Links: mu = log 
## Formula: RotationAbs | trunc(ub = 1.02) ~ SignalingType * ResourceSpeed + SignalingType:ResourceSpeed:Detector + SignalingType:ResourceSpeed:DistFromRes + SignalingType:ResourceSpeed:SocPosInFOV + SignalingType:ResourceSpeed:SocMovDir + SignalingType:ResourceSpeed:SocQual:SocPosInFOV + SignalingType:ResourceSpeed:SocQual:SocMovDir + SignalingType:ResourceSpeed:OutDegree:SocPosInFOV + SignalingType:ResourceSpeed:OutDegree:SocMovDir + SignalingType:ResourceSpeed:SocMovDirCohesion:SocPosInFOV + SignalingType:ResourceSpeed:SocMovDirCohesion:SocMovDir + SignalingType:ResourceSpeed:SocMovDirCohesion:SocQual:SocPosInFOV + SignalingType:ResourceSpeed:SocMovDirCohesion:SocQual:SocMovDir + (1 + Detector + SocPosInFOV + SocMovDir + SocQual:SocPosInFOV + SocQual:SocMovDir | Participant) 
##    Data: m.RotationMagnitude.tracking.3.data (Number of observations: 68919) 
##   Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
##          total post-warmup draws = 4000
## 
## Multilevel Hyperparameters:
## ~Participant (Number of levels: 476) 
##                                            Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sd(Intercept)                                  0.48      0.02     0.44     0.51 1.01      709     1888
## sd(Detector)                                   0.38      0.02     0.35     0.41 1.00     1213     2206
## sd(SocPosInFOV)                                0.27      0.02     0.24     0.30 1.00     1130     1782
## sd(SocMovDir)                                  0.23      0.01     0.20     0.25 1.00     1633     2517
## sd(SocPosInFOV:SocQual)                        0.26      0.02     0.23     0.30 1.00     1709     2656
## sd(SocMovDir:SocQual)                          0.23      0.02     0.20     0.27 1.00     1178     1878
## cor(Intercept,Detector)                        0.25      0.05     0.14     0.35 1.00      862     1672
## cor(Intercept,SocPosInFOV)                     0.06      0.07    -0.07     0.20 1.01     1334     2193
## cor(Detector,SocPosInFOV)                     -0.32      0.07    -0.45    -0.19 1.00      995     1730
## cor(Intercept,SocMovDir)                       0.40      0.06     0.27     0.52 1.00     1360     2340
## cor(Detector,SocMovDir)                       -0.03      0.07    -0.17     0.11 1.00     1402     2321
## cor(SocPosInFOV,SocMovDir)                    -0.09      0.08    -0.24     0.09 1.00      824     1479
## cor(Intercept,SocPosInFOV:SocQual)             0.30      0.07     0.16     0.44 1.00     1672     2213
## cor(Detector,SocPosInFOV:SocQual)              0.04      0.07    -0.10     0.19 1.00     1623     2334
## cor(SocPosInFOV,SocPosInFOV:SocQual)          -0.21      0.09    -0.39    -0.04 1.00      887     1729
## cor(SocMovDir,SocPosInFOV:SocQual)             0.03      0.09    -0.15     0.20 1.00      904     1938
## cor(Intercept,SocMovDir:SocQual)               0.31      0.07     0.17     0.45 1.00     1915     2593
## cor(Detector,SocMovDir:SocQual)                0.11      0.08    -0.05     0.27 1.00     1627     2441
## cor(SocPosInFOV,SocMovDir:SocQual)            -0.09      0.09    -0.28     0.09 1.01     1119     1541
## cor(SocMovDir,SocMovDir:SocQual)              -0.25      0.09    -0.42    -0.07 1.00     1098     1895
## cor(SocPosInFOV:SocQual,SocMovDir:SocQual)     0.10      0.10    -0.09     0.31 1.00      957     1996
## 
## Regression Coefficients:
##                                                                          Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## Intercept                                                                   -1.51      0.07    -1.65    -1.37 1.00      696     1360
## SignalingTypeVP                                                             -0.31      0.09    -0.49    -0.14 1.00      661     1182
## SignalingTypeFP                                                              0.12      0.09    -0.06     0.30 1.01      611     1155
## ResourceSpeedslow                                                           -0.05      0.08    -0.22     0.11 1.01      457      942
## SignalingTypeVP:ResourceSpeedslow                                            0.49      0.11     0.27     0.71 1.00      446     1017
## SignalingTypeFP:ResourceSpeedslow                                            0.20      0.12    -0.04     0.43 1.01      411      904
## SignalingTypeNP:ResourceSpeedfast:Detector                                   1.25      0.06     1.13     1.38 1.00     1515     2658
## SignalingTypeVP:ResourceSpeedfast:Detector                                   0.96      0.05     0.86     1.06 1.00     1194     1781
## SignalingTypeFP:ResourceSpeedfast:Detector                                   0.77      0.05     0.67     0.86 1.00     1041     2024
## SignalingTypeNP:ResourceSpeedslow:Detector                                   1.26      0.05     1.17     1.36 1.00      778     1519
## SignalingTypeVP:ResourceSpeedslow:Detector                                   1.05      0.05     0.96     1.14 1.00      890     1743
## SignalingTypeFP:ResourceSpeedslow:Detector                                   0.89      0.05     0.80     0.98 1.00      705     1559
## SignalingTypeNP:ResourceSpeedfast:DistFromRes                                0.30      0.05     0.21     0.39 1.00     4143     3202
## SignalingTypeVP:ResourceSpeedfast:DistFromRes                                0.50      0.04     0.43     0.58 1.00     4293     3364
## SignalingTypeFP:ResourceSpeedfast:DistFromRes                                0.23      0.03     0.16     0.29 1.00     4852     3105
## SignalingTypeNP:ResourceSpeedslow:DistFromRes                                0.33      0.02     0.28     0.37 1.00     4854     2842
## SignalingTypeVP:ResourceSpeedslow:DistFromRes                                0.11      0.02     0.07     0.16 1.00     4738     3222
## SignalingTypeFP:ResourceSpeedslow:DistFromRes                                0.24      0.02     0.19     0.28 1.00     4703     3326
## SignalingTypeNP:ResourceSpeedfast:SocPosInFOV                                0.18      0.09     0.01     0.35 1.00     2243     2448
## SignalingTypeVP:ResourceSpeedfast:SocPosInFOV                                0.55      0.06     0.43     0.67 1.00     2810     2994
## SignalingTypeFP:ResourceSpeedfast:SocPosInFOV                                0.48      0.06     0.37     0.58 1.00     2296     3015
## SignalingTypeNP:ResourceSpeedslow:SocPosInFOV                                0.45      0.04     0.37     0.54 1.00     1553     2514
## SignalingTypeVP:ResourceSpeedslow:SocPosInFOV                                0.44      0.04     0.36     0.52 1.00     1340     2385
## SignalingTypeFP:ResourceSpeedslow:SocPosInFOV                                0.56      0.04     0.48     0.64 1.00     1182     2183
## SignalingTypeNP:ResourceSpeedfast:SocMovDir                                  0.03      0.08    -0.12     0.18 1.00     1929     2924
## SignalingTypeVP:ResourceSpeedfast:SocMovDir                                  0.14      0.05     0.03     0.24 1.00     2265     2900
## SignalingTypeFP:ResourceSpeedfast:SocMovDir                                  0.32      0.05     0.23     0.42 1.00     2166     2811
## SignalingTypeNP:ResourceSpeedslow:SocMovDir                                  0.15      0.04     0.08     0.22 1.00     1371     2583
## SignalingTypeVP:ResourceSpeedslow:SocMovDir                                  0.19      0.04     0.12     0.27 1.00     1576     2371
## SignalingTypeFP:ResourceSpeedslow:SocMovDir                                  0.24      0.04     0.17     0.31 1.00     1530     2415
## SignalingTypeNP:ResourceSpeedfast:SocPosInFOV:SocQual                        0.08      0.08    -0.08     0.24 1.00     2065     2459
## SignalingTypeVP:ResourceSpeedfast:SocPosInFOV:SocQual                        0.03      0.06    -0.09     0.16 1.00     2399     2982
## SignalingTypeFP:ResourceSpeedfast:SocPosInFOV:SocQual                        0.27      0.06     0.15     0.38 1.00     2426     2683
## SignalingTypeNP:ResourceSpeedslow:SocPosInFOV:SocQual                        0.14      0.05     0.04     0.23 1.00     1762     2512
## SignalingTypeVP:ResourceSpeedslow:SocPosInFOV:SocQual                        0.06      0.05    -0.04     0.15 1.00     1413     2483
## SignalingTypeFP:ResourceSpeedslow:SocPosInFOV:SocQual                        0.10      0.05     0.01     0.20 1.00     1318     2440
## SignalingTypeNP:ResourceSpeedfast:SocMovDir:SocQual                         -0.02      0.08    -0.18     0.14 1.00     1956     2242
## SignalingTypeVP:ResourceSpeedfast:SocMovDir:SocQual                         -0.07      0.06    -0.19     0.05 1.00     2428     2604
## SignalingTypeFP:ResourceSpeedfast:SocMovDir:SocQual                          0.03      0.06    -0.09     0.15 1.00     2473     2407
## SignalingTypeNP:ResourceSpeedslow:SocMovDir:SocQual                         -0.03      0.04    -0.12     0.06 1.00     2195     2395
## SignalingTypeVP:ResourceSpeedslow:SocMovDir:SocQual                          0.03      0.04    -0.06     0.11 1.00     1703     2667
## SignalingTypeFP:ResourceSpeedslow:SocMovDir:SocQual                          0.09      0.05     0.00     0.18 1.00     1468     2375
## SignalingTypeNP:ResourceSpeedfast:SocPosInFOV:OutDegree                     -0.13      0.06    -0.25    -0.02 1.00     4063     2874
## SignalingTypeVP:ResourceSpeedfast:SocPosInFOV:OutDegree                      0.03      0.04    -0.06     0.11 1.00     4760     3254
## SignalingTypeFP:ResourceSpeedfast:SocPosInFOV:OutDegree                      0.00      0.04    -0.07     0.07 1.00     4576     3299
## SignalingTypeNP:ResourceSpeedslow:SocPosInFOV:OutDegree                      0.00      0.02    -0.05     0.05 1.00     3848     2531
## SignalingTypeVP:ResourceSpeedslow:SocPosInFOV:OutDegree                     -0.02      0.02    -0.07     0.02 1.00     4553     3275
## SignalingTypeFP:ResourceSpeedslow:SocPosInFOV:OutDegree                      0.10      0.02     0.06     0.14 1.00     4296     3114
## SignalingTypeNP:ResourceSpeedfast:SocMovDir:OutDegree                        0.02      0.06    -0.11     0.13 1.00     3439     3266
## SignalingTypeVP:ResourceSpeedfast:SocMovDir:OutDegree                       -0.01      0.04    -0.09     0.07 1.00     4625     3282
## SignalingTypeFP:ResourceSpeedfast:SocMovDir:OutDegree                        0.05      0.04    -0.02     0.12 1.00     3978     3038
## SignalingTypeNP:ResourceSpeedslow:SocMovDir:OutDegree                       -0.01      0.02    -0.06     0.04 1.00     4490     3336
## SignalingTypeVP:ResourceSpeedslow:SocMovDir:OutDegree                        0.01      0.02    -0.03     0.06 1.00     4526     3535
## SignalingTypeFP:ResourceSpeedslow:SocMovDir:OutDegree                       -0.03      0.02    -0.07     0.01 1.00     4900     3203
## SignalingTypeNP:ResourceSpeedfast:SocPosInFOV:SocMovDirCohesion1            -0.24      0.09    -0.41    -0.06 1.00     2396     2766
## SignalingTypeVP:ResourceSpeedfast:SocPosInFOV:SocMovDirCohesion1            -0.50      0.07    -0.64    -0.37 1.00     2917     3096
## SignalingTypeFP:ResourceSpeedfast:SocPosInFOV:SocMovDirCohesion1            -0.34      0.05    -0.45    -0.23 1.00     3508     3244
## SignalingTypeNP:ResourceSpeedslow:SocPosInFOV:SocMovDirCohesion1            -0.43      0.04    -0.50    -0.36 1.00     4064     3197
## SignalingTypeVP:ResourceSpeedslow:SocPosInFOV:SocMovDirCohesion1            -0.42      0.03    -0.49    -0.36 1.00     3614     3423
## SignalingTypeFP:ResourceSpeedslow:SocPosInFOV:SocMovDirCohesion1            -0.44      0.03    -0.50    -0.37 1.00     3779     2773
## SignalingTypeNP:ResourceSpeedfast:SocMovDir:SocMovDirCohesion1              -0.03      0.09    -0.20     0.15 1.00     2511     3175
## SignalingTypeVP:ResourceSpeedfast:SocMovDir:SocMovDirCohesion1               0.02      0.06    -0.11     0.15 1.00     2895     2548
## SignalingTypeFP:ResourceSpeedfast:SocMovDir:SocMovDirCohesion1               0.05      0.05    -0.05     0.16 1.00     3208     2966
## SignalingTypeNP:ResourceSpeedslow:SocMovDir:SocMovDirCohesion1               0.09      0.03     0.02     0.16 1.00     3816     3119
## SignalingTypeVP:ResourceSpeedslow:SocMovDir:SocMovDirCohesion1               0.10      0.03     0.03     0.16 1.00     3615     3161
## SignalingTypeFP:ResourceSpeedslow:SocMovDir:SocMovDirCohesion1               0.12      0.03     0.06     0.19 1.00     3529     3221
## SignalingTypeNP:ResourceSpeedfast:SocPosInFOV:SocQual:SocMovDirCohesion1    -0.03      0.10    -0.23     0.17 1.00     2226     2637
## SignalingTypeVP:ResourceSpeedfast:SocPosInFOV:SocQual:SocMovDirCohesion1     0.08      0.08    -0.07     0.23 1.00     2829     3109
## SignalingTypeFP:ResourceSpeedfast:SocPosInFOV:SocQual:SocMovDirCohesion1    -0.15      0.07    -0.28    -0.02 1.00     3271     2504
## SignalingTypeNP:ResourceSpeedslow:SocPosInFOV:SocQual:SocMovDirCohesion1    -0.09      0.05    -0.18    -0.00 1.00     3650     2852
## SignalingTypeVP:ResourceSpeedslow:SocPosInFOV:SocQual:SocMovDirCohesion1     0.04      0.05    -0.05     0.14 1.00     2830     2497
## SignalingTypeFP:ResourceSpeedslow:SocPosInFOV:SocQual:SocMovDirCohesion1     0.13      0.05     0.03     0.22 1.00     3792     3249
## SignalingTypeNP:ResourceSpeedfast:SocMovDir:SocQual:SocMovDirCohesion1       0.06      0.10    -0.13     0.25 1.00     2402     2991
## SignalingTypeVP:ResourceSpeedfast:SocMovDir:SocQual:SocMovDirCohesion1       0.19      0.07     0.04     0.32 1.00     2660     3060
## SignalingTypeFP:ResourceSpeedfast:SocMovDir:SocQual:SocMovDirCohesion1       0.22      0.07     0.09     0.36 1.00     3156     2880
## SignalingTypeNP:ResourceSpeedslow:SocMovDir:SocQual:SocMovDirCohesion1       0.09      0.05    -0.00     0.17 1.00     3165     2826
## SignalingTypeVP:ResourceSpeedslow:SocMovDir:SocQual:SocMovDirCohesion1       0.08      0.05    -0.01     0.17 1.00     3151     3120
## SignalingTypeFP:ResourceSpeedslow:SocMovDir:SocQual:SocMovDirCohesion1       0.09      0.05     0.00     0.18 1.00     3226     3077
## 
## Draws were sampled using sample(hmc). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).

Model 3: New Feature Posterior Contrasts

m.RotationMagnitude.tracking.3.tidy_draws <- m.RotationMagnitude.tracking.3.fit %>%
  tidy_draws() %>%
  gather_variables() %>%
  filter(grepl("b_SignalingType", .variable)) %>%
  filter(grepl("SocMovDirCohesion1|OutDegree", .variable))
m.RotationMagnitude.tracking.3.tidy_draws2 <- m.RotationMagnitude.tracking.3.tidy_draws %>%
  mutate(signaling = factor(case_when(
    str_detect(.variable, "SignalingTypeNP") ~ "NP",
    str_detect(.variable, "SignalingTypeVP") ~ "VP",
    str_detect(.variable, "SignalingTypeFP") ~ "FP",
  ), levels = c("NP", "VP", "FP"))) %>%
  mutate(resource = factor(case_when(
    str_detect(.variable, "ResourceSpeedfast") ~ "fast",
    str_detect(.variable, "ResourceSpeedslow") ~ "slow",
  ), levels = c("fast", "slow"))) %>%
  mutate(weight = factor(case_when(
    # Cohesion x Quality interactions (3-way, check first)
    str_detect(.variable, "SocMovDirCohesion1") & str_detect(.variable, "SocPosInFOV") & str_detect(.variable, "SocQual") ~ "Cohesion x Position x Quality",
    str_detect(.variable, "SocMovDirCohesion1") & !str_detect(.variable, "SocPosInFOV") & str_detect(.variable, "SocQual") ~ "Cohesion x Movement x Quality",
    # Cohesion interactions (2-way)
    str_detect(.variable, "SocMovDirCohesion1") & str_detect(.variable, "SocPosInFOV") ~ "Cohesion x Position",
    str_detect(.variable, "SocMovDirCohesion1") & !str_detect(.variable, "SocPosInFOV") ~ "Cohesion x Movement",
    # OutDegree interactions
    str_detect(.variable, "OutDegree") & str_detect(.variable, "SocPosInFOV") ~ "OutDegree x Position",
    str_detect(.variable, "OutDegree") & str_detect(.variable, "SocMovDir") ~ "OutDegree x Movement",
  ), levels = c(
    "OutDegree x Position",
    "OutDegree x Movement",
    "Cohesion x Position",
    "Cohesion x Movement",
    "Cohesion x Position x Quality",
    "Cohesion x Movement x Quality"
  )))

head(m.RotationMagnitude.tracking.3.tidy_draws2)

Summary Table

m.RotationMagnitude.tracking.3.summary <- m.RotationMagnitude.tracking.3.tidy_draws2 %>%
  group_by(resource, signaling, weight) %>%
  ggdist::mean_hdci(.value, .width = 0.9) %>%
  mutate(.value = round(.value, 2), .lower = round(.lower, 2), .upper = round(.upper, 2)) %>%
  ungroup()

m.RotationMagnitude.tracking.3.summary %>%
  knitr::kable("html", digits = 2) %>%
  kable_classic(full_width = T, position = "center")
resource signaling weight .value .lower .upper .width .point .interval
fast NP OutDegree x Position -0.13 -0.23 -0.04 0.9 mean hdci
fast NP OutDegree x Movement 0.02 -0.08 0.12 0.9 mean hdci
fast NP Cohesion x Position -0.24 -0.37 -0.08 0.9 mean hdci
fast NP Cohesion x Movement -0.03 -0.18 0.11 0.9 mean hdci
fast NP Cohesion x Position x Quality -0.03 -0.19 0.14 0.9 mean hdci
fast NP Cohesion x Movement x Quality 0.06 -0.09 0.23 0.9 mean hdci
fast VP OutDegree x Position 0.03 -0.05 0.10 0.9 mean hdci
fast VP OutDegree x Movement -0.01 -0.07 0.06 0.9 mean hdci
fast VP Cohesion x Position -0.50 -0.62 -0.39 0.9 mean hdci
fast VP Cohesion x Movement 0.02 -0.10 0.11 0.9 mean hdci
fast VP Cohesion x Position x Quality 0.08 -0.04 0.21 0.9 mean hdci
fast VP Cohesion x Movement x Quality 0.19 0.07 0.31 0.9 mean hdci
fast FP OutDegree x Position 0.00 -0.05 0.07 0.9 mean hdci
fast FP OutDegree x Movement 0.05 -0.01 0.11 0.9 mean hdci
fast FP Cohesion x Position -0.34 -0.43 -0.26 0.9 mean hdci
fast FP Cohesion x Movement 0.05 -0.04 0.14 0.9 mean hdci
fast FP Cohesion x Position x Quality -0.15 -0.27 -0.05 0.9 mean hdci
fast FP Cohesion x Movement x Quality 0.22 0.11 0.33 0.9 mean hdci
slow NP OutDegree x Position 0.00 -0.04 0.04 0.9 mean hdci
slow NP OutDegree x Movement -0.01 -0.05 0.03 0.9 mean hdci
slow NP Cohesion x Position -0.43 -0.49 -0.37 0.9 mean hdci
slow NP Cohesion x Movement 0.09 0.03 0.15 0.9 mean hdci
slow NP Cohesion x Position x Quality -0.09 -0.17 -0.01 0.9 mean hdci
slow NP Cohesion x Movement x Quality 0.09 0.01 0.16 0.9 mean hdci
slow VP OutDegree x Position -0.02 -0.06 0.01 0.9 mean hdci
slow VP OutDegree x Movement 0.01 -0.03 0.05 0.9 mean hdci
slow VP Cohesion x Position -0.42 -0.48 -0.37 0.9 mean hdci
slow VP Cohesion x Movement 0.10 0.04 0.15 0.9 mean hdci
slow VP Cohesion x Position x Quality 0.04 -0.03 0.12 0.9 mean hdci
slow VP Cohesion x Movement x Quality 0.08 0.01 0.16 0.9 mean hdci
slow FP OutDegree x Position 0.10 0.06 0.13 0.9 mean hdci
slow FP OutDegree x Movement -0.03 -0.06 0.01 0.9 mean hdci
slow FP Cohesion x Position -0.44 -0.49 -0.38 0.9 mean hdci
slow FP Cohesion x Movement 0.12 0.07 0.17 0.9 mean hdci
slow FP Cohesion x Position x Quality 0.13 0.05 0.20 0.9 mean hdci
slow FP Cohesion x Movement x Quality 0.09 0.02 0.17 0.9 mean hdci
m.RotationMagnitude.tracking.3.latex_table <- m.RotationMagnitude.tracking.3.summary %>%
  mutate(
    sig = (.lower * .upper) > 0,
    Estimate = sprintf("%.2f", .value),
    Estimate = ifelse(sig, paste0("\\textbf{", Estimate, "}"), Estimate),
    hpdi = sprintf("[%.2f, %.2f]", .lower, .upper),
    hpdi = ifelse(sig, paste0("\\textbf{", hpdi, "}"), hpdi)
  ) %>%
  select(resource, signaling, weight, Estimate, hpdi)

colnames(m.RotationMagnitude.tracking.3.latex_table) <- c(
  "Resource Speed", "Payoff Condition", "Decision Weight", "Mean", "90\\% HPDI"
)

kbl <- kable(
  m.RotationMagnitude.tracking.3.latex_table,
  format = "latex",
  booktabs = TRUE,
  align = c("l", "l", "l", "r", "r"),
  caption = "Posterior Estimates for New Social Features (OutDegree \\& Cohesion Interactions, OutDegree > 1)",
  escape = FALSE
) %>%
  kable_styling(latex_options = c("hold_position", "scale_down")) %>%
  row_spec(0, bold = TRUE)

unique_speeds <- unique(m.RotationMagnitude.tracking.3.latex_table$`Resource Speed`)
curr_row <- 1
for (speed in unique_speeds) {
  n_rows <- sum(m.RotationMagnitude.tracking.3.latex_table$`Resource Speed` == speed)
  kbl <- group_rows(kbl, paste("Resource Speed:", speed), curr_row, curr_row + n_rows - 1)
  curr_row <- curr_row + n_rows
}

writeLines(kbl, paste0(comparisons, "rotation_magnitude_tracking_3_new_features.tex"))

Figures