# Seeking suggestions for summarizing and visualizing data

I have a dataset that includes individual responses to a series of questions. Participants played a game with one of two roles (hider, seeker) and indicated their response with a binary variable (0:BLUE, 1:RED). There were 4 within subject conditions and 3 between subject conditions.

I would somehow like to graphically summarize aggregate patterns in individual responses; i.e. I would like to summarize common patterns in each condition. For example, to see how many participants gave the same answer in each condition, across conditions, etc.

So I'm thinking of some kind of frequency distribution, but for each individual question. So probably some kind of multidimensional grid would be best. Any suggestions?

-
By "4 within subject conditions" do you mean 1 within subject variable with 4 values? Or 4 variables with an unspecified number of values each? Likewise for 3 between subject conditions. –  xan Aug 15 '11 at 23:26
@xan 1 within subject variable with 4 values and 1 between subject variable with 3 conditions –  Dbr Aug 16 '11 at 6:50

I like spider-web (radar/star) plots for multiple variables. The Swedish Hip Arthroplasty Register which I work with have nice spider plots that convey multiple variables nicely:

For an example on how to create them I've found the plotrix package (R), their example(radial.plot) has an example that shows how to create the plot:

ion.names<-c("Na","Ca","Mg","Cl","HCO3","SO4"
ions<-c(3.2,5,1,3.1,2.1,4.5)


diamondplot() in the same package may also be an alternative.

UPDATE

I've looked at the dataset and I've tried to figure out how to group the variables:

# I've saved the file as a csv so that it's easier to import it
library(foreign)

# Create a new clean dataset
# merge the different variable 4 future creation of the outcome variable
my_cleaned_data <- data.frame(id=my_data$subject.id, role=my_data$role,
no_GREEN=my_data$no..GREEN, no_RED=my_data$no..RED,
# This creates a variable where 1 == red and 2 == blue,
# any other value indicates an error, se below
org_colour=
((my_data$Colour.of.ball.from.Urn.1=="red")*1 + (my_data$Message.received=="red")*1 +
(my_data$Colour.of.ball.from.Urn.1=="blue")*2 + (my_data$Message.received=="blue")*2),
decision_colour=
((my_data$Decision.as.Hider=="RED")*1 + (my_data$Decision.as.Seeker=="RED")*1 +
(my_data$Decision.as.Hider=="BLUE")*2 + (my_data$Decision.as.Seeker=="BLUE")*2))

# There are some empty rows ==> remove all rows without id
my_cleaned_data <- subset(my_cleaned_data, id > 0)

# Check that only 1 & 2
table(my_cleaned_data$org_colour) table(my_cleaned_data$decision_colour)

# Factor and label the original colours
#  - not really necessary step but it's always nice to know your data
my_cleaned_data$org_colour = factor(my_cleaned_data$org_colour, levels=c(1, 2), labels=c("red", "blue"))
my_cleaned_data$decision_colour = factor(my_cleaned_data$decision_colour, levels=c(1, 2), labels=c("red", "blue"))

# Create the outcome variable
my_cleaned_data$same_colour = my_cleaned_data$org_colour==my_cleaned_data$decision_colour # Aggregate by the variables that your interested in # This part gets an average for the same colour & that id # I'm a little uncertain if no_GREEN may affect the average for that subject # since it is a variable that may change within the subject and the whole point # of this part is to aggregate by the id variable t <- aggregate(same_colour ~ id + role + no_RED + no_GREEN, data=my_cleaned_data, mean) # These are probably the outputs that you want to put into your graph # use the role data to sort out the different parts of the spider-web graph res.base <- aggregate(same_colour ~ role, data=t, mean) res.no_RED <- aggregate(same_colour ~ no_RED + role, data=t, mean) res.no_GREEN <- aggregate(same_colour ~ no_GREEN + role, data=t, mean) # Create the output for the spider web graph # I guess this is the lazy solution, there # probably is a much speedier solution out there # I find though sometimes that a little more code # often enhances the readability hider_data <- subset(res.no_RED, role=="hider") hider_data_output <- hider_data$same_colour
data_labels <- paste("No. RED:", hider_data$no_RED) hider_data <- subset(res.no_GREEN, role=="hider") hider_data_output <- c(hider_data_output, hider_data$same_colour)
data_labels <- c(data_labels, paste("No. GREEN:", hider_data$no_GREEN)) seeker_data <- subset(res.no_RED, role=="seeker") seeker_data_output <- seeker_data$same_colour
seeker_data <- subset(res.no_GREEN, role=="seeker")
seeker_data_output <- c(seeker_data_output, seeker_data\$same_colour)

# Create a 2-row matrix since we
# want to output two polygons
data_output <- rbind(seeker_data_output, hider_data_output)

library(plotrix)
# The plot with two transparent polygons, one yellow
# and the other one blue
# If you omit the .5 in limits you get more lines
# you could also add .25 & .75
labels=data_labels,
rp.type="p",
poly.col=c(rgb(255/255, 215/255, 0, .8), rgb(0, 0, 1, .8)),
line.col=c("black", "black"),
lwd=1)


Adding more complexity shouldn't be that hard. The same_color indicates the proportion with the same colour. This gives a graph:

I guess you need to ask yourself what the seeker/hider means and how their colours depend. If you want to know if they change colours depending on some base colour information it shouldn't matter that you merge the two into one variable since the don't overlap. I find it easier to calculate the change in this way.

-
here's an example of the dataset: dl.dropbox.com/u/22681355/example.xls I'm trying to summarize common patterns in the variables: decision as hider, decision as seeker. I'm interested in similarities in responses between participants in each condition (no.RED, 5, 7 , 9) –  Dbr Aug 15 '11 at 14:08
I've had quick look at the data, I think you need to start with how to group the data, I guess your interested in seeker/hider behaviour? I guess the question is: do they choose same or different color depending on their role? Your variable no.RED has in this sample no meaning since they are all 5. The questions you want to answer is the best place to start, what you describe is 4 different proportions and that is a fairly small amount of possibilities and is perhaps easiest displayed as bar charts. –  Max Gordon Aug 15 '11 at 18:30
there are 3 conditions for No. RED 5, 7 and 9 you just have to scroll down a bit, its separated with a few lines because I was doing some hand coding...but otherwise its pretty much what you're saying except that there are 3x4 conditions i.e 5,7,9 and no. green 1,2,3,4. still not sure though how to find common patterns and plot in bar charts. can you give a quick tutorial? thanks! –  Dbr Aug 15 '11 at 19:14
thanks for all the help! can you explain what you are doing when you define the variables org_colour and decision_colour ? are you aggregating the two variables and making it 1 and 2 instead of RED/BLUE? two things: one: colour from URN 1 and message received should not be aggregated because those are different things. two: can you also explain in words what you are doing? I really appreciate your help! –  Dbr Aug 15 '11 at 22:10
so what I'm interested in is common patterns in Decision as Hider and Decision as Seeker between participants and across conditions. For example did many Seeker's choose the same answers in the same condition? –  Dbr Aug 16 '11 at 8:37
show 1 more comment