2024-07-15 22:20:46 +00:00
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(after_contrib_new ~ reading_time, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(after_contrib_new ~ flesch_reading_ease, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
contrib_readability_df <- contrib_readability_df |>
|
|
|
|
mutate(project_name = map_chr(filename, ~ {
|
|
|
|
parts <- str_split(.x, pattern = "_")[[1]]
|
|
|
|
if (length(parts) >= 1) {
|
|
|
|
head(parts, -1)
|
|
|
|
} else {
|
|
|
|
NA_character_
|
|
|
|
}
|
|
|
|
}))
|
|
|
|
parts[1] + parts[2]
|
|
|
|
contrib_readability_df <- contrib_readability_df |>
|
|
|
|
mutate(project_name = map_chr(filename, ~ {
|
|
|
|
parts <- str_split(.x, pattern = "_")[[1]]
|
|
|
|
if (length(parts) >= 1) {
|
|
|
|
parts[1] + parts[2]
|
|
|
|
} else {
|
|
|
|
NA_character_
|
|
|
|
}
|
|
|
|
}))
|
|
|
|
contrib_readability_df <- contrib_readability_df |>
|
|
|
|
mutate(project_name = map_chr(filename, ~ {
|
|
|
|
parts <- str_split(.x, pattern = "_")[[1]]
|
|
|
|
if (length(parts) >= 1) {
|
|
|
|
paste(head(parts, -1), collapse="")
|
|
|
|
} else {
|
|
|
|
NA_character_
|
|
|
|
}
|
|
|
|
}))
|
|
|
|
View(contrib_readability_df)
|
|
|
|
#libraries
|
|
|
|
library(stringr)
|
|
|
|
contrib_df <- read_csv("../final_data/deb_contrib_did.csv")
|
|
|
|
contrib_pop_df <- read_csv("../final_data/deb_contrib_pop_change.csv")
|
|
|
|
contrib_readability_df <- read_csv('../text_analysis/dwo_readability_contributing.csv')
|
|
|
|
contrib_pop_df <- contrib_pop_df |>
|
|
|
|
mutate(project_name = map_chr(upstream_vcs_link, ~ {
|
|
|
|
parts <- str_split(.x, pattern = "/")[[1]]
|
|
|
|
if (length(parts) >= 1) {
|
|
|
|
parts[length(parts)]
|
|
|
|
} else {
|
|
|
|
NA_character_
|
|
|
|
}
|
|
|
|
}))
|
|
|
|
contrib_readability_df <- contrib_readability_df |>
|
|
|
|
mutate(project_name = map_chr(filename, ~ {
|
|
|
|
parts <- str_split(.x, pattern = "_")[[1]]
|
|
|
|
if (length(parts) >= 1) {
|
|
|
|
paste(head(parts, -1), collapse="_")
|
|
|
|
} else {
|
|
|
|
NA_character_
|
|
|
|
}
|
|
|
|
}))
|
|
|
|
contrib_total_df <- contrib_pop_df |>
|
|
|
|
join(contrib_readability_df, by="project_name")
|
|
|
|
View(contrib_total_df)
|
|
|
|
# test regressions
|
|
|
|
library(MASS)
|
|
|
|
lm1 <- glm.nb(after_contrib_new ~ flesch_reading_ease, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(after_contrib_new ~ flesch_reading_ease + age_in_days, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
View(contrib_df)
|
|
|
|
source("~/Desktop/git/24_deb_gov/R/contrib_docChar_outcomes.R")
|
|
|
|
View(windowed_data)
|
|
|
|
View(windowed_data)
|
|
|
|
summed_data <- windowed_data |>
|
|
|
|
group_by(upstream_vcs_link) |>
|
|
|
|
summarize(total_ct_after_all = sum(ct_after_all))
|
|
|
|
summed_data <- windowed_data |>
|
|
|
|
filter(window="ct_after_all") |>
|
|
|
|
group_by(upstream_vcs_link) |>
|
|
|
|
summarize(total_ct_after_all = sum(count))
|
|
|
|
summed_data <- windowed_data |>
|
|
|
|
filter(window=="ct_after_all") |>
|
|
|
|
group_by(upstream_vcs_link) |>
|
|
|
|
summarize(total_ct_after_all = sum(count))
|
|
|
|
View(summed_data)
|
|
|
|
summed_data <- windowed_data |>
|
|
|
|
filter(window=="ct_after_all") |>
|
|
|
|
group_by(upstream_vcs_link) |>
|
|
|
|
mutate(total_ct_after_all = sum(count))
|
|
|
|
View(summed_data)
|
|
|
|
summed_data <- windowed_data |>
|
|
|
|
filter(window=="ct_after_all") |>
|
|
|
|
group_by(upstream_vcs_link) |>
|
|
|
|
summarize(total_ct_after_all = sum(count)) |> ungroup()
|
|
|
|
View(summed_data)
|
|
|
|
View(windowed_data)
|
|
|
|
summed_data <- windowed_data |>
|
|
|
|
filter(window=="ct_after_all") |>
|
|
|
|
group_by(upstream_vcs_link) |>
|
|
|
|
summarise_at(vars(count), list(name=sum))
|
|
|
|
View(summed_data)
|
|
|
|
summed_data <- windowed_data |>
|
|
|
|
filter(D==1) |>
|
|
|
|
group_by(upstream_vcs_link) |>
|
|
|
|
summarise_at(vars(count), list(summed_count=sum))
|
|
|
|
View(summed_data)
|
|
|
|
source("~/Desktop/git/24_deb_gov/R/contrib_docChar_outcomes.R")
|
|
|
|
contrib_total_df <- contrib_total_df|>
|
|
|
|
join(summed_data, by=upstream_vcs_link)
|
|
|
|
contrib_total_df <- contrib_pop_df |>
|
|
|
|
join(contrib_readability_df, by="project_name")
|
|
|
|
View(contrib_total_df)
|
|
|
|
contrib_total_df <- contrib_total_df|>
|
|
|
|
join(summed_data, by=upstream_vcs_link)
|
|
|
|
View(summed_data)
|
|
|
|
contrib_total_df <- contrib_total_df|>
|
|
|
|
join(summed_data, by="upstream_vcs_link")
|
|
|
|
View(contrib_total_df)
|
|
|
|
View(contrib_df)
|
|
|
|
source("~/Desktop/git/24_deb_gov/R/contrib_docChar_outcomes.R")
|
|
|
|
#outcome variable that is number of commits by number of new contributors
|
|
|
|
contrib_total_df$commit_by_contrib = contrib_total_df$summed_count * contrib_total_df$after_contrib_new
|
|
|
|
# test regressions
|
|
|
|
library(MASS)
|
|
|
|
lm1 <- glm.nb(after_contrib_new ~ flesch_reading_ease + age_in_days, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ flesch_reading_ease + age_in_days, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
View(contrib_total_df)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ word_count, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
contrib_total_df$scaled_outcome = scale(contrib_total_df$commit_by_contrib)
|
|
|
|
lm1 <- glm.nb(scaled_outcome ~ word_count + flesch_kincaid, data = contrib_total_df)
|
|
|
|
lm1 <- glm.nb(scaled_outcome ~ word_count + flesch_kincaid_grade, data = contrib_total_df)
|
|
|
|
contrib_total_df$logged_outcome = log1p(contrib_total_df$commit_by_contrib)
|
|
|
|
# test regressions
|
|
|
|
library(MASS)
|
|
|
|
lm1 <- glm.nb(scaled_outcome ~ word_count + flesch_kincaid_grade, data = contrib_total_df)
|
|
|
|
lm1 <- glm.nb(logged_outcome ~ word_count + flesch_kincaid_grade, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(logged_outcome ~ word_count + flesch_kincaid_grade + linsear_write_formula, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
contrib_total_df$scaled_outcome = scale(contrib_total_df$commit_by_contrib)
|
|
|
|
# test regressions
|
|
|
|
library(MASS)
|
|
|
|
lm1 <- lm(scaled_outcome ~ word_count + flesch_kincaid_grade + linsear_write_formula, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(logged_outcome ~ word_count + flesch_kincaid_grade + linsear_write_formula, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(logged_outcome ~ word_count + flesch_kincaid_grade + linsear_write_formula + mcalpine_eflaw, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(logged_outcome ~ word_count + flesch_kincaid_grade + linsear_write_formula + mcalpine_eflaw + dale_chall_readability_score, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(logged_outcome ~ word_count + dale_chall_readability_score, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(logged_outcome ~ word_count + reading_time, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ word_count + reading_time, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ word_count + flesch_kincaid_grade, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
#libraries
|
|
|
|
library(stringr)
|
|
|
|
readme_df <- read_csv("../final_data/deb_readme_did.csv")
|
|
|
|
readme_pop_df <- read_csv("../final_data/deb_readme_pop_change.csv")
|
|
|
|
readme_readability_df <- read_csv('../text_analysis/dwo_readability_readmeuting.csv')
|
|
|
|
source("~/Desktop/git/24_deb_gov/R/readme_docChar_outcomes.R")
|
|
|
|
source("~/Desktop/git/24_deb_gov/R/readme_docChar_outcomes.R")
|
|
|
|
lm1 <- glm.nb(commit_by_readme ~ word_count + flesch_kincaid_grade, data = readme_total_df)
|
|
|
|
View(readme_readability_df)
|
|
|
|
readme_readability_df <- readme_readability_df |>
|
|
|
|
mutate(project_name = map_chr(filename, ~ {
|
|
|
|
parts <- str_split(.x, pattern = "_")[[1]]
|
|
|
|
if (length(parts) >= 1) {
|
|
|
|
paste(head(parts, -1), collapse="_")
|
|
|
|
} else {
|
|
|
|
NA_character_
|
|
|
|
}
|
|
|
|
}))
|
|
|
|
readme_total_df <- readme_pop_df |>
|
|
|
|
join(readme_readability_df, by="project_name")
|
|
|
|
readme_total_df <- readme_total_df|>
|
|
|
|
join(summed_data, by="upstream_vcs_link")
|
|
|
|
#outcome variable that is number of commits by number of new readmeutors
|
|
|
|
readme_total_df$commit_by_readme = readme_total_df$summed_count * readme_total_df$after_readme_new
|
|
|
|
readme_total_df$logged_outcome = log(readme_total_df$commit_by_readme)
|
|
|
|
View(readme_total_df)
|
|
|
|
View(readme_total_df)
|
|
|
|
#outcome variable that is number of commits by number of new readmeutors
|
|
|
|
readme_total_df$commit_by_readme = readme_total_df$summed_count * readme_total_df$after_readme_new
|
|
|
|
View(readme_total_df)
|
|
|
|
View(readme_readability_df)
|
|
|
|
readme_pop_df[readme_pop_df['upstream_vcs_link'] == "https://github.com/agateau/yokadi/issues/new", "project_name"] = "yokadi"
|
|
|
|
View(readme_pop_df)
|
|
|
|
readme_pop_df[readme_pop_df['upstream_vcs_link'] == "https://github.com/SciRuby/rb-gsl/issues/new", "project_name"] = "rb-gsl"
|
|
|
|
source("~/Desktop/git/24_deb_gov/R/readme_docChar_outcomes.R")
|
|
|
|
readme_readability_df <- readme_readability_df |>
|
|
|
|
mutate(project_name = map_chr(filename, ~ {
|
|
|
|
parts <- str_split(.x, pattern = "_")[[1]]
|
|
|
|
if (length(parts) >= 1) {
|
|
|
|
paste(head(parts, -1), collapse="_")
|
|
|
|
} else {
|
|
|
|
NA_character_
|
|
|
|
}
|
|
|
|
}))
|
|
|
|
readme_readability_df[readme_readability_df['filename'] == "yder_README_8md.html", "project_name"] = "yder"
|
|
|
|
readme_readability_df[readme_readability_df['filename'] == "pg_filedump.git_README.pg_filedump", "project_name"] = "pg_filedump.git"
|
|
|
|
readme_readability_df[readme_readability_df['filename'] == "openvas_UPGRADE_README", "project_name"] = "openvas"
|
|
|
|
readme_readability_df[readme_readability_df['filename'] == "hyphen.git_README_hyph_en_US.txt", "project_name"] = "hyphen.git"
|
|
|
|
readme_readability_df[readme_readability_df['filename'] == "cycle.git_README_ru.html", "project_name"] = "cycle.git"
|
|
|
|
readme_readability_df[readme_readability_df['filename'] == "diffuse.git_README_ru", "project_name"] = "diffuse.git"
|
|
|
|
readme_readability_df[readme_readability_df['filename'] == "CheMPS2_README_8md_source.html", "project_name"] = "CheMPS2"
|
|
|
|
readme_readability_df[readme_readability_df['filename'] == "sleuthkit_README_win32.txt", "project_name"] = "sleuthkit"
|
|
|
|
readme_readability_df[readme_readability_df['filename'] == "Lmod_README_lua_modulefiles.txt", "project_name"] = "Lmod"
|
|
|
|
readme_readability_df[readme_readability_df['filename'] == "engauge_debian_README_for_osx", "project_name"] = "engauge_debian"
|
|
|
|
readme_total_df <- readme_pop_df |>
|
|
|
|
join(readme_readability_df, by="project_name")
|
|
|
|
readme_total_df <- readme_total_df|>
|
|
|
|
join(summed_data, by="upstream_vcs_link")
|
|
|
|
#outcome variable that is number of commits by number of new readmeutors
|
|
|
|
readme_total_df$commit_by_readme = readme_total_df$summed_count * readme_total_df$after_readme_new
|
|
|
|
View(readme_total_df)
|
|
|
|
readme_total_df$logged_outcome = log(readme_total_df$commit_by_readme)
|
|
|
|
#outcome variable that is number of commits by number of new readmeutors
|
|
|
|
readme_total_df$commit_by_readme = readme_total_df$summed_count * readme_total_df$after_readme_new
|
|
|
|
#outcome variable that is number of commits by number of new readmeutors
|
|
|
|
readme_total_df$commit_by_contrib = readme_total_df$summed_count * readme_total_df$after_readme_new
|
|
|
|
#outcome variable that is number of commits by number of new readmeutors
|
|
|
|
readme_total_df$commit_by_contrib = NA
|
|
|
|
readme_total_df$commit_by_contrib = readme_total_df$summed_count * readme_total_df$after_readme_new
|
|
|
|
View(readme_total_df)
|
|
|
|
View(readme_total_df)
|
|
|
|
readme_total_df$commit_by_contrib = readme_total_df$summed_count * readme_total_df$after_contrib_new
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ word_count + flesch_kincaid_grade, data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
readme_total_df$logged_outcome = log(readme_total_df$commit_by_readme)
|
|
|
|
readme_total_df$logged_outcome = log(readme_total_df$commit_by_contrib)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ word_count + flesch_kincaid_grade, data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(summed_count ~ word_count + flesch_kincaid_grade, data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ word_count + flesch_kincaid_grade, data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(after_contrib_new ~ word_count + flesch_kincaid_grade, data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(after_contrib_new ~ word_count + reading_time, data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ word_count + reading_time, data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(reading_time ~ word_count , data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
View(readme_total_df)
|
|
|
|
lm1 <- glm.nb(reading_time ~ flesch_reading_ease , data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(flesch_reading_ease ~ reading_time , data = readme_total_df)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ reading_time , data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ reading_time + linsear_write_formula , data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
readme_total_df$commit_by_contrib = readme_total_df$summed_count * (readme_total_df$after_contrib_new + 1)
|
|
|
|
readme_total_df$logged_outcome = log(readme_total_df$commit_by_contrib)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ reading_time + linsear_write_formula , data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
readme_total_df$logged_outcome = log1p(readme_total_df$commit_by_contrib)
|
|
|
|
lm1 <- glm.nb(logged_outcome ~ reading_time + linsear_write_formula , data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(logged_outcome ~ reading_time + linsear_write_formula + flesch_reading_ease, data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(logged_outcome ~ reading_time + linsear_write_formula + flesch_reading_ease + mcalpine_eflaw, data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(summed_count~ reading_time + linsear_write_formula + flesch_reading_ease + mcalpine_eflaw, data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(summed_count~ reading_time + linsear_write_formula + flesch_reading_ease + mcalpine_eflaw + word_count, data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(logged_outcome~ reading_time + linsear_write_formula + flesch_reading_ease + mcalpine_eflaw + word_count, data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
source("~/Desktop/git/24_deb_gov/R/contrib_docChar_outcomes.R")
|
|
|
|
lm1 <- glm.nb(logged_outcome~ reading_time + linsear_write_formula + flesch_reading_ease + mcalpine_eflaw + word_count, data = contrib_total_df)
|
|
|
|
contrib_total_df$logged_outcome = log1p(contrib_total_df$commit_by_contrib)
|
|
|
|
lm1 <- glm.nb(logged_outcome ~ reading_time + linsear_write_formula + flesch_reading_ease + mcalpine_eflaw + word_count, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(summed_count ~ reading_time + linsear_write_formula + flesch_reading_ease + mcalpine_eflaw + word_count, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
2024-07-16 15:05:21 +00:00
|
|
|
contrib_topics_df <- read_csv("../text_analysis/contrib_file_topic_distributions.csv")
|
|
|
|
library(tidyverse)
|
|
|
|
contrib_topics_df <- read_csv("../text_analysis/contrib_file_topic_distributions.csv")
|
|
|
|
View(contrib_topics_df)
|
|
|
|
source("~/Desktop/git/24_deb_gov/R/contrib_topic_outcomes.R")
|
|
|
|
source("~/Desktop/git/24_deb_gov/R/contrib_topic_outcomes.R")
|
|
|
|
source("~/Desktop/git/24_deb_gov/R/contrib_docChar_outcomes.R")
|
|
|
|
source("~/Desktop/git/24_deb_gov/R/contrib_topic_outcomes.R")
|
|
|
|
source("~/Desktop/git/24_deb_gov/R/contrib_topic_outcomes.R")
|
|
|
|
source("~/Desktop/git/24_deb_gov/R/contrib_topic_outcomes.R")
|
|
|
|
lm1 <- glm.nb(summed_count ~ t0 + t1 + t2 + t3, data = contrib_total_df)
|
|
|
|
#running regressions
|
|
|
|
library(MASS)
|
|
|
|
lm1 <- glm.nb(summed_count ~ t0 + t1 + t2 + t3, data = contrib_total_df)
|
|
|
|
source("~/Desktop/git/24_deb_gov/R/contrib_topic_outcomes.R")
|
|
|
|
library(stringr)
|
|
|
|
library(plyr)
|
|
|
|
contrib_topics_df <- read_csv("../text_analysis/contrib_file_topic_distributions.csv")
|
|
|
|
contrib_df <- read_csv("../final_data/deb_contrib_did.csv")
|
|
|
|
contrib_pop_df <- read_csv("../final_data/deb_contrib_pop_change.csv")
|
|
|
|
#get the contribution count
|
|
|
|
#some preprocessing and expansion
|
|
|
|
col_order <- c("upstream_vcs_link", "age_in_days", "first_commit", "first_commit_dt", "event_gap", "event_date", "event_hash", "before_all_ct", "after_all_ct", "before_mrg_ct", "after_mrg_ct", "before_auth_new", "after_auth_new", "before_commit_new", "after_commit_new")
|
|
|
|
contrib_df <- contrib_df[,col_order]
|
|
|
|
contrib_df$ct_before_all <- str_split(gsub("[][]","", contrib_df$before_all_ct), ", ")
|
|
|
|
contrib_df$ct_after_all <- str_split(gsub("[][]","", contrib_df$after_all_ct), ", ")
|
|
|
|
contrib_df$ct_before_mrg <- str_split(gsub("[][]","", contrib_df$before_mrg_ct), ", ")
|
|
|
|
contrib_df$ct_after_mrg <- str_split(gsub("[][]","", contrib_df$after_mrg_ct), ", ")
|
|
|
|
drop <- c("before_all_ct", "before_mrg_ct", "after_all_ct", "after_mrg_ct")
|
|
|
|
contrib_df = contrib_df[,!(names(contrib_df) %in% drop)]
|
|
|
|
# 2 some expansion needs to happens for each project
|
|
|
|
expand_timeseries <- function(project_row) {
|
|
|
|
longer <- project_row |>
|
|
|
|
pivot_longer(cols = starts_with("ct"),
|
|
|
|
names_to = "window",
|
|
|
|
values_to = "count") |>
|
|
|
|
unnest(count)
|
|
|
|
longer$observation_type <- gsub("^.*_", "", longer$window)
|
|
|
|
longer <- ddply(longer, "observation_type", transform, week=seq(from=0, by=1, length.out=length(observation_type)))
|
|
|
|
longer$count <- as.numeric(longer$count)
|
|
|
|
#longer <- longer[which(longer$observation_type == "all"),]
|
|
|
|
return(longer)
|
|
|
|
}
|
|
|
|
expanded_data <- expand_timeseries(contrib_df[1,])
|
|
|
|
for (i in 2:nrow(contrib_df)){
|
|
|
|
expanded_data <- rbind(expanded_data, expand_timeseries(contrib_df[i,]))
|
|
|
|
}
|
|
|
|
#filter out the windows of time that we're looking at
|
|
|
|
window_num <- 8
|
|
|
|
windowed_data <- expanded_data |>
|
|
|
|
filter(week >= (27 - window_num) & week <= (27 + window_num)) |>
|
|
|
|
mutate(D = ifelse(week > 27, 1, 0))
|
|
|
|
summed_data <- windowed_data |>
|
|
|
|
filter(D==1) |>
|
|
|
|
group_by(upstream_vcs_link) |>
|
|
|
|
summarise_at(vars(count), list(summed_count=sum))
|
|
|
|
#concat dataframes into central data
|
|
|
|
contrib_pop_df <- contrib_pop_df |>
|
|
|
|
mutate(project_name = map_chr(upstream_vcs_link, ~ {
|
|
|
|
parts <- str_split(.x, pattern = "/")[[1]]
|
|
|
|
if (length(parts) >= 1) {
|
|
|
|
parts[length(parts)]
|
|
|
|
} else {
|
|
|
|
NA_character_
|
|
|
|
}
|
|
|
|
}))
|
|
|
|
contrib_topic_df <- contrib_topic_df |>
|
|
|
|
mutate(project_name = map_chr(filename, ~ {
|
|
|
|
parts <- str_split(.x, pattern = "_")[[1]]
|
|
|
|
if (length(parts) >= 1) {
|
|
|
|
paste(head(parts, -1), collapse="_")
|
|
|
|
} else {
|
|
|
|
NA_character_
|
|
|
|
}
|
|
|
|
}))
|
|
|
|
contrib_topics_df <- contrib_topics_df |>
|
|
|
|
mutate(project_name = map_chr(filename, ~ {
|
|
|
|
parts <- str_split(.x, pattern = "_")[[1]]
|
|
|
|
if (length(parts) >= 1) {
|
|
|
|
paste(head(parts, -1), collapse="_")
|
|
|
|
} else {
|
|
|
|
NA_character_
|
|
|
|
}
|
|
|
|
}))
|
|
|
|
contrib_total_df <- contrib_pop_df |>
|
|
|
|
join(contrib_topics_df, by="project_name")
|
|
|
|
contrib_total_df <- contrib_total_df|>
|
|
|
|
join(summed_data, by="upstream_vcs_link")
|
|
|
|
#outcome variable that is number of commits by number of new contributors
|
|
|
|
contrib_total_df$commit_by_contrib = contrib_total_df$summed_count * contrib_total_df$after_contrib_new
|
|
|
|
contrib_total_df$logged_outcome = log1p(contrib_total_df$commit_by_contrib)
|
|
|
|
#running regressions
|
|
|
|
library(MASS)
|
|
|
|
lm1 <- glm.nb(summed_count ~ t0 + t1 + t2 + t3, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
View(contrib_total_df)
|
|
|
|
lm1 <- glm.nb(summed_count ~ t3, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(summed_count ~ t3 + t2 + t1, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(summed_count ~ t3 + t2 + t1 + t0, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(summed_count ~ t0 + t1 + t2 + t3, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- lm(summed_count ~ t0 + t1 + t2 + t3, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(summed_count ~ t0 + t1 + t2 + t3, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(summed_count ~ t1 + t2 + t3, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(summed_count ~ t3, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ t3, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ t1 + t2 +t3, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ t3, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ t2, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ t1, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ t3, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
source("~/Desktop/git/24_deb_gov/R/readme_topic_outcomes.R")
|
|
|
|
#outcome variable that is number of commits by number of new readmeutors
|
|
|
|
readme_total_df$commit_by_contrib = readme_total_df$summed_count *readme_total_df$after_contrib_new
|
|
|
|
readme_total_df$logged_outcome = log1p(readme_total_df$commit_by_readme)
|
|
|
|
#running regressions
|
|
|
|
library(MASS)
|
|
|
|
lm1 <- glm.nb(commit_by_readme ~ t3, data = readme_total_df)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ t3, data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ t0, data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ t1, data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ t7, data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ t0+t1+t7, data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ t0+t1+t2+t7, data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ t0+t1+t2+t7+t3, data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ t0+t1+t2+t7+t3 + t4, data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ t0+t1+t2+t7+t3 +t4 + t5 + t6, data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ t0+t1+t2+t7+t3 +t4 + t5, data = readme_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
source("~/Desktop/git/24_deb_gov/R/contrib_topic_outcomes.R")
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ t3, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ t0+ t1+ t3, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ t0+ t1+ t2+ t3, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ t1+ t2+ t3, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ t1+ t3, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|
|
|
|
lm1 <- glm.nb(commit_by_contrib ~ t2+ t3, data = contrib_total_df)
|
|
|
|
qqnorm(residuals(lm1))
|
|
|
|
summary(lm1)
|