Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dombrovski committed Nov 13, 2018
2 parents 0df3b4c + 6ab3ee6 commit e671bb0
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
Binary file modified pie_data.rdata
Binary file not shown.
39 changes: 37 additions & 2 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 @@ -61,10 +60,26 @@ ldf<-reshape2::melt(fdf, measure.vars = varyingvars)
ldf$type<-gsub("[0-9]*","",ldf$variable)
ldf <- ldf[ldf$type=='v_bayes',]

<<<<<<< HEAD
# how many remain unsampled
ggplot(fdf,aes(trial,n_unsampled, color = num_segments, lty = show_points)) + geom_smooth()
=======
# 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',]


>>>>>>> 6ab3ee61fc0354e37a902a375ae5efc82fb3c682
# 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 @@ -110,13 +125,17 @@ m3diff <- lmer(v_diff ~ num_segments * show_points + trial + (1|ID), fdf)
summary(m3diff)
car::Anova(m3diff,'3')

<<<<<<< HEAD
###########
# exploration
# crude measure of uncertainty: u = #samples_of_selected_segment/#trials(i.e. total # samples for normalization)
=======
# factors controlling choice uncertainty
>>>>>>> 6ab3ee61fc0354e37a902a375ae5efc82fb3c682
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 @@ -169,6 +188,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 e671bb0

Please sign in to comment.