Skip to content

Commit

Permalink
Beta mu analyses
Browse files Browse the repository at this point in the history
  • Loading branch information
dombrovski committed Nov 13, 2018
1 parent 6a4c89d commit 6af0eeb
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
Binary file modified pie_data.rdata
Binary file not shown.
34 changes: 31 additions & 3 deletions pie_inspect.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ library(lme4)
# library(lmerTest)
library(ggplot2)
library(tidyverse)
library(readr)
library(multcompView)
library(stargazer)

Expand Down Expand Up @@ -48,8 +47,21 @@ ldf<-reshape2::melt(fdf, measure.vars = varyingvars)
ldf$type<-gsub("[0-9]*","",ldf$variable)
ldf <- ldf[ldf$type=='v_bayes',]

# beta mean
mdf<-reshape2::melt(fdf, measure.vars = varyingvars)
mdf$type<-gsub("[0-9]*","",mdf$variable)
mdf <- mdf[mdf$type=='dBetaMu',]
# beta variance
sdf<-reshape2::melt(fdf, measure.vars = varyingvars)
sdf$type<-gsub("[0-9]*","",sdf$variable)
sdf <- sdf[sdf$type=='dBetaSigmaSquare',]


# subjective Bayesian probabilities by segment
ggplot(ldf,aes(trial,value, color = variable)) + geom_smooth() + facet_wrap(~num_segments)
ggplot(mdf,aes(trial,value, color = variable)) + geom_smooth() + facet_wrap(~num_segments)
ggplot(sdf,aes(trial,value, color = variable)) + geom_smooth() + facet_wrap(~num_segments)


# their exploitation is helped by show_points in 8
# selected value
Expand Down Expand Up @@ -91,11 +103,11 @@ m3diff <- lmer(v_diff ~ num_segments * show_points + trial + (1|ID), fdf)
summary(m3diff)
car::Anova(m3diff,'3')


# factors controlling choice uncertainty
m4 <- lmer(u ~ num_segments * show_points * trial + (1|ID), fdf)
summary(m4)
car::Anova(m4,'3')
m4v <- lmer(u ~ v_max + num_segments * show_points * trial + (1|ID), fdf)
m4v <- lmer(u ~ v_max * num_segments * show_points * trial + (1|ID), fdf)
summary(m4v)
car::Anova(m4v,'3')
anova(m4,m4v)
Expand Down Expand Up @@ -123,6 +135,22 @@ um3 <- lmer(u ~ vbay_selected * num_segments + show_points * num_segments + (1|I
summary(um3)
car::Anova(um3,'3')

# look at beta distribution uncertainty and value statistics
ggplot(fdf,aes(trial, dBetaMu_selected, color = num_segments, lty = show_points)) + geom_smooth(method = "loess")
# NB: variance of the beta is not the same as epistemic uncertainty; it is closer to risk
ggplot(fdf,aes(dBetaMu_selected,u, color = num_segments, shape = show_points)) + geom_point()

ggplot(fdf,aes(trial, dBetaSigmaSquare_selected, color = num_segments, lty = show_points)) + geom_smooth(method = "loess")

sm1 <- lmer(dBetaSigmaSquare_selected ~ num_segments * show_points * trial + (1|ID), fdf)
summary(sm1)
car::Anova(sm1,'3')
m4v <- lmer(u ~ v_max * num_segments * show_points * trial + (1|ID), fdf)
summary(m4v)
car::Anova(m4v,'3')
anova(m4,m4v)


# compare observed to expected exploration -- no clear prediction for expected because of value confound
u4plus <- sum(uff$u[uff$num_segments==4]==1)
u4minus <- sum(uff$u[uff$num_segments==4]<1)
Expand Down

0 comments on commit 6af0eeb

Please sign in to comment.