Skip to content

Instantly share code, notes, and snippets.

@sashaphanes
Created May 9, 2013 21:08
Show Gist options
  • Save sashaphanes/5550645 to your computer and use it in GitHub Desktop.
Save sashaphanes/5550645 to your computer and use it in GitHub Desktop.
#read macaque data
setwd("/home/rosseraa/work.dir/allen.brain/")
macaque.raw.data = read.csv("macaque.common.regions.ANOVA.csv")
#standardize (z-score) macaque expression values
macaque.raw.data$expression = scale(macaque.raw.data$expression)
#run macaque ANOVA
aov.result = aov(expression ~ region, data=macaque.raw.data)
summary(aov.result) #is there a significant difference between any of the group means? If so, move onto a post-hoc test
TukeyHSD(aov.result) #post-hoc for multiple pairwise comparisons to see significant differences
summary(aov.result)[[1]][["Pr(>F)"]] #p-values
print(model.tables(aov.result, "means"), digits=4)
#read human data
human.raw.data = read.csv("human.common.regions.ANOVA.csv")
#run human ANOVA
aov.result = aov(expression ~ region, data=human.raw.data)
summary(aov.result)
TukeyHSD(aov.result)
summary(aov.result)[[1]][["Pr(>F)"]] #p-values
print(model.tables(aov.result, "means"), digits=4)
#visualize
par(mfrow=c(1,2))
boxplot(expression ~ region, data=macaque.raw.data, pch=20, main="macaque", las=2)
boxplot(expression ~ region, data=human.raw.data, pch=20, main="human", las=2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment