ggplot(df.results1b, aes(p.value, project, fill = cohend.size)) +
geom_point(shape = 22, color = "black", size = 6) +
geom_vline(xintercept = 0.05) +
geom_label(aes(x=0.06, y = 0.75, fill = NULL, size=NULL), data=c(), label="p = 0.05", hjust=0,vjust=0, show.legend = F)+
labs(y = "", x = "p-value", color = "Null Hyp.", title = "Mann-Whitney tests results", subtitle = "H1 : Avrg. # of smells in unchanged components < Avrg. # of smells in changed components", fill = "Cohen's D")
plot(plots$`rq1b-correlation-changed-nSmells`)
plots[["rq1b-density-changed-nSmells"]] <-
ggplot(df.numSmells, aes(nSmells, fill= changeHasOccurredMetric)) +
geom_density(alpha = .5, color = "black") +
labs(x = "Avrg. number of smells", y = "", fill = "Change", title = "Density comparison of average number of smells in each version") +
xlim(0, 7.5)
plot(plots$`rq1b-density-changed-nSmells`)
df.aff <- left_join(df.affected, df.projects, by=c("project"="project", "version"="version")) %>%
group_by(project, name, type) %>%
summarise(firstAffected=min(versionIndex),
lastAffected=max(versionIndex),
firstSmellID=affectedByUniqueSmellId[which.min(versionIndex)],
lastSmellID=affectedByUniqueSmellId[which.max(versionIndex)]) %>%
filter(lastAffected - firstAffected > 0) # filter out affected for one version only
df.intro <- df.components %>%
group_by(project, name, type) %>%
summarise(firstIntroduced=min(versionIndex), lastSeen=max(versionIndex)) %>%
filter(lastSeen - firstIntroduced > 0) # filter out elements existing in one version only
df.join <- left_join(df.aff, df.intro, by=c("project", "name", "type")) %>%
mutate(windowStart=firstIntroduced, windowEnd=lastAffected)
df.window <- left_join(df.join, df.components,
by=c("project", "name", "type", "windowStart"="versionIndex")) %>%
rename(freqOfChangesStart=freqOfChanges) %>%
mutate(freqOfChangesStart=ifelse(is.na(freqOfChangesStart), 0, freqOfChangesStart)) %>%
left_join(df.components, by=c("project", "name", "type", "windowEnd"="versionIndex")) %>%
rename(freqOfChangesEnd=freqOfChanges) %>%
mutate(freqOfChangesEnd=ifelse(is.na(freqOfChangesEnd), 0, freqOfChangesEnd)) %>%
left_join(df.components, by=c("project", "name", "type", "firstAffected"="versionIndex")) %>%
rename(freqOfChangesMid=freqOfChanges) %>%
mutate(freqOfChangesMid=ifelse(is.na(freqOfChangesMid), 0, freqOfChangesMid)) %>%
select(project, name, type, firstAffected, lastAffected, firstIntroduced, lastSeen,
windowStart, windowEnd, freqOfChangesStart, freqOfChangesMid, freqOfChangesEnd) %>%
filter(windowStart < firstAffected & windowEnd > firstAffected) %>% # filter out 1-version before and after windows
mutate(windowBeforeSize = ifelse(firstAffected == windowStart, 1, firstAffected - windowStart),
windowAfterSize   = ifelse(windowEnd == firstAffected, 1, windowEnd - firstAffected)) %>%
mutate(frchBefore=(freqOfChangesMid - freqOfChangesStart),
frchAfter =(freqOfChangesEnd - freqOfChangesMid),
diff=frchBefore-frchAfter) %>%
filter(frchBefore >= 0 & frchAfter >= 0) %>%
group_by(project) %>%
mutate(max = max(windowBeforeSize + windowAfterSize), frchBefore = frchBefore / max, frchAfter = frchAfter / max, diff = diff / max) %>%
mutate(diffCol = diff < 0)
df.results2 <- df.window %>% group_by(project) %>%
summarise(n = n(), test=do.test.wtest(frchBefore, frchAfter)) %>%
unnest(cols=c(test)) %>%
filter(statistic > 0) %>%
mutate(null.hyp = ifelse(p.value > 0.05, "Accepted", "Rejected"))
stest  <- shapiro.test(sample(df.window$diff, min(5000, length(df.window$diff))))
stest
ggpubr::ggqqplot(df.window, x = "diff") + facet_wrap(~project, scales = "free_y") + theme_classic()
plots[["rq2-wtest-projects-null-hyp"]] <-
ggplot(df.results2, aes(x = p.value, y = project, fill=null.hyp)) +
geom_point(shape = 22, color = "black", size = 6) +
geom_vline(xintercept = 0.05) +
geom_label(aes(x=0.06, y = 0.75, fill = NULL, size=NULL), data=c(), label="p = 0.05", hjust=0,vjust=0, show.legend = F)+
labs(y="N. of projects", x="", title = "Wilcoxon signed rank test results", fill = "Null Hyp.")
plot(plots$`rq2-wtest-projects-null-hyp`)
df.window.melt <- reshape2::melt(df.window, id.vars=c("project", "type"), measure.vars=c("frchBefore", "frchAfter"))
plots[["rq2-frch-density-projects-individual"]] <-
ggplot(df.window.melt, aes(value, fill=variable, group=variable)) +
geom_density(alpha=0.5) +
geom_text(data = df.results2, aes(x=+Inf,y=+Inf,label=null.hyp, group=NULL,fill=NULL, color=null.hyp), hjust=1, vjust=1, color="blue") +
facet_wrap(~project, scales = "free") +
labs(x="Number of commits with change", y="Density", title = "Ratio of changes before and after the introduction of a smell")
plot(plots$`rq2-frch-density-projects-individual`)
text <- data.frame(variable = c("Before", "After"), value = c(.5, -.5))
plots[["rq2-frch-density-projects-all"]] <-
ggplot(df.window , aes(diff)) +
geom_text(data=text, aes(x=value, y=10, label = variable, fill=NULL), size = 3) +
geom_density(alpha=0.5, fill = "grey", color="black") +
facet_wrap(~project, scales="free_y") +
labs(x="Number of commits with change", y="Density", title = "Ratio of changes before and after the introduction of a smell")
plot(plots$`rq2-frch-density-projects-all`)
ggplot(df.window, aes(windowAfterSize, windowBeforeSize, color = diff)) + geom_point() + facet_wrap(~project) + geom_smooth(color="grey33",se=F, method="lm")
colors <- sapply(df.window$diff, function(x) ifelse(x<0, "red", "green"))
ggplot(df.window, aes(diff, project)) + geom_density_ridges(fill = "lightblue")
library(ggridges)
plots[["rq2-wtest-projects-null-hyp"]] <-
ggplot(df.results2, aes(x = p.value, y = project, fill=null.hyp)) +
geom_point(shape = 22, color = "black", size = 6) +
geom_vline(xintercept = 0.05) +
geom_label(aes(x=0.06, y = 0.75, fill = NULL, size=NULL), data=c(), label="p = 0.05", hjust=0,vjust=0, show.legend = F)+
labs(y="N. of projects", x="", title = "Wilcoxon signed rank test results", fill = "Null Hyp.")
plot(plots$`rq2-wtest-projects-null-hyp`)
df.window.melt <- reshape2::melt(df.window, id.vars=c("project", "type"), measure.vars=c("frchBefore", "frchAfter"))
plots[["rq2-frch-density-projects-individual"]] <-
ggplot(df.window.melt, aes(value, fill=variable, group=variable)) +
geom_density(alpha=0.5) +
geom_text(data = df.results2, aes(x=+Inf,y=+Inf,label=null.hyp, group=NULL,fill=NULL, color=null.hyp), hjust=1, vjust=1, color="blue") +
facet_wrap(~project, scales = "free") +
labs(x="Number of commits with change", y="Density", title = "Ratio of changes before and after the introduction of a smell")
plot(plots$`rq2-frch-density-projects-individual`)
text <- data.frame(variable = c("Before", "After"), value = c(.5, -.5))
plots[["rq2-frch-density-projects-all"]] <-
ggplot(df.window , aes(diff)) +
geom_text(data=text, aes(x=value, y=10, label = variable, fill=NULL), size = 3) +
geom_density(alpha=0.5, fill = "grey", color="black") +
facet_wrap(~project, scales="free_y") +
labs(x="Number of commits with change", y="Density", title = "Ratio of changes before and after the introduction of a smell")
plot(plots$`rq2-frch-density-projects-all`)
ggplot(df.window, aes(windowAfterSize, windowBeforeSize, color = diff)) + geom_point() + facet_wrap(~project) + geom_smooth(color="grey33",se=F, method="lm")
colors <- sapply(df.window$diff, function(x) ifelse(x<0, "red", "green"))
ggplot(df.window, aes(diff, project)) + geom_density_ridges(fill = "lightblue")
df.window <- left_join(df.join, df.components,
by=c("project", "name", "type", "windowStart"="versionIndex")) %>%
rename(freqOfChangesStart=freqOfChanges) %>%
mutate(freqOfChangesStart=ifelse(is.na(freqOfChangesStart), 0, freqOfChangesStart)) %>%
left_join(df.components, by=c("project", "name", "type", "windowEnd"="versionIndex")) %>%
rename(freqOfChangesEnd=freqOfChanges) %>%
mutate(freqOfChangesEnd=ifelse(is.na(freqOfChangesEnd), 0, freqOfChangesEnd)) %>%
left_join(df.components, by=c("project", "name", "type", "firstAffected"="versionIndex")) %>%
rename(freqOfChangesMid=freqOfChanges) %>%
mutate(freqOfChangesMid=ifelse(is.na(freqOfChangesMid), 0, freqOfChangesMid)) %>%
select(project, name, type, firstAffected, lastAffected, firstIntroduced, lastSeen,
windowStart, windowEnd, freqOfChangesStart, freqOfChangesMid, freqOfChangesEnd) %>%
mutate(windowBeforeSize = ifelse(firstAffected == windowStart, 1, firstAffected - windowStart),
windowAfterSize   = ifelse(windowEnd == firstAffected, 1, windowEnd - firstAffected)) %>%
mutate(frchBefore=(freqOfChangesMid - freqOfChangesStart),
frchAfter =(freqOfChangesEnd - freqOfChangesMid),
diff=frchBefore-frchAfter)
df.results2 <- df.window %>% group_by(project) %>%
summarise(n = n(), test=do.test.wtest(frchBefore, frchAfter)) %>%
unnest(cols=c(test)) %>%
filter(statistic > 0) %>%
mutate(null.hyp = ifelse(p.value > 0.05, "Accepted", "Rejected"))
stest  <- shapiro.test(sample(df.window$diff, min(5000, length(df.window$diff))))
stest
ggpubr::ggqqplot(df.window, x = "diff") + facet_wrap(~project, scales = "free_y") + theme_classic()
plots[["rq2-wtest-projects-null-hyp"]] <-
ggplot(df.results2, aes(x = p.value, y = project, fill=null.hyp)) +
geom_point(shape = 22, color = "black", size = 6) +
geom_vline(xintercept = 0.05) +
geom_label(aes(x=0.06, y = 0.75, fill = NULL, size=NULL), data=c(), label="p = 0.05", hjust=0,vjust=0, show.legend = F)+
labs(y="N. of projects", x="", title = "Wilcoxon signed rank test results", fill = "Null Hyp.")
plot(plots$`rq2-wtest-projects-null-hyp`)
df.window.melt <- reshape2::melt(df.window, id.vars=c("project", "type"), measure.vars=c("frchBefore", "frchAfter"))
plots[["rq2-frch-density-projects-individual"]] <-
ggplot(df.window.melt, aes(value, fill=variable, group=variable)) +
geom_density(alpha=0.5) +
geom_text(data = df.results2, aes(x=+Inf,y=+Inf,label=null.hyp, group=NULL,fill=NULL, color=null.hyp), hjust=1, vjust=1, color="blue") +
facet_wrap(~project, scales = "free") +
labs(x="Number of commits with change", y="Density", title = "Ratio of changes before and after the introduction of a smell")
plot(plots$`rq2-frch-density-projects-individual`)
text <- data.frame(variable = c("Before", "After"), value = c(.5, -.5))
plots[["rq2-frch-density-projects-all"]] <-
ggplot(df.window , aes(diff)) +
geom_text(data=text, aes(x=value, y=10, label = variable, fill=NULL), size = 3) +
geom_density(alpha=0.5, fill = "grey", color="black") +
facet_wrap(~project, scales="free_y") +
labs(x="Number of commits with change", y="Density", title = "Ratio of changes before and after the introduction of a smell")
plot(plots$`rq2-frch-density-projects-all`)
ggplot(df.window, aes(windowAfterSize, windowBeforeSize, color = diff)) +
geom_point() +
facet_wrap(~project) +
geom_smooth(color="grey33",se=F, method="lm")
ggplot(df.window, aes(diff, project)) + geom_density_ridges(fill = "lightblue")
df.window <- left_join(df.join, df.components,
by=c("project", "name", "type", "windowStart"="versionIndex")) %>%
rename(freqOfChangesStart=freqOfChanges) %>%
mutate(freqOfChangesStart=ifelse(is.na(freqOfChangesStart), 0, freqOfChangesStart)) %>%
left_join(df.components, by=c("project", "name", "type", "windowEnd"="versionIndex")) %>%
rename(freqOfChangesEnd=freqOfChanges) %>%
mutate(freqOfChangesEnd=ifelse(is.na(freqOfChangesEnd), 0, freqOfChangesEnd)) %>%
left_join(df.components, by=c("project", "name", "type", "firstAffected"="versionIndex")) %>%
rename(freqOfChangesMid=freqOfChanges) %>%
mutate(freqOfChangesMid=ifelse(is.na(freqOfChangesMid), 0, freqOfChangesMid)) %>%
select(project, name, type, firstAffected, lastAffected, firstIntroduced, lastSeen,
windowStart, windowEnd, freqOfChangesStart, freqOfChangesMid, freqOfChangesEnd) %>%
mutate(windowBeforeSize = ifelse(firstAffected == windowStart, 1, firstAffected - windowStart),
windowAfterSize   = ifelse(windowEnd == firstAffected, 1, windowEnd - firstAffected)) %>%
mutate(frchBefore = (freqOfChangesMid - freqOfChangesStart) / windowBeforeSize,
frchAfter  = (freqOfChangesEnd - freqOfChangesMid)   / windowAfterSize,
diff=frchBefore-frchAfter)
df.results2 <- df.window %>% group_by(project) %>%
summarise(n = n(), test=do.test.wtest(frchBefore, frchAfter)) %>%
unnest(cols=c(test)) %>%
filter(statistic > 0) %>%
mutate(null.hyp = ifelse(p.value > 0.05, "Accepted", "Rejected"))
plots[["rq2-wtest-projects-null-hyp"]] <-
ggplot(df.results2, aes(x = p.value, y = project, fill=null.hyp)) +
geom_point(shape = 22, color = "black", size = 6) +
geom_vline(xintercept = 0.05) +
geom_label(aes(x=0.06, y = 0.75, fill = NULL, size=NULL), data=c(), label="p = 0.05", hjust=0,vjust=0, show.legend = F)+
labs(y="N. of projects", x="", title = "Wilcoxon signed rank test results", fill = "Null Hyp.")
plot(plots$`rq2-wtest-projects-null-hyp`)
df.window.melt <- reshape2::melt(df.window, id.vars=c("project", "type"), measure.vars=c("frchBefore", "frchAfter"))
plots[["rq2-frch-density-projects-individual"]] <-
ggplot(df.window.melt, aes(value, fill=variable, group=variable)) +
geom_density(alpha=0.5) +
geom_text(data = df.results2, aes(x=+Inf,y=+Inf,label=null.hyp, group=NULL,fill=NULL, color=null.hyp), hjust=1, vjust=1, color="blue") +
facet_wrap(~project, scales = "free") +
labs(x="Number of commits with change", y="Density", title = "Ratio of changes before and after the introduction of a smell")
plot(plots$`rq2-frch-density-projects-individual`)
text <- data.frame(variable = c("Before", "After"), value = c(.5, -.5))
plots[["rq2-frch-density-projects-all"]] <-
ggplot(df.window , aes(diff)) +
geom_text(data=text, aes(x=value, y=10, label = variable, fill=NULL), size = 3) +
geom_density(alpha=0.5, fill = "grey", color="black") +
facet_wrap(~project, scales="free_y") +
labs(x="Number of commits with change", y="Density", title = "Ratio of changes before and after the introduction of a smell")
plot(plots$`rq2-frch-density-projects-all`)
ggplot(df.window, aes(windowAfterSize, windowBeforeSize, color = diff)) +
geom_point() +
facet_wrap(~project) +
geom_smooth(color="grey33",se=F, method="lm")
ggplot(df.window, aes(diff, project)) + geom_density_ridges(fill = "lightblue")
View(df.window)
df.window <- left_join(df.join, df.components,
by=c("project", "name", "type", "windowStart"="versionIndex")) %>%
rename(freqOfChangesStart=freqOfChanges) %>%
mutate(freqOfChangesStart=ifelse(is.na(freqOfChangesStart), 0, freqOfChangesStart)) %>%
left_join(df.components, by=c("project", "name", "type", "windowEnd"="versionIndex")) %>%
rename(freqOfChangesEnd=freqOfChanges) %>%
mutate(freqOfChangesEnd=ifelse(is.na(freqOfChangesEnd), 0, freqOfChangesEnd)) %>%
left_join(df.components, by=c("project", "name", "type", "firstAffected"="versionIndex")) %>%
rename(freqOfChangesMid=freqOfChanges) %>%
mutate(freqOfChangesMid=ifelse(is.na(freqOfChangesMid), 0, freqOfChangesMid)) %>%
select(project, name, type, firstAffected, lastAffected, firstIntroduced, lastSeen,
windowStart, windowEnd, freqOfChangesStart, freqOfChangesMid, freqOfChangesEnd) %>%
mutate(windowBeforeSize = ifelse(firstAffected == windowStart, 1, firstAffected - windowStart),
windowAfterSize   = ifelse(windowEnd == firstAffected, 1, windowEnd - firstAffected)) %>%
mutate(frchBefore = (freqOfChangesMid - freqOfChangesStart) / windowBeforeSize,
frchAfter  = (freqOfChangesEnd - freqOfChangesMid)   / windowAfterSize,
diff=frchBefore-frchAfter) %>%
filter(frchBefore > 0 | frchAfter > 0)
df.results2 <- df.window %>% group_by(project) %>%
summarise(n = n(), test=do.test.wtest(frchBefore, frchAfter)) %>%
unnest(cols=c(test)) %>%
filter(statistic > 0) %>%
mutate(null.hyp = ifelse(p.value > 0.05, "Accepted", "Rejected"))
plots[["rq2-wtest-projects-null-hyp"]] <-
ggplot(df.results2, aes(x = p.value, y = project, fill=null.hyp)) +
geom_point(shape = 22, color = "black", size = 6) +
geom_vline(xintercept = 0.05) +
geom_label(aes(x=0.06, y = 0.75, fill = NULL, size=NULL), data=c(), label="p = 0.05", hjust=0,vjust=0, show.legend = F)+
labs(y="N. of projects", x="", title = "Wilcoxon signed rank test results", fill = "Null Hyp.")
plot(plots$`rq2-wtest-projects-null-hyp`)
df.window.melt <- reshape2::melt(df.window, id.vars=c("project", "type"), measure.vars=c("frchBefore", "frchAfter"))
plots[["rq2-frch-density-projects-individual"]] <-
ggplot(df.window.melt, aes(value, fill=variable, group=variable)) +
geom_density(alpha=0.5) +
geom_text(data = df.results2, aes(x=+Inf,y=+Inf,label=null.hyp, group=NULL,fill=NULL, color=null.hyp), hjust=1, vjust=1, color="blue") +
facet_wrap(~project, scales = "free") +
labs(x="Number of commits with change", y="Density", title = "Ratio of changes before and after the introduction of a smell")
plot(plots$`rq2-frch-density-projects-individual`)
text <- data.frame(variable = c("Before", "After"), value = c(.5, -.5))
plots[["rq2-frch-density-projects-all"]] <-
ggplot(df.window , aes(diff)) +
geom_text(data=text, aes(x=value, y=10, label = variable, fill=NULL), size = 3) +
geom_density(alpha=0.5, fill = "grey", color="black") +
facet_wrap(~project, scales="free_y") +
labs(x="Number of commits with change", y="Density", title = "Ratio of changes before and after the introduction of a smell")
plot(plots$`rq2-frch-density-projects-all`)
ggplot(df.window, aes(windowAfterSize, windowBeforeSize, color = diff)) +
geom_point() +
facet_wrap(~project) +
geom_smooth(color="grey33",se=F, method="lm")
ggplot(df.window, aes(diff, project)) + geom_density_ridges(fill = "lightblue")
df.results2 <- df.window %>% group_by(project) %>%
summarise(n = n(), test=do.test.wtest(frchBefore, frchAfter)) %>%
unnest(cols=c(test)) %>%
mutate(null.hyp = ifelse(p.value > 0.05, "Accepted", "Rejected"))
plots[["rq2-wtest-projects-null-hyp"]] <-
ggplot(df.results2, aes(x = p.value, y = project, fill=null.hyp)) +
geom_point(shape = 22, color = "black", size = 6) +
geom_vline(xintercept = 0.05) +
geom_label(aes(x=0.06, y = 0.75, fill = NULL, size=NULL), data=c(), label="p = 0.05", hjust=0,vjust=0, show.legend = F)+
labs(y="N. of projects", x="", title = "Wilcoxon signed rank test results", fill = "Null Hyp.")
plot(plots$`rq2-wtest-projects-null-hyp`)
df.window.melt <- reshape2::melt(df.window, id.vars=c("project", "type"), measure.vars=c("frchBefore", "frchAfter"))
plots[["rq2-frch-density-projects-individual"]] <-
ggplot(df.window.melt, aes(value, fill=variable, group=variable)) +
geom_density(alpha=0.5) +
geom_text(data = df.results2, aes(x=+Inf,y=+Inf,label=null.hyp, group=NULL,fill=NULL, color=null.hyp), hjust=1, vjust=1, color="blue") +
facet_wrap(~project, scales = "free") +
labs(x="Number of commits with change", y="Density", title = "Ratio of changes before and after the introduction of a smell")
plot(plots$`rq2-frch-density-projects-individual`)
text <- data.frame(variable = c("Before", "After"), value = c(.5, -.5))
plots[["rq2-frch-density-projects-all"]] <-
ggplot(df.window , aes(diff)) +
geom_text(data=text, aes(x=value, y=10, label = variable, fill=NULL), size = 3) +
geom_density(alpha=0.5, fill = "grey", color="black") +
facet_wrap(~project, scales="free_y") +
labs(x="Number of commits with change", y="Density", title = "Ratio of changes before and after the introduction of a smell")
plot(plots$`rq2-frch-density-projects-all`)
ggplot(df.window, aes(windowAfterSize, windowBeforeSize, color = diff)) +
geom_point() +
facet_wrap(~project) +
geom_smooth(color="grey33",se=F, method="lm")
ggplot(df.window, aes(diff, project)) + geom_density_ridges(fill = "lightblue")
df.window <- left_join(df.join, df.components,
by=c("project", "name", "type", "windowStart"="versionIndex")) %>%
rename(freqOfChangesStart=freqOfChanges) %>%
mutate(freqOfChangesStart=ifelse(is.na(freqOfChangesStart), 0, freqOfChangesStart)) %>%
left_join(df.components, by=c("project", "name", "type", "windowEnd"="versionIndex")) %>%
rename(freqOfChangesEnd=freqOfChanges) %>%
mutate(freqOfChangesEnd=ifelse(is.na(freqOfChangesEnd), 0, freqOfChangesEnd)) %>%
left_join(df.components, by=c("project", "name", "type", "firstAffected"="versionIndex")) %>%
rename(freqOfChangesMid=freqOfChanges) %>%
mutate(freqOfChangesMid=ifelse(is.na(freqOfChangesMid), 0, freqOfChangesMid)) %>%
select(project, name, type, firstAffected, lastAffected, firstIntroduced, lastSeen,
windowStart, windowEnd, freqOfChangesStart, freqOfChangesMid, freqOfChangesEnd) %>%
mutate(windowBeforeSize = ifelse(firstAffected == windowStart, 1, firstAffected - windowStart),
windowAfterSize   = ifelse(windowEnd == firstAffected, 1, windowEnd - firstAffected)) %>%
mutate(frchBefore = (freqOfChangesMid - freqOfChangesStart) / (windowBeforeSize + windowAfterSize),
frchAfter  = (freqOfChangesEnd - freqOfChangesMid)   / (windowBeforeSize + windowAfterSize),
diff=frchBefore-frchAfter) %>%
filter(frchBefore > 0 | frchAfter > 0)
df.results2 <- df.window %>% group_by(project) %>%
summarise(n = n(), test=do.test.wtest(frchBefore, frchAfter)) %>%
unnest(cols=c(test)) %>%
mutate(null.hyp = ifelse(p.value > 0.05, "Accepted", "Rejected"))
plots[["rq2-wtest-projects-null-hyp"]] <-
ggplot(df.results2, aes(x = p.value, y = project, fill=null.hyp)) +
geom_point(shape = 22, color = "black", size = 6) +
geom_vline(xintercept = 0.05) +
geom_label(aes(x=0.06, y = 0.75, fill = NULL, size=NULL), data=c(), label="p = 0.05", hjust=0,vjust=0, show.legend = F)+
labs(y="N. of projects", x="", title = "Wilcoxon signed rank test results", fill = "Null Hyp.")
plot(plots$`rq2-wtest-projects-null-hyp`)
df.window.melt <- reshape2::melt(df.window, id.vars=c("project", "type"), measure.vars=c("frchBefore", "frchAfter"))
plots[["rq2-frch-density-projects-individual"]] <-
ggplot(df.window.melt, aes(value, fill=variable, group=variable)) +
geom_density(alpha=0.5) +
geom_text(data = df.results2, aes(x=+Inf,y=+Inf,label=null.hyp, group=NULL,fill=NULL, color=null.hyp), hjust=1, vjust=1, color="blue") +
facet_wrap(~project, scales = "free") +
labs(x="Number of commits with change", y="Density", title = "Ratio of changes before and after the introduction of a smell")
plot(plots$`rq2-frch-density-projects-individual`)
text <- data.frame(variable = c("Before", "After"), value = c(.5, -.5))
plots[["rq2-frch-density-projects-all"]] <-
ggplot(df.window , aes(diff)) +
geom_text(data=text, aes(x=value, y=10, label = variable, fill=NULL), size = 3) +
geom_density(alpha=0.5, fill = "grey", color="black") +
facet_wrap(~project, scales="free_y") +
labs(x="Number of commits with change", y="Density", title = "Ratio of changes before and after the introduction of a smell")
plot(plots$`rq2-frch-density-projects-all`)
ggplot(df.window, aes(windowAfterSize, windowBeforeSize, color = diff)) +
geom_point() +
facet_wrap(~project) +
geom_smooth(color="grey33",se=F, method="lm")
ggplot(df.window, aes(diff, project)) + geom_density_ridges(fill = "lightblue")
library(RColorBrewer)
ggplot(df.window, aes(diff, project)) + geom_density_ridges(fill = "spectral")
ggplot(df.window, aes(diff, project)) + geom_density_ridges() + scale_color_brewer(palette="spectral")
ggplot(df.window, aes(diff, project, fill = project)) + geom_density_ridges() + scale_color_brewer(palette="spectral")
ggplot(df.window, aes(diff, project, fill = project)) + geom_density_ridges() + scale_color_brewer(palette="greys")
ggplot(df.window, aes(diff, project, fill = diff)) + geom_density_ridges() + scale_color_brewer(palette="greys")
ggplot(df.window, aes(diff, project, fill = diff)) + geom_density_ridges_gradient() + scale_color_brewer(palette="greys")
ggplot(df.window, aes(diff, project, fill = project)) + geom_density_ridges_gradient() + scale_fill_brewer(palette="greys")
ggplot(df.window, aes(diff, project, fill = ..x..)) + geom_density_ridges_gradient() + scale_fill_brewer(palette="greys")
ggplot(df.window, aes(diff, project, fill = diff)) + geom_density_ridges_gradient() + scale_fill_brewer(palette="greys")
ggplot(df.window, aes(diff, project, fill = diff)) + geom_density_ridges_gradient() + scale_fill_brewer(palette="spectral")
library(RColorBrewer)
ggplot(df.window, aes(diff, project, fill = diff)) + geom_density_ridges_gradient() + scale_fill_brewer(palette="spectral")
library(viridis)
ggplot(df.window, aes(diff, project, fill = diff)) + geom_density_ridges_gradient() + scale_fill_viridis(begin = -1, end = 1, mid = 0, discrete = T)
ggplot(df.window, aes(diff, project, fill = diff)) + geom_density_ridges_gradient() + scale_fill_viridis(begin = -1, end = 1, discrete = T)
ggplot(df.window, aes(diff, project, fill = ..x..)) + geom_density_ridges_gradient() + scale_fill_viridis(begin = -1, end = 1, discrete = T)
ggplot(df.window, aes(diff, project, fill = ..x..)) + geom_density_ridges_gradient() + scale_fill_viridis(begin = -1, end = 1, discrete = F)
ggplot(df.window, aes(diff, project, fill = ..x..)) + geom_density_ridges_gradient() + scale_fill_viridis(begin =0, end = 1)
ggplot(df.window, aes(diff, project, fill = ..x..)) + geom_ridgeline_gradient() + scale_fill_viridis(begin =0, end = 1)
ggplot(df.window, aes(diff, project, fill = ..x..)) + geom_density_ridges_gradient() + scale_fill_viridis(begin =0, end = 1)
plots[["rq2-wtest-projects-null-hyp"]] <-
ggplot(df.results2, aes(x = p.value, y = project, fill=null.hyp)) +
geom_point(shape = 22, color = "black", size = 6) +
geom_vline(xintercept = 0.05) +
geom_label(aes(x=0.06, y = 0.75, fill = NULL, size=NULL), data=c(), label="p = 0.05", hjust=0,vjust=0, show.legend = F)+
labs(y="N. of projects", x="", title = "Wilcoxon signed rank test results", fill = "Null Hyp.")
plot(plots$`rq2-wtest-projects-null-hyp`)
df.window.melt <- reshape2::melt(df.window, id.vars=c("project", "type"), measure.vars=c("frchBefore", "frchAfter"))
plots[["rq2-frch-density-projects-individual"]] <-
ggplot(df.window.melt, aes(value, fill=variable, group=variable)) +
geom_density(alpha=0.5) +
geom_text(data = df.results2, aes(x=+Inf,y=+Inf,label=null.hyp, group=NULL,fill=NULL, color=null.hyp), hjust=1, vjust=1, color="blue") +
facet_wrap(~project, scales = "free") +
labs(x="Number of commits with change", y="Density", title = "Ratio of changes before and after the introduction of a smell")
plot(plots$`rq2-frch-density-projects-individual`)
text <- data.frame(variable = c("Before", "After"), value = c(.5, -.5))
plots[["rq2-frch-density-projects-all"]] <-
ggplot(df.window , aes(diff)) +
geom_text(data=text, aes(x=value, y=10, label = variable, fill=NULL), size = 3) +
geom_density(alpha=0.5, fill = "grey", color="black") +
facet_wrap(~project, scales="free_y") +
labs(x="Number of commits with change", y="Density", title = "Ratio of changes before and after the introduction of a smell")
plot(plots$`rq2-frch-density-projects-all`)
ggplot(df.window, aes(windowAfterSize, windowBeforeSize, color = diff)) +
geom_point() +
facet_wrap(~project) +
geom_smooth(color="grey33",se=F, method="lm")
ggplot(df.window, aes(diff, project, fill = ..x..)) + geom_density_ridges_gradient() + scale_fill_viridis(begin =0, end = 1)
ggplot(df.window, aes(-diff, project, fill = -diff)) + geom_density_ridges_gradient() + scale_fill_viridis(begin =0, end = 1)
ggplot(df.window, aes(-diff, project, fill =..x..)) + geom_density_ridges_gradient() + scale_fill_viridis(begin =0, end = 1)
df.window[df.window$diff > 0,]
df.window[abs(df.window$diff) > 1,]
df.window[abs(df.window$diff) > 1,]$diff
df.window <- left_join(df.join, df.components,
by=c("project", "name", "type", "windowStart"="versionIndex")) %>%
rename(freqOfChangesStart=freqOfChanges) %>%
mutate(freqOfChangesStart=ifelse(is.na(freqOfChangesStart), 0, freqOfChangesStart)) %>%
left_join(df.components, by=c("project", "name", "type", "windowEnd"="versionIndex")) %>%
rename(freqOfChangesEnd=freqOfChanges) %>%
mutate(freqOfChangesEnd=ifelse(is.na(freqOfChangesEnd), 0, freqOfChangesEnd)) %>%
left_join(df.components, by=c("project", "name", "type", "firstAffected"="versionIndex")) %>%
rename(freqOfChangesMid=freqOfChanges) %>%
mutate(freqOfChangesMid=ifelse(is.na(freqOfChangesMid), 0, freqOfChangesMid)) %>%
select(project, name, type, firstAffected, lastAffected, firstIntroduced, lastSeen,
windowStart, windowEnd, freqOfChangesStart, freqOfChangesMid, freqOfChangesEnd) %>%
mutate(windowBeforeSize = ifelse(firstAffected == windowStart, 1, firstAffected - windowStart),
windowAfterSize   = ifelse(windowEnd == firstAffected, 1, windowEnd - firstAffected)) %>%
mutate(frchBefore = (freqOfChangesMid - freqOfChangesStart) / (windowBeforeSize + windowAfterSize),
frchAfter  = (freqOfChangesEnd - freqOfChangesMid)   / (windowBeforeSize + windowAfterSize),
diff=frchBefore-frchAfter) %>%
filter((frchBefore > 0 | frchAfter > 0) & abs(diff) <= 1)
df.results2 <- df.window %>% group_by(project) %>%
summarise(n = n(), test=do.test.wtest(frchBefore, frchAfter)) %>%
unnest(cols=c(test)) %>%
mutate(null.hyp = ifelse(p.value > 0.05, "Accepted", "Rejected"))
plots[["rq2-wtest-projects-null-hyp"]] <-
ggplot(df.results2, aes(x = p.value, y = project, fill=null.hyp)) +
geom_point(shape = 22, color = "black", size = 6) +
geom_vline(xintercept = 0.05) +
geom_label(aes(x=0.06, y = 0.75, fill = NULL, size=NULL), data=c(), label="p = 0.05", hjust=0,vjust=0, show.legend = F)+
labs(y="N. of projects", x="", title = "Wilcoxon signed rank test results", fill = "Null Hyp.")
plot(plots$`rq2-wtest-projects-null-hyp`)
df.window.melt <- reshape2::melt(df.window, id.vars=c("project", "type"), measure.vars=c("frchBefore", "frchAfter"))
plots[["rq2-frch-density-projects-individual"]] <-
ggplot(df.window.melt, aes(value, fill=variable, group=variable)) +
geom_density(alpha=0.5) +
geom_text(data = df.results2, aes(x=+Inf,y=+Inf,label=null.hyp, group=NULL,fill=NULL, color=null.hyp), hjust=1, vjust=1, color="blue") +
facet_wrap(~project, scales = "free") +
labs(x="Number of commits with change", y="Density", title = "Ratio of changes before and after the introduction of a smell")
plot(plots$`rq2-frch-density-projects-individual`)
text <- data.frame(variable = c("Before", "After"), value = c(.5, -.5))
plots[["rq2-frch-density-projects-all"]] <-
ggplot(df.window , aes(diff)) +
geom_text(data=text, aes(x=value, y=10, label = variable, fill=NULL), size = 3) +
geom_density(alpha=0.5, fill = "grey", color="black") +
facet_wrap(~project, scales="free_y") +
labs(x="Number of commits with change", y="Density", title = "Ratio of changes before and after the introduction of a smell")
plot(plots$`rq2-frch-density-projects-all`)
ggplot(df.window, aes(-diff, project, fill =..x..)) + geom_density_ridges_gradient() + scale_fill_viridis(begin =0, end = 1)
ggplot(df.window, aes(-diff, project, fill =..x..)) +
geom_density_ridges_gradient() +
scale_fill_viridis(begin =0, end = 1) +
geom_vline(xintercept = 0)
ggplot(df.window, aes(-diff, project, fill =..x..)) +
geom_density_ridges_gradient(scale=4) +
scale_fill_viridis(begin =0, end = 1) +
geom_vline(xintercept = 0)
ggplot(df.window, aes(-diff, project, fill =..x..)) +
geom_density_ridges_gradient(scale = 3) +
scale_fill_viridis() +
geom_vline(xintercept = 0)
ggplot(df.window, aes(-diff, project, fill =..x..)) +
geom_density_ridges_gradient(scale = 3) +
scale_fill_viridis() +
geom_vline(xintercept = 0, color = "red")
ggplot(df.window, aes(-diff, project, fill =..x..)) +
geom_density_ridges_gradient(scale = 3) +
scale_fill_viridis() +
geom_vline(xintercept = 0, color = "grey")
ggplot(df.window, aes(-diff, project, fill =..x..)) +
geom_density_ridges_gradient(scale = 3) +
scale_fill_viridis() +
geom_vline(xintercept = 0, color = "orange")
labels <- data.frame(text=c("Before", "After"), position=c(-.5, .5))
ggplot(df.window, aes(-diff, project, fill =..x..)) +
geom_density_ridges_gradient(scale = 3) +
scale_fill_viridis() +
geom_vline(xintercept = 0, color = "orange") +
geom_label(data = labels, aes(positionx, positiony, label = text)) +
theme(legend.position = "none") +
labs(x = "Difference Ratio", y = "", title = "Difference between ratio of commits after and before introduction of a smell")
labels <- data.frame(text = c("Before", "After"), positionx = c(-.5, .5), positiony = c(20, 20))
ggplot(df.window, aes(-diff, project, fill =..x..)) +
geom_density_ridges_gradient(scale = 3) +
scale_fill_viridis() +
geom_vline(xintercept = 0, color = "orange") +
geom_label(data = labels, aes(positionx, positiony, label = text)) +
theme(legend.position = "none") +
labs(x = "Difference Ratio", y = "", title = "Difference between ratio of commits after and before introduction of a smell")
ggplot(df.window, aes(-diff, project, fill =..x..)) +
geom_density_ridges_gradient(scale = 3) +
scale_fill_viridis() +
geom_vline(xintercept = 0, color = "orange") +
geom_label(data = labels, aes(positionx, positiony, label = text, fill = NULL)) +
theme(legend.position = "none") +
labs(x = "Difference Ratio", y = "", title = "Difference between ratio of commits after and before introduction of a smell")
labels <- data.frame(text = c("Before", "After"), positionx = c(-.5, .5), positiony = c(21, 21))
ggplot(df.window, aes(-diff, project, fill =..x..)) +
geom_density_ridges_gradient(scale = 3) +
scale_fill_viridis() +
geom_vline(xintercept = 0, color = "orange") +
geom_label(data = labels, aes(positionx, positiony, label = text, fill = NULL)) +
theme(legend.position = "none") +
labs(x = "Difference Ratio", y = "", title = "Difference between ratio of commits after and before introduction of a smell")
labels <- data.frame(text = c("Before", "After"), positionx = c(-.5, .5), positiony = c(22, 22))
ggplot(df.window, aes(-diff, project, fill =..x..)) +
geom_density_ridges_gradient(scale = 3) +
scale_fill_viridis() +
geom_vline(xintercept = 0, color = "orange") +
geom_label(data = labels, aes(positionx, positiony, label = text, fill = NULL)) +
theme(legend.position = "none") +
labs(x = "Difference Ratio", y = "", title = "Difference between ratio of commits after and before introduction of a smell")
df.window <- df.window  %>% mutate(colorGroup = diff < 0)
df.window <- df.window  %>% mutate(colorGroup = ifelse(diff < 0, "before", "after"))
values<-df.window$diff
names(values)<-df.window$colorGroup
