Roation Magnitude (Search)
m.RotationMagnitude.search.data <- time_series_data %>%
filter(State == "searching") %>%
mutate(SocQual = as.numeric(case_when(
OutDegree == 0 ~ 0,
SocInfoQualityBin == 1 ~ 1,
SocInfoQualityBin == 0 ~ -1,
.default = -1
))) %>%
mutate(withSocInfo = factor(ifelse(OutDegree > 0, 1, 0), levels = c(0, 1))) %>%
mutate(Rotation = Rotation / 150) %>%
mutate(SocMovDir = ifelse(withSocInfo == 0, 0, (abs(SocialMovementDirection / max(abs(SocialMovementDirection), na.rm = T)) - 0.5) * 2)) %>%
mutate(RotationAbs = abs(Rotation) + 0.01) %>%
mutate(DistFromRes = (OwnDistFromResource - 200) / 200) %>%
mutate(SocPosInFOV = ifelse(withSocInfo == 0, 0, (abs(VisPlayersDirection / max(abs(VisPlayersDirection), na.rm = T)) - 0.5) * 2)) %>%
select(Participant, Time, SignalingType, ResourceSpeed, RotationAbs, withSocInfo, DistFromRes, SocPosInFOV, SocMovDir, SocQual)
head(m.RotationMagnitude.search.data)![]()
m.RotationMagnitude.search.1.formula <- brmsformula(
RotationAbs | trunc(ub = 1.02) ~ SignalingType * ResourceSpeed +
SignalingType:ResourceSpeed:withSocInfo:SocPosInFOV +
SignalingType:ResourceSpeed:withSocInfo:SocMovDir +
SignalingType:ResourceSpeed:withSocInfo:SocQual:SocPosInFOV +
SignalingType:ResourceSpeed:withSocInfo:SocQual:SocMovDir +
(1 + withSocInfo:SocPosInFOV + withSocInfo:SocMovDir + withSocInfo:SocQual:SocPosInFOV + withSocInfo:SocQual:SocMovDir | Participant),
family = exponential()
)
m.RotationMagnitude.search.1.formula_comparison <- brmsformula(
RotationAbs | trunc(ub = 1.02) ~ SignalingType * ResourceSpeed +
SignalingType:ResourceSpeed:withSocInfo:SocPosInFOV +
SignalingType:ResourceSpeed:withSocInfo:SocMovDir +
SignalingType:ResourceSpeed:withSocInfo:SocQual:SocPosInFOV +
SignalingType:ResourceSpeed:withSocInfo:SocQual:SocMovDir,
family = exponential()
)Prior predictive checks
m.RotationMagnitude.search.1.fit_prior <- brm(
formula = m.RotationMagnitude.search.1.formula,
data = m.RotationMagnitude.search.data,
prior = m.RotationMagnitude.search.1.priors,
chains = 4,
cores = 4,
seed = 42,
iter = 2000,
file = paste0(fits_path, "rotation_magnitude_search_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.search.1.y <- m.RotationMagnitude.search.data$RotationAbs![]()
Model fitting (~9.5h)
m.RotationMagnitude.search.1.fit <- brm(
formula = m.RotationMagnitude.search.1.formula,
data = m.RotationMagnitude.search.data,
prior = m.RotationMagnitude.search.1.priors,
chains = 4,
cores = 4,
seed = 4242,
warmup = 2000,
iter = 5000,
file = paste0(fits_path, "rotation_magnitude_search_1.rds"),
backend = "cmdstanr",
threads = threading(100),
save_pars = save_pars(all = FALSE)
)## Family: exponential
## Links: mu = log
## Formula: RotationAbs | trunc(ub = 1.02) ~ SignalingType * ResourceSpeed + SignalingType:ResourceSpeed:withSocInfo:SocPosInFOV + SignalingType:ResourceSpeed:withSocInfo:SocMovDir + SignalingType:ResourceSpeed:withSocInfo:SocQual:SocPosInFOV + SignalingType:ResourceSpeed:withSocInfo:SocQual:SocMovDir + (1 + withSocInfo:SocPosInFOV + withSocInfo:SocMovDir + withSocInfo:SocQual:SocPosInFOV + withSocInfo:SocQual:SocMovDir | Participant)
## Data: m.RotationMagnitude.search.data (Number of observations: 242142)
## Draws: 4 chains, each with iter = 5000; warmup = 2000; thin = 1;
## total post-warmup draws = 12000
##
## Multilevel Hyperparameters:
## ~Participant (Number of levels: 603)
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sd(Intercept) 0.52 0.02 0.48 0.55 1.00 1703 3262
## sd(withSocInfo0:SocPosInFOV) 0.00 0.00 0.00 0.00 NA NA NA
## sd(withSocInfo1:SocPosInFOV) 0.35 0.02 0.32 0.38 1.00 6460 8907
## sd(withSocInfo0:SocMovDir) 0.00 0.00 0.00 0.00 NA NA NA
## sd(withSocInfo1:SocMovDir) 0.27 0.02 0.24 0.30 1.00 6644 9374
## 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 6980 9514
## sd(withSocInfo0:SocMovDir:SocQual) 0.00 0.00 0.00 0.00 NA NA NA
## sd(withSocInfo1:SocMovDir:SocQual) 0.22 0.01 0.19 0.25 1.00 6407 9176
## cor(Intercept,withSocInfo0:SocPosInFOV) -0.00 0.31 -0.60 0.60 1.00 26161 8417
## cor(Intercept,withSocInfo1:SocPosInFOV) 0.24 0.06 0.11 0.36 1.00 7366 8552
## cor(withSocInfo0:SocPosInFOV,withSocInfo1:SocPosInFOV) 0.07 0.31 -0.56 0.63 1.04 99 254
## cor(Intercept,withSocInfo0:SocMovDir) 0.00 0.32 -0.62 0.61 1.00 25882 7543
## cor(withSocInfo0:SocPosInFOV,withSocInfo0:SocMovDir) 0.00 0.32 -0.59 0.61 1.00 19120 8019
## cor(withSocInfo1:SocPosInFOV,withSocInfo0:SocMovDir) 0.00 0.31 -0.59 0.59 1.00 26413 7749
## cor(Intercept,withSocInfo1:SocMovDir) 0.47 0.06 0.35 0.58 1.00 8464 9471
## cor(withSocInfo0:SocPosInFOV,withSocInfo1:SocMovDir) 0.01 0.32 -0.61 0.60 1.02 225 648
## cor(withSocInfo1:SocPosInFOV,withSocInfo1:SocMovDir) 0.02 0.07 -0.12 0.15 1.00 7700 9412
## cor(withSocInfo0:SocMovDir,withSocInfo1:SocMovDir) 0.02 0.31 -0.58 0.61 1.01 298 931
## cor(Intercept,withSocInfo0:SocPosInFOV:SocQual) 0.00 0.32 -0.60 0.61 1.00 30071 8288
## cor(withSocInfo0:SocPosInFOV,withSocInfo0:SocPosInFOV:SocQual) 0.00 0.32 -0.60 0.61 1.00 19344 8105
## cor(withSocInfo1:SocPosInFOV,withSocInfo0:SocPosInFOV:SocQual) 0.00 0.31 -0.59 0.59 1.00 25652 8338
## cor(withSocInfo0:SocMovDir,withSocInfo0:SocPosInFOV:SocQual) 0.00 0.31 -0.60 0.60 1.00 10360 8410
## cor(withSocInfo1:SocMovDir,withSocInfo0:SocPosInFOV:SocQual) 0.00 0.32 -0.61 0.61 1.00 28500 8223
## cor(Intercept,withSocInfo1:SocPosInFOV:SocQual) 0.32 0.07 0.18 0.45 1.00 8887 8915
## cor(withSocInfo0:SocPosInFOV,withSocInfo1:SocPosInFOV:SocQual) 0.02 0.31 -0.57 0.61 1.02 191 665
## cor(withSocInfo1:SocPosInFOV,withSocInfo1:SocPosInFOV:SocQual) 0.43 0.06 0.31 0.54 1.00 8328 9569
## cor(withSocInfo0:SocMovDir,withSocInfo1:SocPosInFOV:SocQual) -0.02 0.31 -0.61 0.58 1.01 272 809
## cor(withSocInfo1:SocMovDir,withSocInfo1:SocPosInFOV:SocQual) -0.00 0.08 -0.16 0.15 1.00 7321 9319
## cor(withSocInfo0:SocPosInFOV:SocQual,withSocInfo1:SocPosInFOV:SocQual) 0.02 0.32 -0.59 0.64 1.02 274 1177
## cor(Intercept,withSocInfo0:SocMovDir:SocQual) 0.00 0.32 -0.60 0.61 1.00 30070 8290
## cor(withSocInfo0:SocPosInFOV,withSocInfo0:SocMovDir:SocQual) 0.00 0.31 -0.59 0.59 1.00 16718 8124
## cor(withSocInfo1:SocPosInFOV,withSocInfo0:SocMovDir:SocQual) -0.00 0.33 -0.63 0.62 1.00 28060 8142
## cor(withSocInfo0:SocMovDir,withSocInfo0:SocMovDir:SocQual) 0.00 0.31 -0.59 0.60 1.00 10615 8884
## cor(withSocInfo1:SocMovDir,withSocInfo0:SocMovDir:SocQual) 0.00 0.32 -0.60 0.61 1.00 30970 8269
## cor(withSocInfo0:SocPosInFOV:SocQual,withSocInfo0:SocMovDir:SocQual) -0.00 0.32 -0.61 0.61 1.00 7393 8536
## cor(withSocInfo1:SocPosInFOV:SocQual,withSocInfo0:SocMovDir:SocQual) 0.00 0.32 -0.60 0.60 1.00 26241 8764
## cor(Intercept,withSocInfo1:SocMovDir:SocQual) 0.31 0.07 0.16 0.44 1.00 9769 8671
## cor(withSocInfo0:SocPosInFOV,withSocInfo1:SocMovDir:SocQual) -0.02 0.32 -0.61 0.59 1.01 243 511
## cor(withSocInfo1:SocPosInFOV,withSocInfo1:SocMovDir:SocQual) -0.20 0.07 -0.34 -0.06 1.00 9765 10516
## cor(withSocInfo0:SocMovDir,withSocInfo1:SocMovDir:SocQual) 0.02 0.31 -0.58 0.62 1.02 262 728
## cor(withSocInfo1:SocMovDir,withSocInfo1:SocMovDir:SocQual) 0.67 0.05 0.57 0.76 1.00 5970 8825
## cor(withSocInfo0:SocPosInFOV:SocQual,withSocInfo1:SocMovDir:SocQual) 0.01 0.31 -0.59 0.60 1.00 1025 3408
## cor(withSocInfo1:SocPosInFOV:SocQual,withSocInfo1:SocMovDir:SocQual) -0.08 0.08 -0.23 0.08 1.00 7781 9631
## cor(withSocInfo0:SocMovDir:SocQual,withSocInfo1:SocMovDir:SocQual) -0.00 0.31 -0.61 0.59 1.00 1471 3648
##
## Regression Coefficients:
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## Intercept -1.65 0.06 -1.76 -1.55 1.01 683 1321
## SignalingTypeNP 0.05 0.08 -0.12 0.21 1.01 465 969
## SignalingTypeVP 0.14 0.08 -0.00 0.29 1.00 663 1657
## SignalingTypeFP 0.58 0.08 0.42 0.74 1.00 758 1628
## ResourceSpeedslow 0.15 0.08 -0.01 0.31 1.01 901 2080
## SignalingTypeNP:ResourceSpeedslow 0.22 0.12 -0.01 0.46 1.01 644 1548
## SignalingTypeVP:ResourceSpeedslow 0.28 0.12 0.06 0.51 1.00 1086 2346
## SignalingTypeFP:ResourceSpeedslow -0.12 0.12 -0.36 0.12 1.00 1097 2240
## 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.24 0.04 0.15 0.33 1.00 4042 7007
## SignalingTypeVP:ResourceSpeedfast:withSocInfo1:SocPosInFOV 0.36 0.04 0.28 0.44 1.00 4519 7283
## SignalingTypeFP:ResourceSpeedfast:withSocInfo1:SocPosInFOV 0.52 0.04 0.43 0.61 1.00 6135 8339
## SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocPosInFOV 0.00 0.50 -0.97 0.98 1.00 28141 8698
## SignalingTypeNP:ResourceSpeedslow:withSocInfo1:SocPosInFOV 0.51 0.06 0.40 0.62 1.00 8110 9459
## SignalingTypeVP:ResourceSpeedslow:withSocInfo1:SocPosInFOV 0.57 0.06 0.45 0.68 1.00 9425 9036
## SignalingTypeFP:ResourceSpeedslow:withSocInfo1:SocPosInFOV 0.50 0.07 0.37 0.64 1.00 9395 9390
## 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.01 0.50 -0.99 0.99 1.00 26943 8111
## SignalingTypeNP:ResourceSpeedfast:withSocInfo1:SocMovDir 0.11 0.04 0.04 0.18 1.00 1929 5102
## SignalingTypeVP:ResourceSpeedfast:withSocInfo1:SocMovDir 0.17 0.03 0.11 0.23 1.00 3185 6882
## SignalingTypeFP:ResourceSpeedfast:withSocInfo1:SocMovDir 0.44 0.04 0.37 0.51 1.00 3630 6117
## SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocMovDir 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeNP:ResourceSpeedslow:withSocInfo1:SocMovDir 0.26 0.05 0.17 0.35 1.00 6869 8845
## SignalingTypeVP:ResourceSpeedslow:withSocInfo1:SocMovDir 0.34 0.05 0.25 0.44 1.00 8222 8685
## SignalingTypeFP:ResourceSpeedslow:withSocInfo1:SocMovDir 0.35 0.06 0.23 0.46 1.00 8596 9945
## 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.07 0.03 0.00 0.13 1.00 4214 7941
## SignalingTypeVP:ResourceSpeedfast:withSocInfo1:SocPosInFOV:SocQual 0.23 0.03 0.17 0.29 1.00 5144 7947
## SignalingTypeFP:ResourceSpeedfast:withSocInfo1:SocPosInFOV:SocQual 0.48 0.03 0.41 0.54 1.00 6255 8246
## SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocPosInFOV:SocQual 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeNP:ResourceSpeedslow:withSocInfo1:SocPosInFOV:SocQual 0.26 0.05 0.17 0.35 1.00 9796 9217
## SignalingTypeVP:ResourceSpeedslow:withSocInfo1:SocPosInFOV:SocQual 0.39 0.05 0.30 0.49 1.00 11144 9049
## SignalingTypeFP:ResourceSpeedslow:withSocInfo1:SocPosInFOV:SocQual 0.41 0.06 0.30 0.53 1.00 11604 9740
## 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.03 -0.07 0.05 1.00 4046 7211
## SignalingTypeVP:ResourceSpeedfast:withSocInfo1:SocMovDir:SocQual 0.02 0.03 -0.03 0.07 1.00 5742 7718
## SignalingTypeFP:ResourceSpeedfast:withSocInfo1:SocMovDir:SocQual 0.24 0.03 0.18 0.30 1.00 6389 8751
## SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocMovDir:SocQual 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeNP:ResourceSpeedslow:withSocInfo1:SocMovDir:SocQual 0.10 0.04 0.02 0.18 1.00 11206 8450
## SignalingTypeVP:ResourceSpeedslow:withSocInfo1:SocMovDir:SocQual 0.09 0.04 0.00 0.18 1.00 10176 10158
## SignalingTypeFP:ResourceSpeedslow:withSocInfo1:SocMovDir:SocQual 0.15 0.06 0.04 0.26 1.00 11595 8941
##
## 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.search.1.yrep <- posterior_predict(m.RotationMagnitude.search.1.fit, draws = 10)![]()
ppc_dens_overlay_grouped(m.RotationMagnitude.search.1.y,
m.RotationMagnitude.search.1.yrep[1:100, ],
group = m.RotationMagnitude.search.data$ResourceSpeed
)![]()
ppc_dens_overlay_grouped(m.RotationMagnitude.search.1.y,
m.RotationMagnitude.search.1.yrep[1:100, ],
group = m.RotationMagnitude.search.data$SignalingType
)![]()
group <- m.RotationMagnitude.search.data$SignalingType
mask <- m.RotationMagnitude.search.data$ResourceSpeed == "fast"
ppc_dens_overlay_grouped(m.RotationMagnitude.search.1.y[mask],
m.RotationMagnitude.search.1.yrep[1:50, mask],
group = group[mask]
)![]()
group <- m.RotationMagnitude.search.data$SignalingType
mask <- m.RotationMagnitude.search.data$ResourceSpeed == "slow"
ppc_dens_overlay_grouped(m.RotationMagnitude.search.1.y[mask],
m.RotationMagnitude.search.1.yrep[1:50, mask],
group = group[mask]
)![]()
Model predictions
m.RotationMagnitude.search.1.tidy_draws <- m.RotationMagnitude.search.1.fit %>%
tidy_draws() %>%
gather_variables() %>%
filter(grepl("b_Signaling", .variable) | grepl("b_Resource", .variable) | grepl("b_Intercept", .variable))m.RotationMagnitude.search.1.tidy_draws2 <- m.RotationMagnitude.search.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"
), 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(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, ":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(
"Position",
"Movement",
"Position x Quality",
"Movement x Quality"
)))
head(m.RotationMagnitude.search.1.tidy_draws2)rotation_magnitude_searching_fig <- m.RotationMagnitude.search.1.tidy_draws2 %>%
filter(!is.na(resource), !is.na(weight)) %>%
ggplot(aes(y = signaling, x = .value, color = signaling, fill = signaling)) +
stat_halfeye(alpha = 0.5) +
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 = "Signaling"),
) +
theme_nice(legend.pos = "bottom") +
xlim(-0.2, NA) +
facet_grid(cols = vars(weight), rows = vars(resource), axes = "all", axis.labels = "all_x", switch = "y") +
labs(x = "Posterior Parameter Estimate", y = "")
rotation_magnitude_searching_fig![]()
rotation_magnitude_searching_fig <- m.RotationMagnitude.search.1.tidy_draws2 %>%
filter(!is.na(resource), !is.na(weight)) %>%
ggplot(aes(
y = signaling, x = .value, color = signaling, fill = signaling, shape = resource,
group = interaction(signaling, resource)
)) +
stat_pointinterval(alpha = 1, .width = 0.9, position = position_dodge(width = .55), point_size = 3) +
geom_vline(xintercept = 0, linetype = "dashed") +
scale_y_discrete(limits = rev) +
scale_color_manual(
breaks = c("A", "NP", "VP", "FP"),
aesthetics = c("colour", "fill"),
values = c("#000000", "#DF536B", "#61D04F", "#2297E6"),
guide = guide_legend(title = "Signaling"),
) +
scale_x_continuous(
limits = c(-0.1, 0.6),
breaks = c(-0.1, 0.2, 0.4, 0.6),
expand = expansion(mult = c(0.02, 0.04)) # tiny margin left/right
) +
theme_clean() +
theme(legend.position = "none") +
panel_border() +
facet_wrap(vars(weight), ncol = 1) +
labs(x = "Posterior parameter estimate", y = "")
rotation_magnitude_searching_fig![]()
Random Effects
Model Tracking Time
m.RotationMagnitude.search.1.re.soc_pos.formula <- brmsformula(
TrackingTime_0_1 ~ SignalingType * ResourceSpeed + SignalingType:ResourceSpeed:SocInfoPos_r_eff,
phi ~ ResourceSpeed + SignalingType,
family = Beta()
)
m.RotationMagnitude.search.1.re.soc_pos_qual.formula <- brmsformula(
TrackingTime_0_1 ~ SignalingType * ResourceSpeed + SignalingType:ResourceSpeed:SocInfoQualityPos_r_eff,
phi ~ ResourceSpeed + SignalingType,
family = Beta()
)
m.RotationMagnitude.search.1.re.soc_mov.formula <- brmsformula(
TrackingTime_0_1 ~ SignalingType * ResourceSpeed + SignalingType:ResourceSpeed:SocInfoMov_r_eff,
phi ~ ResourceSpeed + SignalingType,
family = Beta()
)
m.RotationMagnitude.search.1.re.soc_mov_qual.formula <- brmsformula(
TrackingTime_0_1 ~ SignalingType * ResourceSpeed + SignalingType:ResourceSpeed:SocInfoQualityMov_r_eff,
phi ~ ResourceSpeed + SignalingType,
family = Beta()
)
m.RotationMagnitude.search.1.re.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.search.1.re.soc_pos.fit <- brm(
formula = m.RotationMagnitude.search.1.re.soc_pos.formula,
data = m.RotationMagnitude.search.1.re.data %>% filter(SignalingType != "A"),
prior = m.RotationMagnitude.search.1.re.priors,
chains = 4,
cores = 4,
seed = 42,
iter = 2000,
file = paste0(fits_path, "rotation_magnitude_searching_1_random_effects_soc_pos.rds"),
backend = "cmdstanr",
threads = threading(100),
save_pars = save_pars(all = TRUE)
)
m.RotationMagnitude.search.1.re.soc_pos_qual.fit <- brm(
formula = m.RotationMagnitude.search.1.re.soc_pos_qual.formula,
data = m.RotationMagnitude.search.1.re.data %>% filter(SignalingType != "A"),
prior = m.RotationMagnitude.search.1.re.priors,
chains = 4,
cores = 4,
seed = 42,
iter = 2000,
file = paste0(fits_path, "rotation_magnitude_searching_1_random_effects_soc_pos_qual.rds"),
backend = "cmdstanr",
threads = threading(100),
save_pars = save_pars(all = TRUE)
)
m.RotationMagnitude.search.1.re.soc_mov.fit <- brm(
formula = m.RotationMagnitude.search.1.re.soc_mov.formula,
data = m.RotationMagnitude.search.1.re.data %>% filter(SignalingType != "A"),
prior = m.RotationMagnitude.search.1.re.priors,
chains = 4,
cores = 4,
seed = 42,
iter = 2000,
file = paste0(fits_path, "rotation_magnitude_searching_1_random_effects_soc_mov.rds"),
backend = "cmdstanr",
threads = threading(100),
save_pars = save_pars(all = TRUE)
)
m.RotationMagnitude.search.1.re.soc_mov_qual.fit <- brm(
formula = m.RotationMagnitude.search.1.re.soc_mov_qual.formula,
data = m.RotationMagnitude.search.1.re.data %>% filter(SignalingType != "A"),
prior = m.RotationMagnitude.search.1.re.priors,
chains = 4,
cores = 4,
seed = 42,
iter = 2000,
file = paste0(fits_path, "rotation_magnitude_searching_1_random_effects_soc_mov_qual.rds"),
backend = "cmdstanr",
threads = threading(100),
save_pars = save_pars(all = TRUE)
)m.RotationMagnitude.search.1.re.tidy_draws <- bind_rows(
m.RotationMagnitude.search.1.re.soc_pos.fit %>%
tidy_draws() %>%
gather_variables() %>%
filter(grepl("SignalingType", .variable) | grepl("ResourceSpeed", .variable) | grepl("b_Intercept", .variable)),
m.RotationMagnitude.search.1.re.soc_pos_qual.fit %>%
tidy_draws() %>%
gather_variables() %>%
filter(grepl("SignalingType", .variable) | grepl("ResourceSpeed", .variable) | grepl("b_Intercept", .variable)),
m.RotationMagnitude.search.1.re.soc_mov.fit %>%
tidy_draws() %>%
gather_variables() %>%
filter(grepl("SignalingType", .variable) | grepl("ResourceSpeed", .variable) | grepl("b_Intercept", .variable)),
m.RotationMagnitude.search.1.re.soc_mov_qual.fit %>%
tidy_draws() %>%
gather_variables() %>%
filter(grepl("SignalingType", .variable) | grepl("ResourceSpeed", .variable) | grepl("b_Intercept", .variable))
)m.RotationMagnitude.search.1.re.tidy_draws2 <- m.RotationMagnitude.search.1.re.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, ":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",
"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.search.1.re.tidy_draws2, 50)rotation_magnitude_searching_random_effects_tracking_time_fig <- m.RotationMagnitude.search.1.re.tidy_draws2 %>%
filter(!is.na(resource), !is.na(weight)) %>%
mutate(weight = factor(weight, levels = c(
"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 = "Signaling"),
) +
theme_nice(legend.pos = "bottom") +
# 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 = "") # , title = "Tracking Time ~ random effects"
rotation_magnitude_searching_random_effects_tracking_time_fig![]()
Random Effects Correlations
mcmc_areas(
m.RotationMagnitude.search.1.df_fit %>% dplyr::select(
starts_with("cor_"),
-contains("withSocInfo0"),
) %>%
rename(
`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(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, Position)`,
`cor(Intercept, Movement)`,
`cor(Intercept, Position x Quality)`,
`cor(Intercept, 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 (SEARCH)
m.RotationMagnitude.search.1.r_effs_long <- m.RotationMagnitude.search.1.fit %>%
spread_draws(r_Participant[Participant, term]) %>%
# Filter for relevant social features from the search model
filter(term %in% c(
"withSocInfo1:SocPosInFOV",
"withSocInfo1:SocMovDir",
"withSocInfo1:SocPosInFOV:SocQual",
"withSocInfo1:SocMovDir:SocQual"
)) %>%
# Map to human-readable names
mutate(term_label = case_when(
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(
"Position", "Movement", "Position x Quality", "Movement x Quality"
)))
# 2. Summarize draws and merge with condition metadata & tracking efficiency (Tracking Time)
m.RotationMagnitude.search.1.r_effs_data_plot <- m.RotationMagnitude.search.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, TrackingTime), by = "Participant") %>%
# Coloring logic: black if interval does not overlap with 0, gray otherwise
mutate(hpdi_overlaps_0 = factor(ifelse(lower > 0 | upper < 0, "No", "Yes"),
levels = c("Yes", "No") # Wait, checking user script consistency
)) %>%
# Wait, the user script said: ifelse(lower > 0 | upper < 0, "Yes", "No")
# but their naming implies "Yes" = overlaps.
# Actually their script: ifelse(lower > 0 | upper < 0, "Yes", "No")
# and scale: values = c("No" = "gray75", "Yes" = "black")
# So I will follow their provided snippet exactly.
mutate(hpdi_overlaps_0 = factor(ifelse(lower > 0 | upper < 0, "Yes", "No"),
levels = c("No", "Yes")
))
# 3. Sort participants by tracking time (TrackingTime) within each condition
m.RotationMagnitude.search.1.r_effs_order <- m.RotationMagnitude.search.1.r_effs_data_plot %>%
filter(term_label == "Position") %>%
arrange(SignalingType, ResourceSpeed, TrackingTime) %>%
mutate(sort_rank = row_number()) %>%
select(Participant, sort_rank)
m.RotationMagnitude.search.1.r_effs_data_plot <- m.RotationMagnitude.search.1.r_effs_data_plot %>%
left_join(m.RotationMagnitude.search.1.r_effs_order, by = "Participant") %>%
mutate(Participant = reorder(Participant, sort_rank))# 4. Generate the grouped Caterpillar plot for SEARCH
m.RotationMagnitude.search.1.social_strategy_caterpillar <- m.RotationMagnitude.search.1.r_effs_data_plot %>%
filter(SignalingType != "A") %>%
ggplot(aes(y = Participant, x = mean_val, color = hpdi_overlaps_0)) + # TrackingTime
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 Time, high=top)"
)
m.RotationMagnitude.search.1.social_strategy_caterpillar![]()
Model 2: Temporal Dynamics
m.RotationMagnitude.search.temporal.data <- m.RotationMagnitude.search.data %>%
mutate(Epoch = factor(ifelse(Time <= 440, "First Half", "Second Half"), levels = c("First Half", "Second Half")))m.RotationMagnitude.search.temporal.formula <- brmsformula(
RotationAbs | trunc(ub = 1.02) ~ SignalingType * ResourceSpeed * Epoch +
SignalingType:ResourceSpeed:withSocInfo:SocPosInFOV +
SignalingType:ResourceSpeed:withSocInfo:SocMovDir +
SignalingType:ResourceSpeed:withSocInfo:SocQual:SocPosInFOV +
SignalingType:ResourceSpeed:withSocInfo:SocQual:SocMovDir +
SignalingType:ResourceSpeed:Epoch:withSocInfo:SocPosInFOV +
SignalingType:ResourceSpeed:Epoch:withSocInfo:SocMovDir +
SignalingType:ResourceSpeed:Epoch:withSocInfo:SocQual:SocPosInFOV +
SignalingType:ResourceSpeed:Epoch:withSocInfo:SocQual:SocMovDir +
(1 + withSocInfo:SocPosInFOV + withSocInfo:SocMovDir + withSocInfo:SocQual:SocPosInFOV + withSocInfo:SocQual:SocMovDir | Participant),
family = exponential()
)m.RotationMagnitude.search.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") +
# 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") +
# 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") +
# 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:SocMovDir")m.RotationMagnitude.search.temporal.fit <- brm(
formula = m.RotationMagnitude.search.temporal.formula,
data = m.RotationMagnitude.search.temporal.data,
prior = m.RotationMagnitude.search.temporal.priors,
chains = 4,
cores = 4,
seed = 4242,
warmup = 1000,
iter = 2000,
file = paste0(fits_path, "rotation_magnitude_search_temporal.rds"),
backend = "cmdstanr",
threads = threading(100),
save_pars = save_pars(all = FALSE)
)## Family: exponential
## Links: mu = log
## Formula: RotationAbs | trunc(ub = 1.02) ~ SignalingType * ResourceSpeed * Epoch + SignalingType:ResourceSpeed:withSocInfo:SocPosInFOV + SignalingType:ResourceSpeed:withSocInfo:SocMovDir + SignalingType:ResourceSpeed:withSocInfo:SocQual:SocPosInFOV + SignalingType:ResourceSpeed:withSocInfo:SocQual:SocMovDir + SignalingType:ResourceSpeed:Epoch:withSocInfo:SocPosInFOV + SignalingType:ResourceSpeed:Epoch:withSocInfo:SocMovDir + SignalingType:ResourceSpeed:Epoch:withSocInfo:SocQual:SocPosInFOV + SignalingType:ResourceSpeed:Epoch:withSocInfo:SocQual:SocMovDir + (1 + withSocInfo:SocPosInFOV + withSocInfo:SocMovDir + withSocInfo:SocQual:SocPosInFOV + withSocInfo:SocQual:SocMovDir | Participant)
## Data: m.RotationMagnitude.search.temporal.data (Number of observations: 242142)
## Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
## total post-warmup draws = 4000
##
## Multilevel Hyperparameters:
## ~Participant (Number of levels: 603)
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sd(Intercept) 0.52 0.02 0.49 0.55 1.00 540 1031
## sd(withSocInfo0:SocPosInFOV) 0.00 0.00 0.00 0.00 NA NA NA
## sd(withSocInfo1:SocPosInFOV) 0.35 0.02 0.31 0.38 1.00 2012 2990
## sd(withSocInfo0:SocMovDir) 0.00 0.00 0.00 0.00 NA NA NA
## sd(withSocInfo1:SocMovDir) 0.27 0.02 0.24 0.30 1.00 1952 2669
## 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 2121 2803
## sd(withSocInfo0:SocMovDir:SocQual) 0.00 0.00 0.00 0.00 NA NA NA
## sd(withSocInfo1:SocMovDir:SocQual) 0.23 0.01 0.20 0.26 1.00 2432 3067
## cor(Intercept,withSocInfo0:SocPosInFOV) 0.00 0.31 -0.60 0.61 1.00 10259 2552
## cor(Intercept,withSocInfo1:SocPosInFOV) 0.23 0.06 0.10 0.35 1.00 2288 2534
## cor(withSocInfo0:SocPosInFOV,withSocInfo1:SocPosInFOV) 0.02 0.29 -0.59 0.54 1.14 23 55
## cor(Intercept,withSocInfo0:SocMovDir) -0.00 0.31 -0.60 0.61 1.00 9796 2782
## cor(withSocInfo0:SocPosInFOV,withSocInfo0:SocMovDir) 0.00 0.31 -0.60 0.61 1.00 6274 2339
## cor(withSocInfo1:SocPosInFOV,withSocInfo0:SocMovDir) 0.01 0.31 -0.60 0.61 1.00 11115 2971
## cor(Intercept,withSocInfo1:SocMovDir) 0.47 0.06 0.35 0.58 1.00 2459 3102
## cor(withSocInfo0:SocPosInFOV,withSocInfo1:SocMovDir) 0.02 0.30 -0.53 0.59 1.02 98 340
## cor(withSocInfo1:SocPosInFOV,withSocInfo1:SocMovDir) 0.02 0.07 -0.12 0.16 1.00 2609 3170
## cor(withSocInfo0:SocMovDir,withSocInfo1:SocMovDir) -0.03 0.32 -0.59 0.59 1.05 69 310
## cor(Intercept,withSocInfo0:SocPosInFOV:SocQual) 0.00 0.32 -0.60 0.62 1.00 12908 2404
## cor(withSocInfo0:SocPosInFOV,withSocInfo0:SocPosInFOV:SocQual) -0.00 0.31 -0.60 0.61 1.00 6814 2447
## cor(withSocInfo1:SocPosInFOV,withSocInfo0:SocPosInFOV:SocQual) 0.00 0.31 -0.57 0.60 1.00 9742 2765
## cor(withSocInfo0:SocMovDir,withSocInfo0:SocPosInFOV:SocQual) 0.01 0.31 -0.59 0.58 1.00 4009 3027
## cor(withSocInfo1:SocMovDir,withSocInfo0:SocPosInFOV:SocQual) -0.00 0.32 -0.61 0.60 1.00 9847 2514
## cor(Intercept,withSocInfo1:SocPosInFOV:SocQual) 0.31 0.07 0.17 0.44 1.00 3577 3156
## cor(withSocInfo0:SocPosInFOV,withSocInfo1:SocPosInFOV:SocQual) 0.04 0.30 -0.56 0.58 1.05 59 246
## cor(withSocInfo1:SocPosInFOV,withSocInfo1:SocPosInFOV:SocQual) 0.42 0.06 0.30 0.53 1.00 2548 3321
## cor(withSocInfo0:SocMovDir,withSocInfo1:SocPosInFOV:SocQual) 0.04 0.31 -0.53 0.62 1.05 73 415
## cor(withSocInfo1:SocMovDir,withSocInfo1:SocPosInFOV:SocQual) -0.01 0.08 -0.16 0.14 1.00 2582 3318
## cor(withSocInfo0:SocPosInFOV:SocQual,withSocInfo1:SocPosInFOV:SocQual) -0.05 0.30 -0.63 0.53 1.03 128 347
## cor(Intercept,withSocInfo0:SocMovDir:SocQual) 0.00 0.32 -0.61 0.61 1.00 13803 2441
## cor(withSocInfo0:SocPosInFOV,withSocInfo0:SocMovDir:SocQual) -0.00 0.32 -0.60 0.59 1.00 6203 3019
## cor(withSocInfo1:SocPosInFOV,withSocInfo0:SocMovDir:SocQual) -0.00 0.32 -0.61 0.61 1.00 10423 2399
## cor(withSocInfo0:SocMovDir,withSocInfo0:SocMovDir:SocQual) 0.00 0.32 -0.60 0.61 1.00 3457 2560
## cor(withSocInfo1:SocMovDir,withSocInfo0:SocMovDir:SocQual) 0.00 0.32 -0.60 0.62 1.00 13493 2499
## cor(withSocInfo0:SocPosInFOV:SocQual,withSocInfo0:SocMovDir:SocQual) -0.01 0.32 -0.60 0.61 1.00 2004 2796
## cor(withSocInfo1:SocPosInFOV:SocQual,withSocInfo0:SocMovDir:SocQual) -0.01 0.32 -0.61 0.60 1.00 9694 2892
## cor(Intercept,withSocInfo1:SocMovDir:SocQual) 0.34 0.07 0.19 0.47 1.00 2708 2926
## cor(withSocInfo0:SocPosInFOV,withSocInfo1:SocMovDir:SocQual) 0.02 0.29 -0.57 0.56 1.03 84 258
## cor(withSocInfo1:SocPosInFOV,withSocInfo1:SocMovDir:SocQual) -0.18 0.07 -0.31 -0.04 1.00 3202 3251
## cor(withSocInfo0:SocMovDir,withSocInfo1:SocMovDir:SocQual) -0.06 0.32 -0.62 0.59 1.03 104 140
## cor(withSocInfo1:SocMovDir,withSocInfo1:SocMovDir:SocQual) 0.70 0.05 0.60 0.78 1.00 2173 3009
## cor(withSocInfo0:SocPosInFOV:SocQual,withSocInfo1:SocMovDir:SocQual) -0.01 0.32 -0.64 0.59 1.01 217 653
## cor(withSocInfo1:SocPosInFOV:SocQual,withSocInfo1:SocMovDir:SocQual) -0.07 0.08 -0.22 0.08 1.00 2737 3184
## cor(withSocInfo0:SocMovDir:SocQual,withSocInfo1:SocMovDir:SocQual) 0.00 0.32 -0.60 0.61 1.02 261 1499
##
## Regression Coefficients:
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## Intercept -1.57 0.06 -1.68 -1.45 1.04 169 446
## SignalingTypeNP -0.05 0.08 -0.21 0.12 1.03 189 365
## SignalingTypeVP 0.04 0.08 -0.12 0.19 1.02 188 441
## SignalingTypeFP 0.47 0.08 0.30 0.62 1.03 195 375
## ResourceSpeedslow 0.12 0.08 -0.05 0.29 1.02 243 466
## EpochSecondHalf -0.18 0.01 -0.20 -0.16 1.00 3307 3310
## SignalingTypeNP:ResourceSpeedslow 0.20 0.12 -0.03 0.42 1.01 253 520
## SignalingTypeVP:ResourceSpeedslow 0.35 0.12 0.13 0.59 1.01 282 609
## SignalingTypeFP:ResourceSpeedslow -0.10 0.12 -0.33 0.14 1.02 348 764
## SignalingTypeNP:EpochSecondHalf 0.20 0.02 0.17 0.23 1.00 3849 3491
## SignalingTypeVP:EpochSecondHalf 0.23 0.02 0.20 0.26 1.00 3985 3360
## SignalingTypeFP:EpochSecondHalf 0.27 0.02 0.23 0.30 1.00 4053 3342
## ResourceSpeedslow:EpochSecondHalf 0.08 0.02 0.04 0.12 1.00 3485 2871
## SignalingTypeNP:ResourceSpeedslow:EpochSecondHalf 0.03 0.03 -0.04 0.09 1.00 4261 3081
## SignalingTypeVP:ResourceSpeedslow:EpochSecondHalf -0.17 0.04 -0.25 -0.10 1.00 4523 3469
## SignalingTypeFP:ResourceSpeedslow:EpochSecondHalf -0.10 0.04 -0.17 -0.02 1.00 4787 3184
## 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.05 0.07 0.26 1.00 1613 2524
## SignalingTypeVP:ResourceSpeedfast:withSocInfo1:SocPosInFOV 0.33 0.04 0.24 0.41 1.00 1580 2366
## SignalingTypeFP:ResourceSpeedfast:withSocInfo1:SocPosInFOV 0.45 0.05 0.36 0.55 1.00 2087 3057
## SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocPosInFOV -0.00 0.51 -1.04 1.02 1.00 12353 2617
## SignalingTypeNP:ResourceSpeedslow:withSocInfo1:SocPosInFOV 0.54 0.06 0.42 0.67 1.00 3054 3222
## SignalingTypeVP:ResourceSpeedslow:withSocInfo1:SocPosInFOV 0.59 0.07 0.45 0.72 1.00 3635 2783
## SignalingTypeFP:ResourceSpeedslow:withSocInfo1:SocPosInFOV 0.45 0.08 0.30 0.60 1.00 3345 2869
## 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 -0.99 0.98 1.00 12054 3018
## SignalingTypeNP:ResourceSpeedfast:withSocInfo1:SocMovDir 0.13 0.04 0.06 0.21 1.00 1337 2364
## SignalingTypeVP:ResourceSpeedfast:withSocInfo1:SocMovDir 0.12 0.04 0.05 0.19 1.00 893 2078
## SignalingTypeFP:ResourceSpeedfast:withSocInfo1:SocMovDir 0.40 0.04 0.31 0.48 1.00 1381 2313
## SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocMovDir 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeNP:ResourceSpeedslow:withSocInfo1:SocMovDir 0.15 0.05 0.04 0.25 1.00 3009 3221
## SignalingTypeVP:ResourceSpeedslow:withSocInfo1:SocMovDir 0.40 0.06 0.28 0.52 1.00 3332 3324
## SignalingTypeFP:ResourceSpeedslow:withSocInfo1:SocMovDir 0.44 0.07 0.31 0.58 1.00 2802 2979
## 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.04 -0.03 0.12 1.00 1985 2753
## SignalingTypeVP:ResourceSpeedfast:withSocInfo1:SocPosInFOV:SocQual 0.17 0.03 0.11 0.24 1.00 1915 2429
## SignalingTypeFP:ResourceSpeedfast:withSocInfo1:SocPosInFOV:SocQual 0.41 0.04 0.33 0.48 1.00 2518 3030
## SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocPosInFOV:SocQual 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeNP:ResourceSpeedslow:withSocInfo1:SocPosInFOV:SocQual 0.30 0.05 0.19 0.40 1.00 3924 2891
## SignalingTypeVP:ResourceSpeedslow:withSocInfo1:SocPosInFOV:SocQual 0.33 0.06 0.21 0.45 1.00 3858 2779
## SignalingTypeFP:ResourceSpeedslow:withSocInfo1:SocPosInFOV:SocQual 0.46 0.07 0.32 0.59 1.00 4353 3245
## 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.04 -0.07 0.06 1.00 2407 3316
## SignalingTypeVP:ResourceSpeedfast:withSocInfo1:SocMovDir:SocQual 0.02 0.03 -0.04 0.08 1.00 1815 2661
## SignalingTypeFP:ResourceSpeedfast:withSocInfo1:SocMovDir:SocQual 0.23 0.04 0.15 0.30 1.00 1927 2259
## SignalingTypeA:ResourceSpeedslow:withSocInfo1:SocMovDir:SocQual 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeNP:ResourceSpeedslow:withSocInfo1:SocMovDir:SocQual 0.03 0.05 -0.07 0.13 1.00 3807 3188
## SignalingTypeVP:ResourceSpeedslow:withSocInfo1:SocMovDir:SocQual -0.06 0.06 -0.18 0.05 1.00 3977 3038
## SignalingTypeFP:ResourceSpeedslow:withSocInfo1:SocMovDir:SocQual 0.08 0.06 -0.04 0.21 1.00 3634 3206
## 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.14 0.03 0.08 0.21 1.00 5457 3478
## SignalingTypeVP:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocPosInFOV 0.07 0.03 0.02 0.13 1.00 6694 3230
## SignalingTypeFP:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocPosInFOV 0.15 0.04 0.08 0.22 1.00 5834 3411
## SignalingTypeA:ResourceSpeedslow:EpochSecondHalf:withSocInfo1:SocPosInFOV 0.01 0.50 -0.95 1.01 1.00 10191 3081
## SignalingTypeNP:ResourceSpeedslow:EpochSecondHalf:withSocInfo1:SocPosInFOV -0.08 0.05 -0.19 0.01 1.00 7961 3294
## SignalingTypeVP:ResourceSpeedslow:EpochSecondHalf:withSocInfo1:SocPosInFOV -0.03 0.07 -0.17 0.12 1.00 5871 3243
## SignalingTypeFP:ResourceSpeedslow:EpochSecondHalf:withSocInfo1:SocPosInFOV 0.11 0.07 -0.03 0.26 1.00 6280 3361
## 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.49 -0.96 0.99 1.00 12456 2783
## SignalingTypeNP:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocMovDir -0.06 0.03 -0.12 0.00 1.00 5804 3569
## SignalingTypeVP:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocMovDir 0.10 0.03 0.05 0.16 1.00 6078 2966
## SignalingTypeFP:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocMovDir 0.09 0.04 0.02 0.16 1.00 6016 2965
## SignalingTypeA:ResourceSpeedslow:EpochSecondHalf:withSocInfo1:SocMovDir 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeNP:ResourceSpeedslow:EpochSecondHalf:withSocInfo1:SocMovDir 0.24 0.05 0.14 0.34 1.00 6985 3214
## SignalingTypeVP:ResourceSpeedslow:EpochSecondHalf:withSocInfo1:SocMovDir -0.09 0.07 -0.22 0.04 1.00 6597 3491
## SignalingTypeFP:ResourceSpeedslow:EpochSecondHalf:withSocInfo1:SocMovDir -0.18 0.07 -0.32 -0.04 1.00 6132 3092
## SignalingTypeA:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocPosInFOV:SocQual 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeNP:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocPosInFOV:SocQual 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeVP:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocPosInFOV:SocQual 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeFP:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocPosInFOV:SocQual 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeA:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocPosInFOV:SocQual 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeNP:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocPosInFOV:SocQual 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeVP:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocPosInFOV:SocQual 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeFP:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocPosInFOV:SocQual 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeA:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocPosInFOV:SocQual 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeNP:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocPosInFOV:SocQual 0.04 0.03 -0.03 0.10 1.00 5311 3425
## SignalingTypeVP:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocPosInFOV:SocQual 0.10 0.03 0.04 0.15 1.00 6766 3185
## SignalingTypeFP:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocPosInFOV:SocQual 0.16 0.04 0.09 0.23 1.00 6279 3266
## SignalingTypeA:ResourceSpeedslow:EpochSecondHalf:withSocInfo1:SocPosInFOV:SocQual 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeNP:ResourceSpeedslow:EpochSecondHalf:withSocInfo1:SocPosInFOV:SocQual -0.07 0.05 -0.17 0.03 1.00 7393 3183
## SignalingTypeVP:ResourceSpeedslow:EpochSecondHalf:withSocInfo1:SocPosInFOV:SocQual 0.13 0.07 -0.02 0.27 1.00 5280 3064
## SignalingTypeFP:ResourceSpeedslow:EpochSecondHalf:withSocInfo1:SocPosInFOV:SocQual -0.08 0.07 -0.22 0.06 1.00 6597 3491
## SignalingTypeA:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocMovDir:SocQual 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeNP:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocMovDir:SocQual 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeVP:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocMovDir:SocQual 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeFP:ResourceSpeedfast:EpochSecondHalf:withSocInfo0:SocMovDir:SocQual 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeA:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocMovDir:SocQual 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeNP:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocMovDir:SocQual 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeVP:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocMovDir:SocQual 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeFP:ResourceSpeedslow:EpochSecondHalf:withSocInfo0:SocMovDir:SocQual 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeA:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocMovDir:SocQual 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeNP:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocMovDir:SocQual -0.00 0.03 -0.07 0.06 1.00 6119 3105
## SignalingTypeVP:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocMovDir:SocQual -0.00 0.03 -0.06 0.06 1.00 6336 3527
## SignalingTypeFP:ResourceSpeedfast:EpochSecondHalf:withSocInfo1:SocMovDir:SocQual 0.04 0.04 -0.03 0.11 1.00 5707 2738
## SignalingTypeA:ResourceSpeedslow:EpochSecondHalf:withSocInfo1:SocMovDir:SocQual 0.00 0.00 0.00 0.00 NA NA NA
## SignalingTypeNP:ResourceSpeedslow:EpochSecondHalf:withSocInfo1:SocMovDir:SocQual 0.17 0.05 0.06 0.27 1.00 7786 3250
## [ reached 'max' / getOption("max.print") -- omitted 2 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.search.temporal.tidy_draws <- m.RotationMagnitude.search.temporal.fit %>%
tidy_draws() %>%
gather_variables() %>%
filter(grepl("b_SignalingType", .variable) & grepl("Epoch", .variable)) %>%
filter(!grepl("Intercept", .variable) & grepl(":Epoch", .variable))
m.RotationMagnitude.search.temporal.tidy_draws2 <- m.RotationMagnitude.search.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, ":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("Position", "Movement", "Position x Quality", "Movement x Quality"))) %>%
filter(!is.na(weight))![]()
Temporal Condition Comparisons
m.RotationMagnitude.search.temporal.base_draws <- m.RotationMagnitude.search.temporal.fit %>%
tidy_draws() %>%
gather_variables() %>%
filter(grepl("EpochSecondHalf", .variable) & !grepl("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.search.temporal.base_summary <- m.RotationMagnitude.search.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.search.temporal.weights_summary <- m.RotationMagnitude.search.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()# Arranging Table for Readability
m.RotationMagnitude.search.temporal.combined_table <- bind_rows(
m.RotationMagnitude.search.temporal.base_summary,
m.RotationMagnitude.search.temporal.weights_summary
) %>%
filter(!(.value == 0 & .lower == 0 & .upper == 0)) %>%
# Create sort factors
mutate(
weight_order = factor(weight, levels = c(
".", "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(
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.search.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) - Search",
escape = FALSE
) %>%
kable_styling(latex_options = c("hold_position", "scale_down")) %>%
row_spec(0, bold = TRUE)
# Group rows by Resource Speed
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_search_temporal_comparison_combined.tex"))