Skip to content

Instantly share code, notes, and snippets.

@nikita-barsukov
Last active August 29, 2015 14:25
Show Gist options
  • Save nikita-barsukov/f2deb1f04b52630a8adb to your computer and use it in GitHub Desktop.
Save nikita-barsukov/f2deb1f04b52630a8adb to your computer and use it in GitHub Desktop.
Performing t-tests and plotting density of page load times
library(ggplot2)
library(reshape)
library(plyr)
old_layout <- read.csv('log/old_layout.log', header=F, sep="\t")
old_layout <- old_layout$V1
new_layout <- read.csv('log/new_layout.log', header=F, sep="\t")
new_layout <- new_layout$V1
ds <- as.data.frame(cbind(old_layout[1:100], new_layout[1:100]))
colnames(ds) <- c('old_layout', 'new_layout')
ds.melt <- melt(ds)
cdat <- ddply(ds.melt, "variable", summarise, rating.mean=mean(value))
p <- ggplot(ds.melt, aes(x=value, fill=variable, color=variable)) +
geom_density(alpha=.5) +
ggtitle("Incidents dashboard page\nload time") +
guides(fill = guide_legend(override.aes = list(colour = NULL))) +
scale_fill_brewer(palette="Dark2", labels=c("Old layout", "New layout")) +
scale_color_brewer(palette="Dark2",guide=FALSE) +
xlab("Load time, sec") +
theme_bw() +
theme(
plot.title = element_text(vjust=1.5, size=20),
axis.text.y = element_blank(),
axis.text.y=element_blank(),
axis.ticks.y=element_blank(),
axis.title.y=element_blank(),
legend.title=element_blank()
)
print(p)
print(t.test(old_layout, new_layout, conf.level = 0.99))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment