Now let’s take a look at the model parameters and see what they tell us about how participants search across domains
Gaussian Process
#Compile the plotting dataframes
k<- 'RBF'
a<- "UCB"
conceptualDF<- subset(paramEstimates, kernel==k & acq==a & context=="Conceptual")
conceptualParams <- ddply(conceptualDF, ~participant+environment+contextOrder, plyr::summarize, Conceptuallambda=mean(lambda), Conceptualbeta = mean(beta), Conceptualtau = mean(tau))
gridDF<- subset(paramEstimates, kernel==k & acq==a & context == "Spatial")
gridParams <- ddply(gridDF, ~participant+environment+contextOrder, plyr::summarize, Spatiallambda=mean(lambda), Spatialbeta = mean(beta), Spatialtau = mean(tau))
corDF <- merge(conceptualParams, gridParams, by=c("participant", "environment", "contextOrder"))
corDF$environment <- factor(corDF$environment, levels=c("Rough", "Smooth"))
#LAMBDA
#Max axis value using Tukey's outlier removal critereon (for the larger of the two axes)
uppertquartiles <- c(quantile(corDF$Conceptuallambda, probs=c(.25, .75))[2], quantile(corDF$Spatiallambda, probs=c(.25, .75))[2]) #upper quartiles
H <- c(1.5 * IQR(corDF$Conceptuallambda, na.rm = T), 1.5 * IQR(corDF$Spatiallambda, na.rm = T))
upperLimitLambda <- max(uppertquartiles + H) #use the larger 1.5 * IQR from the upper quartile to set axis limits
p4a <- ggplot(subset(corDF,Conceptuallambda <= upperLimitLambda & Spatiallambda<= upperLimitLambda), aes(Conceptuallambda, Spatiallambda)) +
geom_abline(slope = 1, intercept=0, color = 'black', linetype = 'dashed')+
geom_point(aes(color=environment, shape=environment), size =3, alpha=0.9)+ #environment
expand_limits(x = 0, y = 0) +
xlab(expression("Conceptual "*lambda))+
ylab(expression("Spatial "*lambda)) +
scale_x_continuous(limits=c(0,upperLimitLambda)) +
scale_y_continuous(limits=c(0,upperLimitLambda)) +
theme_classic()+
scale_color_manual(name="", values=c("#24325FFF", '#B7E4F9FF'))+ #environment
scale_shape_manual(name="", values= c(17,16))+
ggtitle('Generalization')+
#theme(text = element_text(size=16, family="sans"), plot.title = element_text(size=16))+
theme(title = element_text(family = 'sans'), legend.position='none',
legend.background = element_rect(fill='transparent'))
p4a <- ggExtra::ggMarginal(p4a, type = "boxplot", fill='transparent', size = 10, outlier.shape = NA) #add marginal boxplots
#BETA
#Upper limits
uppertquartiles <- c(quantile(corDF$Conceptualbeta, probs=c(.25, .75))[2], quantile(corDF$Spatialbeta, probs=c(.25, .75))[2]) #upper quartiles
H <- c(1.5 * IQR(corDF$Conceptualbeta, na.rm = T), 1.5 * IQR(corDF$Spatialbeta, na.rm = T))
upperLimitBeta <- max(uppertquartiles + H) #use the larger 1.5 * IQR from the upper quartile to set axis limits
p4b <- ggplot(subset(corDF, Conceptualbeta<=upperLimitBeta & Spatialbeta<=upperLimitBeta), aes(Conceptualbeta, Spatialbeta)) +
geom_abline(slope = 1, intercept=0, color = 'black', linetype = 'dashed')+
geom_point(aes(color=environment, shape=environment), size =3, alpha=0.9)+ #environment order
expand_limits(x = 0, y = 0) +
scale_x_continuous(limits=c(0,upperLimitBeta), breaks= scales::pretty_breaks(n = 5)) +
scale_y_continuous(limits=c(0,upperLimitBeta), breaks= scales::pretty_breaks(n = 5)) +
xlab(expression("Conceptual "*beta))+
ylab(expression("Spatial "*beta)) +
theme_classic()+
ggtitle('Exploration Bonus')+
scale_color_manual(name="", values=c("#24325FFF", '#B7E4F9FF'))+ #environment
scale_shape_manual(name="", values= c(17,16))+
#theme(text = element_text(size=16, family="sans"), plot.title = element_text(size=16))+
theme(title = element_text(family = 'sans'), legend.position="None")
p4b <- ggExtra::ggMarginal(p4b, type = "boxplot", fill='transparent', size=10)
#TAU
#Upper limits
uppertquartiles <- c(quantile(corDF$Conceptualtau, probs=c(.25, .75))[2], quantile(corDF$Spatialtau, probs=c(.25, .75))[2]) #upper quartiles
H <- c(1.5 * IQR(corDF$Conceptualtau, na.rm = T), 1.5 * IQR(corDF$Spatialtau, na.rm = T))
upperLimitTau <- max(uppertquartiles + H) #use the larger 1.5 * IQR from the upper quartile to set axis limits
p4c <- ggplot(subset(corDF, Conceptualtau<=upperLimitTau & Spatialtau<=upperLimitTau), aes(Conceptualtau, Spatialtau)) +
geom_abline(slope = 1, intercept=0, color = 'black', linetype = 'dashed')+
geom_point(aes(color=environment, shape=environment), size =3, alpha=0.9)+ #environment order
xlab(expression("Conceptual "*tau))+
scale_x_continuous(limits=c(0,upperLimitTau)) +
scale_y_continuous(limits=c(0,upperLimitTau)) +
ylab(expression("Spatial "*tau)) +
theme_classic()+
ggtitle('Temperature')+
scale_color_manual(name="", values=c("#24325FFF", '#B7E4F9FF'))+ #environment
scale_shape_manual(name="", values= c(17,16))+
#theme(text = element_text(size=16, family="sans"), plot.title = element_text(size=16))+
theme(title = element_text(family = 'sans'), legend.background = element_blank(), legend.position='right')
leg <- get_legend(p4c) #extract legend
p4c <- p4c + theme(legend.position = 'none')
p4c<- ggExtra::ggMarginal(p4c, type = "boxplot", fill='transparent', size=10)
GPparameterPlots <- cowplot::plot_grid(p4a, p4b, p4c,leg, nrow = 1, rel_widths = c(1,1,1,.5))
GPparameterPlots

Note that these plots use Tukey’s outlier removal criterion to set the x and y axis limits (based on the larger of the two upper limits). This avoids some extreme values making it difficult to interpret the results. The dashed line represents y=x
. Highly correlated parameters should be close to this line, while strong differences between tasks correspond to points either above or below the line.
We first report the results using non-parametric tests, comparing differences in parameter estimates using the Wilcoxon signed-rank test and correlations using Kendall’s \(\tau\). In addition, we report standard \(t\)-tests and Pearson’s correlation after using a 20%-trimmed mean outlier removal criterion. We should expect robust effects to be found in both analyses.
Generalization \(\lambda\)
We find no difference between lambda values (Wilcoxon signed-rank test: \(Z=-1.2\), \(p=.115\), \(r=-.11\), \(BF=.14\)), which were weakly correlated (`\(r_{\tau}=.13\), \(p=.028\), \(BF=1.3\)).
Exploration bonus \(\beta\)
We find strong differences in exploration behavior, with far lower estimates of the exploration bonus in the conceptual task (\(Z=-5.0\), \(p<.001\), \(r=-.44\), \(BF>100\)). These estimates were correlated between the two tasks (\(r_{\tau}=.18\), \(p=.002\), \(BF=13\)).
Temperature \(\tau\)
In contrast to the reduction of exploration in the conceptual task, we find an increase in random exploration (\(Z=6.9\), \(p<.001\), \(r=-.61\), \(BF>100\)). Temperature estimates were strongly rank correlated (\(r_{\tau}=.43\), \(p<.001\), \(BF>100\)).
Statistics
Generalization \(\lambda\) |
\(Z=-1.2\), \(p=.115\), \(r=-.11\), \(BF=.14\) |
\(r_{\tau}=.13\), \(p=.028\), \(BF=1.3\) |
Exploration Bonus \(\beta\) |
\(Z=-5.0\), \(p<.001\), \(r=-.44\), \(BF>100\) |
\(r_{\tau}=.18\), \(p=.002\), \(BF=13\) |
Temperature \(\tau\) |
\(Z=-6.9\), \(p<.001\), \(r=-.61\), \(BF>100\) |
\(r_{\tau}=.43\), \(p<.001\), \(BF>100\) |
Here is all the code for these statistical tests below
#Lambda
ranktestPretty(corDF$Conceptuallambda,corDF$Spatiallambda, paired=T) #rank test
corTestPretty(corDF$Conceptuallambda,corDF$Spatiallambda, method ='kendall') #correlation
#Beta
ranktestPretty(corDF$Conceptualbeta,corDF$Spatialbeta, paired=T) #Note, sometimes the gibbs sampler doesn't converge for the Bayes Factor
corTestPretty(corDF$Conceptualbeta,corDF$Spatialbeta, method='kendall')
#Tau
ranktestPretty(corDF$Conceptualtau,corDF$Spatialtau, paired=T) #full data
corTestPretty(corDF$Conceptualtau,corDF$Spatialtau, method='kendall')
Were there also differences in parameters between environments? There were no reliable differences for \(\lambda\) (conceptual: \(U=1864\), \(p=.343\), \(r_{\tau}=-.07\), \(BF=.32\); spatial: \(U=2533\), \(p=.027\), \(r_{\tau}=.16\), \(BF=.63\))). There seems to be larger conceptual \(\beta\) values in smooth than rough environments (\(U=2710\), \(p=.002\), \(r_{\tau}=.22\), \(BF=8.2\)), but no differences in spatial \(\beta\) (\(U=2379\), \(p=.138\), \(r_{\tau}=.11\), \(BF=.58\)). There were no differences in \(\tau\) (conceptual: \(U=1729\), \(p=.113\), \(r_{\tau}=-.12\), \(BF=.50\)); spatial: \(U=1968\), \(p=.648\), \(r_{\tau}=-.03\), \(BF=.23\)).
#Lambda
ranktestPretty(subset(corDF, environment=="Smooth")$Conceptuallambda,subset(corDF, environment=="Rough")$Conceptuallambda) #$U=1864$,
\$p=.343$, $r_{\tau}=-.07$, $BF=.32$
ranktestPretty(subset(corDF, environment=="Smooth")$Spatiallambda,subset(corDF, environment=="Rough")$Spatiallambda) #$U=2533$, $p=.027$, $r_{\tau}=.16$, $BF=.63$
#Beta
ranktestPretty(subset(corDF, environment=="Smooth")$Conceptualbeta,subset(corDF, environment=="Rough")$Conceptualbeta) #$U=2710$, $p=.002$, $r_{\tau}=.22$, $BF=8.2$
ranktestPretty(subset(corDF, environment=="Smooth")$Spatialbeta,subset(corDF, environment=="Rough")$Spatialbeta)#$U=2379$, $p=.138$, $r_{\tau}=.11$, $BF=.58$
#Tau
ranktestPretty(subset(corDF, environment=="Smooth")$Conceptualtau,subset(corDF, environment=="Rough")$Conceptualtau) #$U=1729$, $p=.113$, $r_{\tau}=-.12$, $BF=.50$
ranktestPretty(subset(corDF, environment=="Smooth")$Spatialtau,subset(corDF, environment=="Rough")$Spatialtau)
One more thing I want to check is whether \(\tau\) and \(\beta\) are inversely correlated
upperLimit <- max(upperLimitTau, upperLimitBeta) #Use the larger of the two upper limits
explorationConceptual <- ggplot(subset(corDF, Conceptualbeta<=upperLimit & Conceptualtau<=upperLimit), aes(Conceptualbeta, Conceptualtau)) +
geom_abline(slope = 1, intercept=0, color = 'black', linetype = 'dashed')+
geom_point(aes(color=environment, shape=environment), size =3, alpha=0.9)+ #environment order
xlab(expression("Exploration bonus "*beta))+
scale_x_continuous(limits=c(0,upperLimit)) +
scale_y_continuous(limits=c(0,upperLimit)) +
ylab(expression("Temperature "*tau)) +
theme_classic()+
ggtitle('Conceptual')+
scale_color_manual(name="", values=c("#24325FFF", '#B7E4F9FF'))+ #environment
scale_shape_manual(name="", values= c(17,16))+
theme(text = element_text(size=16, family="sans"), plot.title = element_text(size=16))+
theme(title = element_text(family = 'sans'), legend.background = element_blank(), legend.position='none')
explorationConceptual

explorationSpatial <- ggplot(subset(corDF, Spatialbeta<=upperLimit & Spatialtau<=upperLimit), aes(Spatialbeta, Spatialtau)) +
geom_abline(slope = 1, intercept=0, color = 'black', linetype = 'dashed')+
geom_point(aes(color=environment, shape=environment), size =3, alpha=0.9)+ #environment order
xlab(expression("Exploration bonus "*beta))+
scale_x_continuous(limits=c(0,upperLimit)) +
scale_y_continuous(limits=c(0,upperLimit)) +
ylab(expression("Temperature "*tau)) +
theme_classic()+
ggtitle('Spatial')+
scale_color_manual(name="Environment", values=c("#24325FFF", '#B7E4F9FF'))+ #environment
scale_shape_manual(name="Environment", values= c(17,16))+
theme(text = element_text(size=16, family="sans"), plot.title = element_text(size=16))+
theme(title = element_text(family = 'sans'), legend.background = element_blank(), legend.position='right')
explorationSpatial

Task order and differences in exploration
Let’s see if the difference in directed exploration (\(\beta\)) and undirected exploration (\(\tau\)) were influenced by task order:
taskOrderDiff <- ddply(corDF, ~participant+environment+contextOrder, plyr::summarize, betaDiff = Spatialbeta - Conceptualbeta , tauDiff = Spatialtau- Conceptualtau)
#ANOVA of Beta Differences
res.aov <- aov(betaDiff ~ environment*contextOrder, data=taskOrderDiff)
anova_stats(res.aov)
# Now let's replicate via Robust ANOVA
bwtrim(betaDiff ~ environment*contextOrder, id = participant, data=taskOrderDiff, tr = 0.2) #using 20% trimmed means
## Call:
## bwtrim(formula = betaDiff ~ environment * contextOrder, id = participant,
## data = taskOrderDiff, tr = 0.2)
##
## value df1 df2 p.value
## contextOrder 0.0713 1 38.1077 0.7909
## environment 0.1113 1 38.0141 0.7405
## contextOrder:environment 0.2666 1 38.0141 0.6086
#Now compute Bayes factor
bf = anovaBF(betaDiff ~ environment*contextOrder, data=taskOrderDiff)
bf
## Bayes factor analysis
## --------------
## [1] environment : 0.1979765 ±0.06%
## [2] contextOrder : 0.5615754 ±0%
## [3] environment + contextOrder : 0.1198964 ±1.02%
## [4] environment + contextOrder + environment:contextOrder : 0.03329376 ±1.39%
##
## Against denominator:
## Intercept only
## ---
## Bayes factor type: BFlinearModel, JZS
#ANOVA of Tau Differences
res.aov <- aov(tauDiff ~ environment*contextOrder, data=taskOrderDiff)
anova_stats(res.aov)
# Now let's replicate via Robust ANOVA
bwtrim(tauDiff ~ environment*contextOrder, id = participant, data=taskOrderDiff, tr = 0.2) #using 20% trimmed means
## Call:
## bwtrim(formula = tauDiff ~ environment * contextOrder, id = participant,
## data = taskOrderDiff, tr = 0.2)
##
## value df1 df2 p.value
## contextOrder 13.7333 1 30.3467 0.0008
## environment 0.0785 1 27.7521 0.7815
## contextOrder:environment 0.0554 1 27.7521 0.8156
#Now compute Bayes factor
bf = anovaBF(tauDiff ~ environment*contextOrder, data=taskOrderDiff)
bf
## Bayes factor analysis
## --------------
## [1] environment : 0.3422938 ±0.02%
## [2] contextOrder : 0.3100443 ±0.03%
## [3] environment + contextOrder : 0.1293771 ±5.95%
## [4] environment + contextOrder + environment:contextOrder : 0.0561998 ±2.44%
##
## Against denominator:
## Intercept only
## ---
## Bayes factor type: BFlinearModel, JZS
These analyses show that context-related changes in \(\beta\) and \(\tau\) were not influenced by either environment or task order (\(p>0.05\), \(BF<1\)).
Relationships between parameters and performance
Higher lambda estimates were weakly correlated with better performance in the spatial task (\(r_{\tau}=.13\), \(p=.030\), \(BF=1.2\)), yet surprisingly lower performance in the conceptual task (\(r_{\tau}=-.22\), \(p<.001\), \(BF>100\)).
gpDF <- ddply(subset(paramEstimates, kernel=='RBF') , ~participant+environment+context+meanScore, plyr::summarize, lambda = mean(lambda), beta = mean(beta), tau = mean(tau))
pLambda <- ggplot(gpDF, aes(x= meanScore, y = lambda, color=context))+
geom_point(alpha = .9)+
geom_smooth(method = 'lm')+
facet_grid(context~.)+
scale_y_continuous(limits=c(0,upperLimitLambda)) +
ylab(expression(lambda)) +
xlab('Average Reward')+
ggtitle('Generalization')+
theme_classic()+
scale_color_brewer(palette = 'Dark2')+
theme(strip.background=element_blank(), legend.position='none')
pLambda
## Warning: Removed 26 rows containing non-finite values (stat_smooth).
## Warning: Removed 26 rows containing missing values (geom_point).

#tests
# corTestPretty(subset(gpDF, context == 'Conceptual')$meanScore, subset(gpDF, context == 'Conceptual')$lambda, method = 'kendall') #rank
# #corTestPretty(subset(gpDF, context == 'Spatial')$meanScore, subset(gpDF, context == 'Spatial')$lambda, method = 'kendall')
# ttestPretty(subset(gpDF, context=='Spatial' & environment=='Smooth')$lambda, mu=4,maxBF=Inf)
# ttestPretty(subset(gpDF, context=='Spatial' & environment=='Rough')$lambda, mu=2,maxBF=Inf)
Higher beta estimates were strongly predictive of better performance in both conceptual (\(r_{\tau}=.32\), \(p<.001\), \(BF>100\)) anbd spatial tasks (\(r_{\tau}=.31\), \(p<.001\), \(BF>100\))
pBeta<- ggplot(gpDF, aes(x= meanScore, y = beta, color=context))+
geom_point(alpha = .9)+
geom_smooth(method = 'lm')+
facet_grid(context~.)+
scale_y_continuous(limits=c(0,upperLimitBeta)) +
ylab(expression(beta)) +
xlab('Average Reward')+
ggtitle('Exploration Bonus')+
theme_classic()+
scale_color_brewer(palette = 'Dark2')+
theme(strip.background=element_blank(), legend.position='none')
pBeta
## Warning: Removed 14 rows containing non-finite values (stat_smooth).
## Warning: Removed 14 rows containing missing values (geom_point).
## Warning: Removed 42 rows containing missing values (geom_smooth).

#corTestPretty(subset(gpDF, context == 'Conceptual')$meanScore, subset(gpDF, context == 'Conceptual')$beta, method = 'kendall')
#corTestPretty(subset(gpDF, context == 'Spatial')$meanScore, subset(gpDF, context == 'Spatial')$beta, method = 'kendall')
On the otherhand, high Tau values predicted lower performance in both conceptual(\(r_{\tau}=-.59\), \(p<.001\), \(BF>100\)) and spatial tasks (\(r_{\tau}=-.58\), \(p<.001\), \(BF>100\)).
pTau <- ggplot(gpDF, aes(x= meanScore, y = tau, color=context))+
geom_point(alpha = .9)+
geom_smooth(method = 'lm')+
facet_grid(context~.)+
scale_y_continuous(limits=c(0,upperLimitTau)) +
ylab(expression(tau)) +
xlab('Average Reward')+
ggtitle('Temperature')+
theme_classic()+
scale_color_brewer(palette = 'Dark2')+
theme(strip.background=element_blank(), legend.position='none')
pTau
## Warning: Removed 29 rows containing non-finite values (stat_smooth).
## Warning: Removed 29 rows containing missing values (geom_point).

# #corTestPretty(subset(gpDF, context == 'Conceptual')$meanScore, subset(gpDF, context == 'Conceptual')$tau, method = 'kendall')
# #corTestPretty(subset(gpDF, context == 'Spatial')$meanScore, subset(gpDF, context == 'Spatial')$tau, method = 'kendall')
Relationships between parameters and predictive accuracy
We can also run a Bayesian mixed effects regression where we try to predict \(\log(\tau)\) using context, while also controlling for the predictive acuracy of the model (\(R^2\)). Here, we still find a difference in tau
# Bayesian regression for predicting tau based on context, while also controlling for predictive accuracy of the model --------
prior <- c(set_prior("normal(0,1)", class = "b"),set_prior("normal(0,1)", class = "sd"))
brm_tau_R2 <- run_model(brm(log(tau) ~ 0 + intercept + context * R2 + (1+ context * R2|participant ), data=subset(modelFit, ModelName == "RBF-UCB"),
prior = prior, cores=4, iter = 4000, warmup = 1000, control = list(adapt_delta = 0.99)), modelName = 'tauR2')
p_conditionalTemperature <- plot(marginal_effects(brm_tau_R2, effects = "context", method = "fitted"))$context +
theme_classic() +
xlab('Task')+
ylab(expression(log(tau)))

Bayesian Mean Tracker
#Compile the plotting dataframes
k<- 'BMT'
a<- "UCB"
conceptualDF<- subset(paramEstimates, kernel==k & acq==a & context=="Conceptual")
conceptualParams <- ddply(conceptualDF, ~participant+environment+contextOrder, plyr::summarize, ConceptualSigma=mean(kError), Conceptualbeta = mean(beta), Conceptualtau = mean(tau))
gridDF<- subset(paramEstimates, kernel==k & acq==a & context == "Spatial")
gridParams <- ddply(gridDF, ~participant+environment+contextOrder, plyr::summarize, SpatialSigma=mean(kError), Spatialbeta = mean(beta), Spatialtau = mean(tau))
bmtDF <- merge(conceptualParams, gridParams, by=c("participant", "environment", "contextOrder"))
bmtDF$environment <- factor(bmtDF$environment, levels=c("Rough", "Smooth"))
#Error Variance
#Max axis value using Tukey's outlier removal critereon (for the larger of the two axes)
uppertquartiles <- c(quantile(bmtDF$ConceptualSigma, probs=c(.25, .75))[2], quantile(bmtDF$SpatialSigma, probs=c(.25, .75))[2]) #upper quartiles
H <- c(1.5 * IQR(bmtDF$ConceptualSigma, na.rm = T), 1.5 * IQR(bmtDF$SpatialSigma, na.rm = T))
upperLimitSigma <- max(uppertquartiles + H) #use the larger 1.5 * IQR from the upper quartile to set axis limits
p5a <- ggplot(subset(bmtDF,ConceptualSigma <= upperLimitSigma & SpatialSigma<= upperLimitSigma), aes(ConceptualSigma, SpatialSigma)) +
geom_abline(slope = 1, intercept=0, color = 'black', linetype = 'dashed')+
geom_point(aes(color=environment, shape=environment), size =3, alpha=0.9)+ #environment
expand_limits(x = 0, y = 0) +
xlab(expression("Conceptual "*sigma[epsilon]^2))+
ylab(expression("Spatial "*sigma[epsilon]^2)) +
scale_x_continuous(limits=c(0,upperLimitSigma)) +
scale_y_continuous(limits=c(0,upperLimitSigma)) +
theme_classic()+
ggtitle('Inverse Sensitivity')+
theme(plot.title = element_text(size=16))+
scale_color_manual(name="", values=c("#24325FFF", '#B7E4F9FF'))+ #environment
scale_shape_manual(name="", values= c(17,16))+
theme(text = element_text(size=16, family="sans"))+
theme(title = element_text(family = 'sans'), legend.position='none',
legend.background = element_rect(fill='transparent'))
p5a <- ggExtra::ggMarginal(p5a, type = "boxplot", fill='transparent', size = 10, outlier.shape = NA) #add marginal boxplots
#BETA
#Upper limits
uppertquartiles <- c(quantile(bmtDF$Conceptualbeta, probs=c(.25, .75))[2], quantile(bmtDF$Spatialbeta, probs=c(.25, .75))[2]) #upper quartiles
H <- c(1.5 * IQR(bmtDF$Conceptualbeta, na.rm = T), 1.5 * IQR(bmtDF$Spatialbeta, na.rm = T))
upperLimitBeta <- max(uppertquartiles + H) #use the larger 1.5 * IQR from the upper quartile to set axis limits
p5b <- ggplot(subset(bmtDF, Conceptualbeta<=upperLimitBeta & Spatialbeta<=upperLimitBeta), aes(Conceptualbeta, Spatialbeta)) +
geom_abline(slope = 1, intercept=0, color = 'black', linetype = 'dashed')+
geom_point(aes(color=environment, shape=environment), size =3, alpha=0.9)+ #environment order
expand_limits(x = 0, y = 0) +
scale_x_continuous(limits=c(0,upperLimitBeta), breaks= scales::pretty_breaks(n = 5)) +
scale_y_continuous(limits=c(0,upperLimitBeta), breaks= scales::pretty_breaks(n = 5)) +
xlab(expression("Conceptual "*beta))+
ylab(expression("Spatial "*beta)) +
theme_classic()+
ggtitle('Exploration Bonus')+
theme(plot.title = element_text(size=16))+
scale_color_manual(name="", values=c("#24325FFF", '#B7E4F9FF'))+ #environment
scale_shape_manual(name="", values= c(17,16))+
theme(text = element_text(size=16, family="sans"))+
theme(title = element_text(family = 'sans'), legend.position="None")
p5b <- ggExtra::ggMarginal(p5b, type = "boxplot", fill='transparent', size=10)
#TAU
#upper limits
uppertquartiles <- c(quantile(bmtDF$Conceptualtau, probs=c(.25, .75))[2], quantile(bmtDF$Spatialtau, probs=c(.25, .75))[2]) #upper quartiles
H <- c(1.5 * IQR(bmtDF$Conceptualtau, na.rm = T), 1.5 * IQR(bmtDF$Spatialtau, na.rm = T))
upperLimitTau <- max(uppertquartiles + H) #use the larger 1.5 * IQR from the upper quartile to set axis limits
p5c <- ggplot(subset(bmtDF, Conceptualtau<=upperLimitTau & Spatialtau<=upperLimitTau), aes(Conceptualtau, Spatialtau)) +
geom_abline(slope = 1, intercept=0, color = 'black', linetype = 'dashed')+
geom_point(aes(color=environment, shape=environment), size =3, alpha=0.9)+ #environment order
xlab(expression("Conceptual "*tau))+
scale_x_continuous(limits=c(0,upperLimitTau)) +
scale_y_continuous(limits=c(0,upperLimitTau)) +
ylab(expression("Spatial "*tau)) +
theme_classic()+
ggtitle('Temperature')+
theme(plot.title = element_text(size=16))+
scale_color_manual(name="", values=c("#24325FFF", '#B7E4F9FF'))+ #environment
scale_shape_manual(name="", values= c(17,16))+
theme(text = element_text(size=16, family="sans"))+
theme(title = element_text(family = 'sans'), legend.background = element_blank(), legend.position='right')
leg <- get_legend(p5c) #extract legend
p5c <- p5c + theme(legend.position = 'none')
p5c<- ggExtra::ggMarginal(p5c, type = "boxplot", fill='transparent', size=10)
BMTparameterPlots <- cowplot::plot_grid(p5a, p5b, p5c,leg, nrow = 1, rel_widths = c(1,1,1,.5))
BMTparameterPlots

We also see pretty similar results for the BMT.
Error Variance \(\sigma_\epsilon ^2\)
There were lower estimates of the error variance (\(\sigma_\epsilon ^2\)) in the conceptual task (Wilcoxon signed-rank test: \(Z=-4.8\), \(p<.001\), \(r=-.42\), \(BF>100\)), suggesting participants were more sensitive to the reward values (i.e., more substantial updates to their means estimates). Error variance was also weakly correlated (`\(r_{\tau}=.18\), \(p=.003\), \(BF=10\)).
Exploration bonus \(\beta\)
Again, we find strong differences in exploration behavior, with far lower estimates of the exploration bonus in the conceptual task (\(Z=-5.9\), \(p<.001\), \(r=-.52\), \(BF>100\)), with somewhat correlated estimates (\(r_{\tau}=.16\), \(p=.006\), \(BF=4.8\)).
Temperature \(\tau\)
And in line with the GP results above, we again find an increase in random exploration in the conceptual taskl (\(Z=-6.9\), \(p<.001\), \(r=-.61\), \(BF>100\)). Once more, temperatre estimates were strongly correlated (\(r_{\tau}=.34\), \(p<.001\), \(BF>100\)).
Statistics
Error Variance \(\sigma_\epsilon ^2\) |
\(Z=-4.8\), \(p<.001\), \(r=-.42\), \(BF>100\) |
\(r_{\tau}=.18\), \(p=.003\), \(BF=10\) |
Exploration Bonus \(\beta\) |
\(Z=-5.9\), \(p<.001\), \(r=-.52\), \(BF>100\) |
\(r_{\tau}=.16\), \(p=.006\), \(BF=4.8\) |
Temperature \(\tau\) |
\(Z=-6.9\), \(p<.001\), \(r=-.61\), \(BF>100\) |
\(r_{\tau}=.34\), \(p<.001\), \(BF>100\) |
Code for statistical tests below
#Error Variance
ranktestPretty(bmtDF$ConceptualSigma,bmtDF$SpatialSigma, paired=T) #rank test
corTestPretty(bmtDF$ConceptualSigma,bmtDF$SpatialSigma, method ='kendall') #correlation
#Beta
ranktestPretty(bmtDF$Conceptualbeta,bmtDF$Spatialbeta, paired=T)
corTestPretty(bmtDF$Conceptualbeta,bmtDF$Spatialbeta, method='kendall')
#Tau
ranktestPretty(bmtDF$Conceptualtau,bmtDF$Spatialtau, paired=T) #full data
corTestPretty(bmtDF$Conceptualtau,bmtDF$Spatialtau, method='kendall')
GP with Shepard Kernel
We also tried a variant model where instead of using the RBF kernel, we used a Shepard kernel (Jäkel, Schölkopf, and Wichmann 2008) where rather than using squared Euclidean distance, we use Minkowski distance and estimate the order parameter \(\rho\):
\[
k_{Shepard}(\mathbf{x},\mathbf{x}') = \frac{\left(\sum_i|x_i - x'_i|^{\rho}\right)^{1/\rho}}{2\lambda^2}
\] When \(\rho=2\), the Shepard kernel is equivalent to the RBF kernel. When \(\rho<2\), then the separate dimensions are less than fully integrated with each other, suggesting people are generalizing more independently along the two dimensions.
#Reload models and not omit the shepard kernel thid time
modelFit <- read.csv('../modelResults/modelFit.csv')
paramEstimates <- read.csv('../modelResults/paramEstimates.csv')
modelFit$kernel <- factor(modelFit$kernel, levels=c('RBF','SimKernel', 'BMT')) #reorder levels
levels(modelFit$kernel) <- c('GP','Shepard', 'BMT') #rename levels
paramEstimates$kernel <- factor(paramEstimates$kernel, levels=c('RBF','SimKernel', 'BMT')) #reorder levels
levels(paramEstimates$kernel) <- c('GP','Shepard', 'BMT') #rename levels
ggplot(modelFit, aes(x = kernel, y = R2, fill = kernel))+
stat_summary(fun.y=mean, geom='bar', color = 'black')+
stat_summary(fun.data=mean_se, geom='errorbar', color = 'black', width = 0.2)+
facet_grid(~context, labeller=as_labeller(contextLabels)) +
#theme_classic()+
ylab('Predictive Accuracy')+
xlab('')+
#scale_color_manual(values = c(gpCol,"#a6761d", bmtCol), name='')+
scale_fill_manual(values = c(gpCol,shepardCol, bmtCol), name='')+
theme(legend.position="none", strip.background=element_blank(), legend.key=element_rect(color=NA))

Compared against the standard RBF kernel, the Shepard kernel makes better predictions in both the conceptual (\(t(128)=-5.5\), \(p<.001\), \(d=0.04\), \(BF>100\)) and spatial tasks (\(t(128)=-5.0\), \(p<.001\), \(d=0.08\), \(BF>100\)).
If we add it to the hierarchical Bayesian model comparison…
#commented out to avoid clashing with the two model comparison above
#write.table(cbind(subset(modelFit, context =='Conceptual' & ModelName == 'RBF-UCB')$nLL, subset(modelFit, context =='Conceptual' & ModelName == 'SimKernel-UCB')$nLL, subset(modelFit, context =='Conceptual' & ModelName == 'BMT-UCB')$nLL), 'modelResults/conceptualdiffevidence.csv', row.names = FALSE, sep=',', col.names=FALSE)
#write.table(cbind(subset(modelFit, context =='Spatial' & ModelName == 'RBF-UCB')$nLL, subset(modelFit, context =='Spatial' & ModelName == 'SimKernel-UCB')$nLL, subset(modelFit, context =='Spatial' & ModelName == 'BMT-UCB')$nLL), 'modelResults/spatialdiffevidence.csv', row.names = FALSE, sep=',',col.names=FALSE)
#build dataframe with output
pxpDF <- data.frame(model= rep(c('GP', 'Shepard', 'BMT'),2), context = c('Conceptual', 'Conceptual', 'Conceptual','Spatial','Spatial','Spatial'), pxp= c(2.3074e-05,0.99995,2.5074e-05 ,3.5182e-05,0.99993,3.3182e-05 )) #Output pasted in here to avoid clashing with the two model comparison above
#Reorder levels
pxpDF$model <- factor(pxpDF$model , levels=c('GP', 'Shepard', 'BMT'))
ggplot(pxpDF, aes(x = model, y = pxp, fill = model))+
geom_bar(stat="identity",color='black')+
facet_grid(~context,labeller=as_labeller(contextLabels))+
ylab('PXP')+
xlab('')+
scale_y_continuous(labels = percent)+
expand_limits(y=0)+
#scale_fill_manual(values = c(gpCol,"#a6761d", bmtCol), name='')+
scale_fill_manual(values = c(gpCol,shepardCol,bmtCol), name='')+
theme(legend.position="none", strip.background=element_blank(), legend.key=element_rect(color=NA))
Now let’s look at whether this additional parameter actually tells us anything informative…
k<- 'Shepard'
a<- "UCB"
conceptualDF<- subset(paramEstimates, kernel==k & acq==a & context=="Conceptual")
conceptualParams <- ddply(conceptualDF, ~participant+environment+contextOrder, plyr::summarize, Conceptuallambda=mean(lambda), Conceptualbeta = mean(beta), Conceptualtau = mean(tau), Conceptualp = mean(p))
gridDF<- subset(paramEstimates, kernel==k & acq==a & context == "Spatial")
gridParams <- ddply(gridDF, ~participant+environment+contextOrder, plyr::summarize, Spatiallambda=mean(lambda), Spatialbeta = mean(beta), Spatialtau = mean(tau), Spatialp = mean(p))
shepardDF <- merge(conceptualParams, gridParams, by=c("participant", "environment", "contextOrder"))
shepardDF$environment <- factor(shepardDF$environment, levels=c("Rough", "Smooth"))
#LAMBDA
#Max axis value using Tukey's outlier removal critereon (for the larger of the two axes)
uppertquartiles <- c(quantile(shepardDF$Conceptuallambda, probs=c(.25, .75))[2], quantile(shepardDF$Spatiallambda, probs=c(.25, .75))[2]) #upper quartiles
H <- c(1.5 * IQR(shepardDF$Conceptuallambda, na.rm = T), 1.5 * IQR(shepardDF$Spatiallambda, na.rm = T))
upperLimitLambda <- max(uppertquartiles + H) #use the larger 1.5 * IQR from the upper quartile to set axis limits
p6a <- ggplot(subset(shepardDF,Conceptuallambda <= upperLimitLambda & Spatiallambda<= upperLimitLambda), aes(Conceptuallambda, Spatiallambda)) +
geom_abline(slope = 1, intercept=0, color = 'black', linetype = 'dashed')+
geom_point(aes(color=environment, shape=environment), size =3, alpha=0.9)+ #environment
expand_limits(x = 0, y = 0) +
xlab(expression("Conceptual "*lambda))+
ylab(expression("Spatial "*lambda)) +
scale_x_continuous(limits=c(0,upperLimitLambda)) +
scale_y_continuous(limits=c(0,upperLimitLambda)) +
theme_classic()+
ggtitle('Generalization')+
theme(plot.title = element_text(size=16))+
scale_color_manual(name="", values=c("#24325FFF", '#B7E4F9FF'))+ #environment
scale_shape_manual(name="", values= c(17,16))+
theme(text = element_text(size=16, family="sans"))+
theme(title = element_text(family = 'sans'), legend.position='none',
legend.background = element_rect(fill='transparent'))
p6a <- ggExtra::ggMarginal(p6a, type = "boxplot", fill='transparent', size = 10, outlier.shape = NA) #add marginal boxplots
#RHO
#Max axis value using Tukey's outlier removal critereon (for the larger of the two axes)
uppertquartiles <- c(quantile(shepardDF$Conceptualp, probs=c(.25, .75))[2], quantile(shepardDF$Spatialp, probs=c(.25, .75))[2]) #upper quartiles
H <- c(1.5 * IQR(shepardDF$Conceptualp, na.rm = T), 1.5 * IQR(shepardDF$Spatialp, na.rm = T))
upperLimitp <- max(uppertquartiles + H) #use the larger 1.5 * IQR from the upper quartile to set axis limits
p6b <- ggplot(subset(shepardDF,Conceptualp <= upperLimitp & Spatialp<= upperLimitp), aes(Conceptualp, Spatialp)) +
geom_abline(slope = 1, intercept=0, color = 'black', linetype = 'dashed')+
geom_point(aes(color=environment, shape=environment), size =3, alpha=0.9)+ #environment
expand_limits(x = 0, y = 0) +
xlab(expression("Conceptual "*rho))+
ylab(expression("Spatial "*rho)) +
scale_x_continuous(limits=c(0,upperLimitp)) +
scale_y_continuous(limits=c(0,upperLimitp)) +
theme_classic()+
ggtitle('Minkowski Distance')+
theme(plot.title = element_text(size=16))+
scale_color_manual(name="", values=c("#24325FFF", '#B7E4F9FF'))+ #environment
scale_shape_manual(name="", values= c(17,16))+
theme(text = element_text(size=16, family="sans"))+
theme(title = element_text(family = 'sans'), legend.position='none',
legend.background = element_rect(fill='transparent'))
p6b <- ggExtra::ggMarginal(p6b, type = "boxplot", fill='transparent', size = 10, outlier.shape = NA) #add marginal boxplots
#BETA
#Upper limits
uppertquartiles <- c(quantile(shepardDF$Conceptualbeta, probs=c(.25, .75))[2], quantile(shepardDF$Spatialbeta, probs=c(.25, .75))[2]) #upper quartiles
H <- c(1.5 * IQR(shepardDF$Conceptualbeta, na.rm = T), 1.5 * IQR(shepardDF$Spatialbeta, na.rm = T))
upperLimitBeta <- max(uppertquartiles + H) #use the larger 1.5 * IQR from the upper quartile to set axis limits
p6c <- ggplot(subset(shepardDF, Conceptualbeta<=upperLimitBeta & Spatialbeta<=upperLimitBeta), aes(Conceptualbeta, Spatialbeta)) +
geom_abline(slope = 1, intercept=0, color = 'black', linetype = 'dashed')+
geom_point(aes(color=environment, shape=environment), size =3, alpha=0.9)+ #environment order
expand_limits(x = 0, y = 0) +
scale_x_continuous(limits=c(0,upperLimitBeta), breaks= scales::pretty_breaks(n = 5)) +
scale_y_continuous(limits=c(0,upperLimitBeta), breaks= scales::pretty_breaks(n = 5)) +
xlab(expression("Conceptual "*beta))+
ylab(expression("Spatial "*beta)) +
theme_classic()+
ggtitle('Exploration Bonus')+
theme(plot.title = element_text(size=16))+
scale_color_manual(name="", values=c("#24325FFF", '#B7E4F9FF'))+ #environment
scale_shape_manual(name="", values= c(17,16))+
theme(text = element_text(size=16, family="sans"))+
theme(title = element_text(family = 'sans'), legend.position="None")
p6c <- ggExtra::ggMarginal(p6c, type = "boxplot", fill='transparent', size=10)
#TAU
#Upper limits
uppertquartiles <- c(quantile(shepardDF$Conceptualtau, probs=c(.25, .75))[2], quantile(shepardDF$Spatialtau, probs=c(.25, .75))[2]) #upper quartiles
H <- c(1.5 * IQR(shepardDF$Conceptualtau, na.rm = T), 1.5 * IQR(shepardDF$Spatialtau, na.rm = T))
upperLimitTau <- max(uppertquartiles + H) #use the larger 1.5 * IQR from the upper quartile to set axis limits
p6d <- ggplot(subset(shepardDF, Conceptualtau<=upperLimitTau & Spatialtau<=upperLimitTau), aes(Conceptualtau, Spatialtau)) +
geom_abline(slope = 1, intercept=0, color = 'black', linetype = 'dashed')+
geom_point(aes(color=environment, shape=environment), size =3, alpha=0.9)+ #environment order
xlab(expression("Conceptual "*tau))+
scale_x_continuous(limits=c(0,upperLimitTau)) +
scale_y_continuous(limits=c(0,upperLimitTau)) +
ylab(expression("Spatial "*tau)) +
theme_classic()+
ggtitle('Temperature')+
theme(plot.title = element_text(size=16))+
scale_color_manual(name="", values=c("#24325FFF", '#B7E4F9FF'))+ #environment
scale_shape_manual(name="", values= c(17,16))+
theme(text = element_text(size=16, family="sans"))+
theme(title = element_text(family = 'sans'), legend.background = element_blank(), legend.position='right')
leg <- get_legend(p6d) #extract legend
p6d <- p6d + theme(legend.position = 'none')
p6d<- ggExtra::ggMarginal(p6d, type = "boxplot", fill='transparent', size=10)
shepardParamPlots <- cowplot::plot_grid(p6a, p6b, p6c, p6d, leg, nrow = 1, rel_widths = c(1,1,1,1, .5))
shepardParamPlots

Generalization \(\lambda\)
Again we find no evidence of differences in generalization between tasks (\(Z=-1.8\), \(p=.039\), \(r=-.15\), \(BF=.32\)), with weakly correlated estimates between tasks (\(r_{\tau}=.13\), \(p=.026\), \(BF=1.3\)).
Minkowski order \(\rho\)
There is anecdotal evidence of lower \(\rho\) estimates in the conceptual task (\(Z=-2.5\), \(p=.006\), \(r=-.22\), \(BF=2.0\)). The implication of a lower \(\rho\) in the conceptual domain is that the Gabor features were treated more independently, whereas the spatial dimensions were more integrated. However, the statistics don’t suggest this to be a very robust effect. These estimates are also not correlated (\(r_{\tau}=-.02\), \(p=.684\), \(BF=.12\)). They actually seem pretty random.
Exploration bonus \(\beta\)
Consistent with all the other models, we find systematically lower exploration bonuses in the conceptual task (\(Z=-5.5\), \(p<.001\), \(r=-.49\), \(BF>100\)). There is weak evidence of a correlation across tasks (\(r_{\tau}=.14\), \(p=.021\), \(BF=1.6\)).
Temperature \(\tau\)
And like all other models, we find clear evidence of higher temperatures in the conceptual task (\(Z=-6.3\), \(p<.001\), \(r=-.56\), \(BF>100\)), with strong correlations across tasks (\(r_{\tau}=.41\), \(p<.001\), \(BF>100\))
Statistics
Generalization \(\lambda\) |
\(Z=-1.8\), \(p=.039\), \(r=-.15\), \(BF=.32\) |
\(r_{\tau}=.13\), \(p=.026\), \(BF=1.3\) |
Minkowski order \(\rho\) |
\(Z=-2.5\), \(p=.006\), \(r=-.22\), \(BF=2.0\) |
\(r_{\tau}=-.02\), \(p=.684\), \(BF=.12\) |
Exploration Bonus \(\beta\) |
\(Z=-5.5\), \(p<.001\), \(r=-.49\), \(BF>100\) |
\(r_{\tau}=.14\), \(p=.021\), \(BF=1.6\) |
Temperature \(\tau\) |
\(Z=-6.3\), \(p<.001\), \(r=-.56\), \(BF>100\) |
\(r_{\tau}=.41\), \(p<.001\), \(BF>100\) |
Here is all the code for these statistical tests below
#Lambda
ranktestPretty(shepardDF$Conceptuallambda,shepardDF$Spatiallambda, paired=T) #rank test
corTestPretty(shepardDF$Conceptuallambda,shepardDF$Spatiallambda, method ='kendall') #correlation
#Rho
ranktestPretty(shepardDF$Conceptualp,shepardDF$Spatialp, paired=T) #Note, sometimes the gibbs sampler doesn't converge for the Bayes Factor
corTestPretty(shepardDF$Conceptualp,shepardDF$Spatialp, method='kendall')
#Beta
ranktestPretty(shepardDF$Conceptualbeta,shepardDF$Spatialbeta, paired=T)
corTestPretty(shepardDF$Conceptualbeta,shepardDF$Spatialbeta, method='kendall')
#Tau
ranktestPretty(shepardDF$Conceptualtau,shepardDF$Spatialtau, paired=T) #full data
corTestPretty(shepardDF$Conceptualtau,shepardDF$Spatialtau, method='kendall')