This rate is how many trees they had to look at to get each successive fruit.
E1 Retrieval: Prepare the data
Read the data in and pre-process it.
Show the code
e1 <-readRDS("001-00-e1-data.RDS")# remove things from the raw data to make it # suitable for this particular analysis# remove samples that did not look at a treee1 <- e1 %>%filter(fl>0)# remove the second (and any subsequent) *consecutive* duplicatese1 <- e1 %>%group_by(pp, rr, tb) %>%filter(is.na(tl !=lag(tl)) | tl !=lag(tl)) %>%ungroup()# remove trials where they failed to get 10 fruite1 <- e1 %>%group_by(pp, rr, tb) %>%mutate(max_fr =max(fr)) %>%ungroup() %>%filter(max_fr==10)# how many trees to get each fruit?# this is neat and it needs to be done after # reducing the data to row-per-valid-tree-visite1$ntrees_to_get_a_fruit =NAj =0for (k inseq_along(e1$ix)) { j = j +1if (e1[k, 'fl']==2) { e1[k, 'ntrees_to_get_a_fruit'] = j j =0 }}# remove any remaining NAse1 <- e1 %>%filter(!is.na(ntrees_to_get_a_fruit))# average over trials (and ignore stage) to yield # participant means suitable for ggplot and ANOVArtv = e1 %>%select(pp, rr, tb, fr, ntrees_to_get_a_fruit) %>%group_by(pp, rr, fr) %>%summarise(mu=mean(ntrees_to_get_a_fruit)) %>%ungroup() %>%mutate(pp=as_factor(pp), rr=as_factor(rr), fr=as_factor(fr))saveRDS(rtv, "e1_retrieval_plot_data.rds")
The effect of resources was F(1, 41) = 54.14, p<.001.
The effect of fruit was F(3.9, 160.4) = 22.99, p<.001.
The fruit x resources interaction was F(4.8, 197.9) = 46.85, p<.001.
E1 Retrieval: Plot
Ten points along the x axis, each participant contributes one point per cell
Show the code
ggplot(data=rtv, aes(x=fr, y=mu, group=rr, fill=rr, shape=rr)) +labs(title="(c): Retrieval rate", subtitle="People benefit from being in a patch once they realise they are in one")+ylab("Number\nof\ntrees\nvisited\nto get\neach fruit")+xlab("Number of fruit collected so far during trial")+ my_fgms_theme+geom_hline(yintercept=2, lty=3,col="grey")+scale_fill_manual(name="Resource\ndistribution", values=c("white", "black")) +scale_shape_manual(name="Resource\ndistribution", values=c(24,19)) +stat_summary(fun.data = mean_cl_normal, geom ="errorbar", width=0.2, position=pd) +stat_summary(fun = mean, geom ="line", position=pd) +stat_summary(fun = mean, geom ="point", size=3, position=pd)