├── Wine D as Berry.png ├── Wine E as Berry.png ├── experiment_1_AB.pdf ├── experiment_1_AC.pdf ├── experiment_2_AB.pdf ├── experiment_2_AC.pdf ├── Wine D as Earthy.png ├── Wine E as Earthy.png ├── actual ├── pref-count.pdf ├── by-word-type.pdf ├── Wine D as Berry.png ├── Wine E as Berry.png ├── Word Frequency.pdf ├── experiment_1_AB.pdf ├── Wine D as Earthy.png ├── Wine E as Earthy.png ├── experiment_2_ABC.pdf ├── pref-given-words.pdf ├── word-rank-wine-d.pdf ├── word-rank-wine-e.pdf ├── words-given-pref.pdf ├── word-rank-d-v-e-berry.pdf ├── word-rank-d-v-e-earthy.pdf ├── word-rank-berry-v-earthy.pdf ├── word-rank-berry-v-earthy-total.pdf ├── survey_1_2.csv └── survey_3.csv ├── word-rank-wine-d.pdf ├── word-rank-wine-e.pdf ├── 12173_wine_crush_exper-1.pdf ├── samples ├── survey_1_2.csv ├── descriptors.csv └── survey_3.csv ├── README.md ├── analysis.r └── experiment3.r /Wine D as Berry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/Wine D as Berry.png -------------------------------------------------------------------------------- /Wine E as Berry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/Wine E as Berry.png -------------------------------------------------------------------------------- /experiment_1_AB.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/experiment_1_AB.pdf -------------------------------------------------------------------------------- /experiment_1_AC.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/experiment_1_AC.pdf -------------------------------------------------------------------------------- /experiment_2_AB.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/experiment_2_AB.pdf -------------------------------------------------------------------------------- /experiment_2_AC.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/experiment_2_AC.pdf -------------------------------------------------------------------------------- /Wine D as Earthy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/Wine D as Earthy.png -------------------------------------------------------------------------------- /Wine E as Earthy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/Wine E as Earthy.png -------------------------------------------------------------------------------- /actual/pref-count.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/actual/pref-count.pdf -------------------------------------------------------------------------------- /word-rank-wine-d.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/word-rank-wine-d.pdf -------------------------------------------------------------------------------- /word-rank-wine-e.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/word-rank-wine-e.pdf -------------------------------------------------------------------------------- /actual/by-word-type.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/actual/by-word-type.pdf -------------------------------------------------------------------------------- /actual/Wine D as Berry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/actual/Wine D as Berry.png -------------------------------------------------------------------------------- /actual/Wine E as Berry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/actual/Wine E as Berry.png -------------------------------------------------------------------------------- /actual/Word Frequency.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/actual/Word Frequency.pdf -------------------------------------------------------------------------------- /actual/experiment_1_AB.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/actual/experiment_1_AB.pdf -------------------------------------------------------------------------------- /12173_wine_crush_exper-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/12173_wine_crush_exper-1.pdf -------------------------------------------------------------------------------- /actual/Wine D as Earthy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/actual/Wine D as Earthy.png -------------------------------------------------------------------------------- /actual/Wine E as Earthy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/actual/Wine E as Earthy.png -------------------------------------------------------------------------------- /actual/experiment_2_ABC.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/actual/experiment_2_ABC.pdf -------------------------------------------------------------------------------- /actual/pref-given-words.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/actual/pref-given-words.pdf -------------------------------------------------------------------------------- /actual/word-rank-wine-d.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/actual/word-rank-wine-d.pdf -------------------------------------------------------------------------------- /actual/word-rank-wine-e.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/actual/word-rank-wine-e.pdf -------------------------------------------------------------------------------- /actual/words-given-pref.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/actual/words-given-pref.pdf -------------------------------------------------------------------------------- /actual/word-rank-d-v-e-berry.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/actual/word-rank-d-v-e-berry.pdf -------------------------------------------------------------------------------- /actual/word-rank-d-v-e-earthy.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/actual/word-rank-d-v-e-earthy.pdf -------------------------------------------------------------------------------- /actual/word-rank-berry-v-earthy.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/actual/word-rank-berry-v-earthy.pdf -------------------------------------------------------------------------------- /actual/word-rank-berry-v-earthy-total.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sandbox/wine-test/master/actual/word-rank-berry-v-earthy-total.pdf -------------------------------------------------------------------------------- /actual/survey_1_2.csv: -------------------------------------------------------------------------------- 1 | run_id,station_id,btn0,btn1,btn2,artificial0,artificial1,artificial2 2 | 1,STATION_1,42,0,27,-1,0,0 3 | 1,STATION_2,20,0,8,0,0,0 4 | 1,STATION_3,41,0,23,0,0,37 5 | 1,STATION_4,38,0,18,0,0,0 6 | -------------------------------------------------------------------------------- /samples/survey_1_2.csv: -------------------------------------------------------------------------------- 1 | station_id,experiment_no,votes_1,votes_2,votes_3,added_1,added_2,added_3 2 | 1A,1,48,63,0,0,0,0 3 | 1A,2,38,53,0,0,0,0 4 | 1B,1,108,31,0,40,0,0 5 | 1B,2,76,39,0,40,0,0 6 | 2A,1,20,25,0,0,0,0 7 | 2B,2,27,36,0,0,0,0 8 | -------------------------------------------------------------------------------- /samples/descriptors.csv: -------------------------------------------------------------------------------- 1 | word,weight,color 2 | Juicy,1.0,"#F0A8A8" 3 | Woodsy,1.0,"#604848" 4 | Hearty,1.0,"#EB9C4D" 5 | Bright,1.0,"#cccccc" 6 | Smokey,1.0,"#847767" 7 | "Red fruits",1.0,"#A40039" 8 | Spicy,1.0,"#F2D680" 9 | Sweet,1.0,"#E6505B" 10 | Complex,1.0,"#67A87D" 11 | Cedar,1.0,"#735B30" 12 | Plum,1.0,"#734580" 13 | Peppery,1.0,"#697060" 14 | Rustic,1.0,"#B18007" 15 | Earthy,1.0,"#607848" 16 | "Black cherry",1.0,"#8E3C52" 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Wine Tasting 2 | 3 | Scripts and visualizations to analyze a wine tasting experiment. 4 | 5 | # Sample Data 6 | 7 | * samples/survey_1_2.csv 8 | * station_id,experiment_no 9 | * 1A,1 => votes_1 == A, votes_2 == B 10 | * 1A,2 => votes_1 == A, votes_2 == C 11 | * 1B,1 => votes_1 == A, votes_2 == B, added_1 == votes added to votes_1 == A 12 | * 1B,2 => votes_1 == C, votes_2 == A, added_1 == votes added to votes_1 == C 13 | * 2A,1 => votes_1 == A, votes_2 == C special 14 | * 2B,2 => votes_1 == A, votes_2 == B special 15 | * votes_1 16 | * votes_2 17 | * added_1 18 | 19 | * samples/survey_3.csv 20 | * treament - indicates first or second half of the experiment 21 | * wine - the wine shown 22 | * 1 - earthy picture (D when treatment==1, E when treatment==2), 23 | * 2 - berry picture (D when treatment==2, E when treatment==1) 24 | 25 | wine,treatment 26 | 1,1 => D earthy 27 | 1,2 => E earthy 28 | 2,1 => E berry 29 | 2,2 => D berry 30 | 31 | * 1,...,12 - the row index of the word used (lookup in `samples/descriptors.csv`) 32 | 33 | * samples/descriptors.csv 34 | * word - the word being used to describe. The row index can be used as a key to find out what word we are referring to in `survey_3.csv`. 35 | * weight - the associated sweetness weight of the word. This is subjective but it should be a rough measure of how much the word connotates sweetness. 36 | 37 | # Actual Data 38 | 39 | It turned out that the actual data we got back was a little different 40 | than the sample data (particularly for experiments 1 and 2). 41 | Everything outputted for the actual data is done in the `actual` 42 | folder. 43 | -------------------------------------------------------------------------------- /samples/survey_3.csv: -------------------------------------------------------------------------------- 1 | treatment,wine,pref,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 2 | 1,1,2,0,1,0,1,0,1,0,1,1,1,1,0,1,1,0 3 | 1,2,2,0,0,0,1,0,0,1,0,0,0,1,1,0,1,0 4 | 1,1,1,0,0,0,1,0,1,1,0,0,0,1,1,1,1,0 5 | 1,2,2,0,1,1,0,1,0,0,1,1,1,0,0,1,1,1 6 | 1,1,1,0,0,0,1,0,1,1,1,1,1,1,0,1,1,1 7 | 1,2,2,1,0,1,1,0,0,0,1,1,1,0,0,1,0,0 8 | 1,1,2,1,1,1,0,0,1,0,0,1,0,0,0,1,1,0 9 | 1,2,1,0,1,0,1,1,1,1,0,1,0,0,1,0,0,1 10 | 1,1,2,0,1,1,1,0,1,1,0,1,0,1,1,0,0,0 11 | 1,2,1,0,1,0,1,0,1,1,1,1,0,1,0,1,1,1 12 | 1,1,1,1,1,1,0,1,0,1,1,0,1,0,1,1,0,0 13 | 1,2,2,0,1,0,0,0,0,0,1,0,1,0,1,1,1,0 14 | 1,1,1,0,1,1,0,0,0,1,1,0,0,0,0,0,0,1 15 | 1,2,1,1,1,0,1,0,1,1,1,0,1,0,0,0,0,1 16 | 1,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1,1,0,1,0 42 | 2,1,2,1,1,0,0,0,0,1,0,1,1,0,1,0,1,0 43 | 2,2,1,1,0,1,1,1,1,1,1,1,0,0,0,0,0,0 44 | 2,1,1,0,0,1,1,1,1,0,0,1,0,0,1,1,0,1 45 | 2,2,1,1,0,1,1,0,0,1,1,0,0,0,0,0,1,1 46 | 2,1,1,1,1,0,1,0,1,1,1,0,1,1,1,0,0,1 47 | 2,2,2,1,1,0,0,1,0,1,0,0,1,0,1,1,1,0 48 | 2,1,2,1,0,0,1,0,0,1,1,1,0,0,1,1,1,0 49 | 2,2,2,0,1,0,1,0,1,1,1,1,1,0,0,1,1,0 50 | -------------------------------------------------------------------------------- /actual/survey_3.csv: -------------------------------------------------------------------------------- 1 | treatment,wine,pref,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 2 | 1,1,0,0,1,0,0,1,0,0,0,0,1,0,0,0,1,0 3 | 1,2,1,0,0,1,0,0,1,0,1,0,0,0,0,0,0,0 4 | 1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5 | 1,2,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0 6 | 1,1,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,1 7 | 1,2,1,0,1,0,0,1,1,1,0,0,0,0,1,0,1,0 8 | 1,1,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,1 9 | 1,2,1,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0 10 | 1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0 11 | 1,2,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0 12 | 1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1 13 | 1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 14 | 1,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,0,0 15 | 1,2,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0 16 | 1,1,1,1,0,0,0,0,1,0,0,1,0,1,1,0,1,0 17 | 1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,2,0,0,1,0,0,0,0,1,0,1,0,0,1,0,1,1 146 | 2,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1 147 | 2,2,1,0,0,1,0,0,1,1,0,0,0,0,0,1,1,1 148 | -------------------------------------------------------------------------------- /analysis.r: -------------------------------------------------------------------------------- 1 | library("ggplot2") 2 | 3 | experiment.one <- read.table("samples/survey_1_2.csv", header = TRUE, sep=",") 4 | 5 | # Tables for the follow the herd experiment 6 | AB.herd <- matrix(c( 7 | # control A , treatment A added 8 | experiment.one[c(1,3),3] - experiment.one[c(1,3), 6], 9 | # control B , treatment B 10 | experiment.one[c(1,3),4] 11 | ), nr=2, dimnames=list(c("control", "treatment"), c("A", "B"))) 12 | 13 | AC.herd <- matrix(c( 14 | # control A , treatment A 15 | experiment.one[2,3], experiment.one[4,4], 16 | # control C , treatment C added 17 | experiment.one[2,4], experiment.one[4,3] - experiment.one[4,6] 18 | ), nr=2, dimnames=list(c("control", "treatment"), c("A", "C"))) 19 | 20 | # Tables for the follow the vip special access experiment 21 | AB.special <- matrix(c( 22 | # control A , treatment A 23 | experiment.one[1,3], experiment.one[5,3], 24 | # control B , treatment B special 25 | experiment.one[1,4], experiment.one[5,4] 26 | ), nr=2, dimnames=list(c("control", "treatment"), c("A", "B"))) 27 | 28 | AC.special <- matrix(c( 29 | # control A , treatment A 30 | experiment.one[2,3], experiment.one[6,3], 31 | # control C , treatment C special 32 | experiment.one[2,4], experiment.one[6,4] 33 | ), nr=2, dimnames=list(c("control", "treatment"), c("A", "C"))) 34 | 35 | # Running Analysis on the experiment 1 and 2 results 36 | # the fisher test produces a more accurate value for p than the chisq.test 37 | # feel free to change this to chisq.test though 38 | AB.herd.result <- fisher.test(AB.herd) 39 | AC.herd.result <- fisher.test(AC.herd) 40 | AB.special.result <- fisher.test(AB.special) 41 | AC.special.result <- fisher.test(AC.special) 42 | 43 | # if p.value < some alpha, then there is a significant association between 44 | # seeing more votes for one wine and wine preference 45 | # => to some extent people follow the herd when making judgments of taste 46 | alpha <- 0.05 47 | if(AB.herd.result$p.value < alpha){ "some herdiness" }else{ "unlikely to have herdiness"} 48 | if(AC.herd.result$p.value < alpha){ "some herdiness" }else{ "unlikely to have herdiness"} 49 | 50 | # having a vip special access deal and wine preference 51 | # => to some extent people are affected by the allusion of special treatment 52 | if(AB.special.result$p.value < alpha){ "vip matters" }else{ "unlikely that vip matters"} 53 | if(AC.special.result$p.value < alpha){ "vip matters" }else{ "unlikely that vip matters"} 54 | 55 | dist.AB.herd <- AB.herd / apply(AB.herd, 1, sum) 56 | dist.AC.herd <- AC.herd / apply(AC.herd, 1, sum) 57 | dist.AB.special <- AB.special / apply(AB.special, 1, sum) 58 | dist.AC.special <- AC.special / apply(AC.special, 1, sum) 59 | 60 | # still unsure how to show the proportion on this 61 | # (additional votes) / (total real vote sum at the station) 62 | # proportion is calculated from within the experiment 63 | added.to.A.treatment <- experiment.one[3,6] / sum(experiment.one[3,3:5]) 64 | added.to.C.treatment <- experiment.one[4,6] / sum(experiment.one[4,3:5]) 65 | 66 | # These bar charts don't look very good. 67 | barplot(dist.AB.herd, main="Follow the Herd? Distribution of Wine Preference", 68 | xlab="Wine Tasted", 69 | legend = rownames(AB.herd), beside=TRUE) 70 | barplot(dist.AC.herd, main="Follow the Herd? Distribution of Wine Preference", 71 | xlab="Wine Tasted", 72 | legend = rownames(AC.herd), beside=TRUE) 73 | barplot(dist.AB.special, main="VIP syndrome: Distribution of Wine Preference", 74 | xlab="Wine Tasted", 75 | legend = rownames(AB.special), beside=TRUE) 76 | barplot(dist.AC.special, main="VIP syndrome: Distribution of Wine Preference", 77 | xlab="Wine Tasted", 78 | legend = rownames(AC.special), beside=TRUE) 79 | 80 | # ggplot bar charts (need to add titles and other things legend markers) 81 | nice.plot <- function(exptable, filename="barplot.pdf", fillvals=c("#00C0c3", "#fa736f"), added_votes=c(0,0,0,0)) { 82 | df = data.frame(prop=c(exptable[,1], 83 | exptable[,2], 84 | added_votes), 85 | group=rownames(exptable), 86 | wine=rep(rep(colnames(exptable), each=2), 2)) 87 | 88 | # do things to change color here or potentially even save to a pdf 89 | # switch group and wine in this line to change grouping (group by treatment or group by wine) 90 | ggplot(df, aes(wine, prop, fill=wine, colour=wine)) + 91 | geom_bar(stat="identity") + 92 | facet_grid(. ~ group) + 93 | scale_colour_manual(values=c("#000000","#000000")) + 94 | scale_fill_manual(values=fillvals) + 95 | theme_bw() 96 | ggsave(filename) 97 | } 98 | 99 | # pick the wine colors as represented in the bar graph 100 | wine.A <- "#00C0c3" 101 | wine.B <- "#fa736f" 102 | wine.C <- "#e79d31" 103 | 104 | # votes added to a 105 | # 0,0.22,0,0.0 106 | nice.plot(dist.AB.herd, "experiment_1_AB.pdf", c(wine.A, wine.B), c(0,added.to.A.treatment,0,0)) 107 | # votes added to c 108 | # 0,0.00,0,0.1 109 | nice.plot(dist.AC.herd, "experiment_1_AC.pdf", c(wine.A, wine.C), c(0,0,0,added.to.C.treatment)) 110 | nice.plot(dist.AB.special, "experiment_2_AB.pdf", c(wine.A, wine.B), c(0,0,0,0)) 111 | nice.plot(dist.AC.special, "experiment_2_AC.pdf", c(wine.A, wine.C), c(0,0,0,0)) 112 | 113 | ###### 114 | # ACTUAL ANALYSIS FOR BAR CHARTS SINCE THE STUFF CAME OUT VERY DIFFERENTLY 115 | ###### 116 | act.one <- read.table("actual/survey_1_2.csv", header = TRUE, sep=",") 117 | 118 | A.merlot.normal <- act.one[1, 3] 119 | C.pinot.special <- act.one[1, 5] 120 | 121 | A.merlot.normal.two <- act.one[2, 3] 122 | C.crap.special <- act.one[2, 5] 123 | 124 | A.merlot.treatment <- act.one[3, 3] 125 | B.crap.treatment <- act.one[3, 5] 126 | 127 | A.merlot.control <- act.one[4, 3] 128 | B.crap.control <- act.one[4, 5] 129 | 130 | # experiment 1 131 | AB.herd <- matrix(c( 132 | A.merlot.control, A.merlot.treatment, 133 | B.crap.control, B.crap.treatment 134 | ), nr=2, dimnames=list(c("control", "treatment"), c("A", "B"))) 135 | 136 | nice.plot(AB.herd, "actual/experiment_1_AB.pdf", c(wine.B, wine.A)) 137 | 138 | # experiment 2 139 | exp.special <- data.frame(value=c( 140 | A.merlot.normal, C.pinot.special, 141 | A.merlot.normal.two, C.crap.special, 142 | A.merlot.control, B.crap.control), 143 | station=rep(c("station 1", "station 2", "station 4"), each=2), 144 | wine=c("A", "B", "A", "B", "A", "B")) 145 | 146 | ggplot(exp.special, 147 | aes(x=wine, 148 | y=value, 149 | fill=factor(wine))) + 150 | facet_grid(. ~ station) + 151 | geom_bar(stat="identity") + 152 | theme_bw() + 153 | opts(legend.position = "none", axis.title.x=theme_text(vjust=0)) 154 | ggsave("actual/experiment_2_ABC.pdf") 155 | -------------------------------------------------------------------------------- /experiment3.r: -------------------------------------------------------------------------------- 1 | library(ggplot2) 2 | library(reshape) 3 | ## creating the word cloud visualization 4 | library(wordcloud) 5 | library(RColorBrewer) 6 | 7 | non.word.columns <- 1:3 8 | 9 | treatment.ranks <- function(row, f) { 10 | sorted.cols = sort(f[row, -(non.word.columns)], decreasing=TRUE) 11 | as.integer(sub("X", "", colnames(sorted.cols))) 12 | } 13 | word.ranks <- function(berry, earthy) { 14 | berry.order <- data.frame(berry=1:length(berry),word=berry) 15 | berry.order <- berry.order[with(berry.order, order(word)), ] 16 | earthy.order <- data.frame(earthy=1:length(earthy),word=earthy) 17 | earthy.order <- earthy.order[with(earthy.order, order(word)), ] 18 | 19 | data.frame(berry=berry.order$berry,earthy=earthy.order$earthy,word=words[earthy.order$word,1],color=words[earthy.order$word,3]) 20 | } 21 | rank.chart <- function(ranks, title="Blah", filename="word-rank.pdf") { 22 | graph.df <- melt(ranks) 23 | ggplot(graph.df, aes(factor(variable), value, group = word, colour = color, label = word)) + 24 | geom_line() + 25 | geom_text(data = subset(graph.df, variable == "earthy"), aes(x = factor(variable)), size = 3.5, hjust = 0) + 26 | geom_text(data = subset(graph.df, variable == "berry"), aes(x = factor(variable)), size = 3.5, hjust = 1.0) + 27 | theme_bw() + 28 | opts(title=title, legend.position = "none", panel.border = theme_blank(), axis.ticks = theme_blank()) + 29 | scale_colour_identity() + 30 | scale_x_discrete(breaks = levels(graph.df$variable), labels = c("berry", "earthy")) + 31 | scale_y_continuous(breaks = NA, trans = "reverse") + xlab(NULL) + ylab(NULL) 32 | ggsave(filename) 33 | } 34 | output.cloud <- function(wine, treatment, d, filename="wordcloud.png") { 35 | crit <- d$wine == wine & d$treatment == treatment 36 | pal <- brewer.pal(8,"Dark2") 37 | png(filename, width=1280,height=800) 38 | wordcloud(d$variable[crit],d$value[crit], 39 | scale=c(8,.2), 40 | min.freq=1, 41 | max.words=Inf, 42 | random.order=FALSE, 43 | ordered.colors=TRUE, 44 | rot.per=.0, 45 | colors=as.character(words$color)) 46 | dev.off() 47 | } 48 | 49 | experiment.three <- read.table("actual/survey_3.csv", header = TRUE, sep=",") 50 | words <- read.table("samples/descriptors.csv", header = TRUE, sep=",") 51 | raw.words <- read.table("actual/survey_3.csv", header = TRUE, sep=",")[,-3] 52 | 53 | exp.melt <- melt(experiment.three, id.vars = c("treatment", "wine"), fun=sum) 54 | word.freq.table <- cast(wine + treatment ~ variable | value, data=exp.melt, fun.aggregate=sum)$`1` 55 | 56 | wine.D.berry.ranks <- treatment.ranks(1, word.freq.table) 57 | wine.D.earthy.ranks <- treatment.ranks(4, word.freq.table) 58 | wine.E.berry.ranks <- treatment.ranks(2, word.freq.table) 59 | wine.E.earthy.ranks <- treatment.ranks(3, word.freq.table) 60 | 61 | by.treatment <- rowsum(experiment.three, experiment.three[,1])[,-(non.word.columns)] 62 | by.wine <- rowsum(experiment.three, experiment.three[,2])[,-(non.word.columns)] 63 | 64 | wine.D.ranks <- word.ranks(wine.D.berry.ranks, wine.D.earthy.ranks) 65 | wine.E.ranks <- word.ranks(wine.E.berry.ranks, wine.E.earthy.ranks) 66 | 67 | wine.berry.to.earthy.ranks <- word.ranks(wine.E.berry.ranks, wine.D.earthy.ranks) 68 | 69 | berry.word <- treatment.ranks(1, data.frame(t(apply(data.frame(word.freq.table[1:2, ]),2, sum)))) 70 | earthy.word <- treatment.ranks(1, data.frame(t(apply(data.frame(word.freq.table[3:4, ]),2, sum)))) 71 | wine.berry.to.earthy.total.ranks <- word.ranks(berry.word, earthy.word) 72 | 73 | 74 | # ranking coherence 75 | given.earthy.ranks <- word.ranks(wine.D.earthy.ranks, wine.E.earthy.ranks) 76 | given.berry.ranks <- word.ranks(wine.D.berry.ranks, wine.E.berry.ranks) 77 | 78 | colnames(raw.words) <- c(colnames(raw.words)[1:2], 79 | as.character(words[as.integer(sub("X","",colnames(raw.words)[-(1:2)])),1])) 80 | raw.words.melt <- melt(raw.words, id.vars = c("treatment", "wine"), fun=sum) 81 | raw.words.melt.cast <- cast(wine + treatment ~ variable | value, data=raw.words.melt, fun.aggregate=sum)$`1` 82 | word.freq.df <- melt(raw.words.melt.cast) 83 | 84 | # charting the rank charts 85 | rank.chart(wine.D.ranks, "Wine D Word Usage Rank Given Association", "actual/word-rank-wine-d.pdf") 86 | rank.chart(wine.E.ranks, "Wine E Word Usage Rank Given Association", "actual/word-rank-wine-e.pdf") 87 | 88 | rank.chart(wine.berry.to.earthy.ranks, "Word Usage Rank Given Association", "actual/word-rank-berry-v-earthy.pdf") 89 | 90 | rank.chart(wine.berry.to.earthy.total.ranks, "Word Usage Rank Given Association", "actual/word-rank-berry-v-earthy-total.pdf") 91 | 92 | rank.chart(given.earthy.ranks, "Word Usage Wine Given Word", "actual/word-rank-d-v-e-earthy.pdf") 93 | rank.chart(given.berry.ranks, "Word Usage Wine Given Word", "actual/word-rank-d-v-e-berry.pdf") 94 | 95 | #wine, treatment 96 | output.cloud(1, 1, word.freq.df, "actual/Wine D as Berry.png") 97 | output.cloud(1, 2, word.freq.df, "actual/Wine E as Berry.png") 98 | 99 | output.cloud(2, 1, word.freq.df, "actual/Wine E as Earthy.png") 100 | output.cloud(2, 2, word.freq.df, "actual/Wine D as Earthy.png") 101 | 102 | # basic barcharts 103 | raw.words.melt.cast 104 | 105 | # overall total word choice 106 | graph.freq.df <- melt(apply(raw.words.melt.cast, 2, sum)) 107 | graph.freq.df$variable <- factor(rownames(graph.freq.df)) 108 | graph.freq.df$variable <- factor(graph.freq.df$variable, levels=as.character(graph.freq.df[with(graph.freq.df, order(value)), ]$variable), ordered=TRUE) 109 | colors <- as.character(words[order(graph.freq.df$variable),]$color) 110 | ggplot(graph.freq.df, aes(variable, value, fill=variable, colour=variable)) + 111 | geom_bar(stat="identity") + 112 | theme_bw() + 113 | scale_colour_manual(values=colors) + 114 | scale_fill_manual(values=colors) + 115 | xlab("Descriptors") + 116 | ylab("Frequency of Usage") + 117 | opts(legend.position = "none", axis.title.x=theme_text(vjust=0)) 118 | ggsave("actual/Word Frequency.pdf", width=18,height=12) 119 | 120 | # priming on word choice bar charts 121 | raw.words.melt.cast$wine.letter <- factor(c("D", "E", "E", "D")) 122 | raw.words.melt.cast$wine.type <- factor(c("Berry", "Berry", "Earthy", "Earthy")) 123 | raw.words.melt.cast$coherence <- factor(c("Truth", "False", "Truth", "False"), levels=c("Truth", "False"), ordered=TRUE) 124 | priming.graph.df <- melt(data.frame(raw.words.melt.cast[,-(c(1:3))]), id=15:17) 125 | priming.graph.df$word.type <- c(rep("Earthy", 4), 126 | rep("Neutral", 4), 127 | rep("Neutral", 4), 128 | rep("Earthy", 4), 129 | rep("Berry", 4), 130 | rep("Neutral", 4), 131 | rep("Berry", 4), 132 | rep("Earthy", 4), 133 | rep("Earthy", 4), 134 | rep("Berry", 4), 135 | rep("Neutral", 4), 136 | rep("Earthy", 4), 137 | rep("Earthy", 4), 138 | rep("Berry", 4)) 139 | priming.graph.colors <- as.character(words[mapply(function(x){ return(sub("\\.", " ", x)) }, levels(priming.graph.df$variable)), ]$color) 140 | 141 | ggplot(priming.graph.df, aes(wine.type, value, fill=variable, colour=variable)) + 142 | geom_bar(stat="identity") + 143 | facet_grid(word.type ~ variable) + 144 | theme_bw() + 145 | scale_colour_manual(values=priming.graph.colors) + 146 | scale_fill_manual(values=priming.graph.colors) + 147 | xlab("What was told") + 148 | ylab("Frequency of Usage") + 149 | opts(legend.position = "none", axis.title.x=theme_text(vjust=0)) 150 | ggsave("actual/by-word-type.pdf") 151 | 152 | # preference count visualizations and analysis 153 | preferences <- experiment.three[experiment.three$pref == 1, ] 154 | preferences$wine.type <- mapply(function(w,t){ 155 | if(w==2 && t==1) return("Earthy") 156 | if(w==1 && t==1) return("Berry") 157 | if (w==1 && t==2) return("Berry") 158 | if (w==2 && t==2) return("Earthy") 159 | }, 160 | preferences$wine, preferences$treatment) 161 | 162 | colnames(preferences) <- c("treatment", "wine", "pref", 163 | as.character(words$word), "wine.type") 164 | 165 | m.pref <- melt(preferences[,-(1:3)], id=16) 166 | 167 | # probability of word use | preference 168 | c.pref <- cast(wine.type ~ variable | value, data = m.pref, fun.aggregate=sum)$`1` 169 | colnames(c.pref) <- c("wine.type", as.character(words$word)) 170 | 171 | v.pref <- cast(variable ~ wine.type | value, data = m.pref, fun.aggregate=sum)$`1` 172 | v.pref$variable <- as.character(words$word) 173 | 174 | n.pref <- data.frame(berry=(v.pref$Berry + 1)/(colSums(v.pref)["Berry"] + 15), earthy=(v.pref$Earthy + 1)/(colSums(v.pref)["Earthy"] + 15)) 175 | nb.model.pref <- log(n.pref) 176 | 177 | m.pref$variable <- factor(m.pref$variable, levels=c("Black cherry", "Red fruits", "Juicy", "Plum", "Sweet", "Hearty", "Bright", "Spicy", "Peppery", "Complex", "Smokey", "Cedar", "Rustic", "Woodsy", "Earthy"), ordered=TRUE) 178 | 179 | m.pref.color <- as.character(words[as.character(cast(variable ~ value, data=m.pref, fun.aggregate=sum)$variable), ]$color) 180 | 181 | ggplot(m.pref, aes(variable, y=value, fill=variable, color=variable)) + 182 | facet_grid(. ~ wine.type) + 183 | geom_bar(stat="identity") + 184 | scale_colour_manual(values=m.pref.color) + 185 | scale_fill_manual(values=m.pref.color) + 186 | theme_bw() + 187 | opts(legend.position = "none", axis.title.x=theme_text(vjust=0)) 188 | ggsave("actual/words-given-pref.pdf") 189 | 190 | ggplot(m.pref, aes(wine.type, y=value, fill=variable, color=variable)) + 191 | facet_grid(. ~ variable) + 192 | geom_bar(stat="identity") + 193 | scale_colour_manual(values=m.pref.color) + 194 | scale_fill_manual(values=m.pref.color) + 195 | theme_bw() + 196 | opts(legend.position = "none", axis.title.x=theme_text(vjust=0)) 197 | ggsave("actual/pref-given-words.pdf") 198 | 199 | # preference counts when told the truth vs false 200 | word.freq.table$wine.letter <- factor(c("D", "E", "E", "D")) 201 | word.freq.table$wine.type <- factor(c("Berry", "Berry", "Earthy", "Earthy")) 202 | word.freq.table$coherence <- factor(c("Truth", "False", "Truth", "False"), levels=c("Truth", "False"), ordered=TRUE) 203 | ggplot(word.freq.table, 204 | aes(x=wine.letter, 205 | y=pref/c(26+29, 5+8), 206 | fill=factor(wine.letter))) + 207 | facet_grid(. ~ coherence) + 208 | ylab("Proportion of Preference") + 209 | geom_bar(stat="identity") + 210 | theme_bw() 211 | ggsave("actual/pref-count.pdf") 212 | --------------------------------------------------------------------------------