new_pop_data <- old_pop_readme |> mutate(first_commit_dt = as.POSIXct(first_commit, format = "%a %b %d %H:%M:%S %Y %z")) |> mutate(age_in_days = as.numeric( difftime( as.POSIXct("2024-06-24 00:00:00", format = "%Y-%m-%d %H:%M:%S"), first_commit_dt, units = "days"))) |> mutate (event_gap = as.numeric( difftime( as.POSIXct(event_date, format = "%Y-%m-%d %H:%M:%S"), first_commit_dt, units = "days"))) new_pop_data$age_of_project = NULL head(new_pop_data) write.csv(new_pop_data, file = "../final_data/deb_readme_pop_change_updated.csv", row.names = FALSE) #CONTRIBUTING Document updates first_commit_contrib <- read_csv("../062424_did_first_commit_contrib.csv") ####RDD CSV old_rdd_contrib <- read_csv("../final_data/deb_contrib_did.csv") old_rdd_contrib <- merge(old_rdd_contrib, first_commit_contrib, by="upstream_vcs_link") new_rdd_contrib_data <- old_rdd_contrib |> mutate(first_commit_dt = as.POSIXct(first_commit, format = "%a %b %d %H:%M:%S %Y %z")) |> mutate(age_in_days = as.numeric( difftime( as.POSIXct("2024-06-24 00:00:00", format = "%Y-%m-%d %H:%M:%S"), first_commit_dt, units = "days"))) |> mutate (event_gap = as.numeric( difftime( as.POSIXct(event_date, format = "%Y-%m-%d %H:%M:%S"), first_commit_dt, units = "days"))) new_rdd_contrib_data$age_of_project = NULL View(new_rdd_contrib_data) write.csv(new_rdd_contrib_data, file = "../final_data/deb_contrib_did_change_updated.csv", row.names = FALSE) ####PopChange CSV old_pop_contrib <- read_csv("../final_data/deb_contrib_pop_change.csv") old_pop_contrib <- merge(old_pop_contrib, first_commit_contrib, by="upstream_vcs_link") new_pop_contrib_data <- old_pop_contrib |> mutate(first_commit_dt = as.POSIXct(first_commit, format = "%a %b %d %H:%M:%S %Y %z")) |> mutate(age_in_days = as.numeric( difftime( as.POSIXct("2024-06-24 00:00:00", format = "%Y-%m-%d %H:%M:%S"), first_commit_dt, units = "days"))) |> mutate (event_gap = as.numeric( difftime( as.POSIXct(event_date, format = "%Y-%m-%d %H:%M:%S"), first_commit_dt, units = "days"))) new_pop_contrib_data$age_of_project = NULL write.csv(new_pop_contrib_data, file = "../final_data/deb_contrib_pop_change_updated.csv", row.names = FALSE) library(tidyverse) library(plyr) library(stringr) try(setwd(dirname(rstudioapi::getActiveDocumentContext()$path))) #load in data full_df <- read_csv("../final_data/deb_full_data.csv") contrib_df <- read_csv("../final_data/deb_contrib_pop_change.csv") readme_df <- read_csv("../final_data/deb_readme_pop_change.csv") contrib_df <- merge(full_df, contrib_df, by="upstream_vcs_link") readme_df <- merge(full_df, readme_df, by="upstream_vcs_link") # age is calculated against December 11, 2023 #some expansion needs to happens for each project expand_timeseries <- function(project_row) { longer <- project_row |> pivot_longer(cols = ends_with("new"), names_to = "window", values_to = "count") |> unnest(count) |> mutate(after_doc = as.numeric(str_detect(window, "after"))) |> mutate(is_collab = as.numeric(str_detect(window, "collab"))) return(longer) } expanded_readme_data <- expand_timeseries(readme_df[1,]) for (i in 2:nrow(readme_df)){ expanded_readme_data <- rbind(expanded_readme_data, expand_timeseries(readme_df[i,])) } expanded_contrib_data <- expand_timeseries(contrib_df[1,]) for (i in 2:nrow(contrib_df)){ expanded_contrib_data <- rbind(expanded_contrib_data, expand_timeseries(contrib_df[i,])) } expanded_readme_data$log1pcount <- log1p(expanded_readme_data$count) expanded_contrib_data$log1pcount <- log1p(expanded_contrib_data$count) #breaking out the types of population counts collab_pop_readme <- expanded_readme_data[which(expanded_readme_data$is_collab == 1),] contrib_pop_readme <- expanded_readme_data[which(expanded_readme_data$is_collab == 0),] collab_pop_contrib <- expanded_contrib_data[which(expanded_contrib_data$is_collab == 1),] contrib_pop_contrib <- expanded_contrib_data[which(expanded_contrib_data$is_collab == 0),] #import models library(lme4) library(optimx) library(MASS) simple_collab_readme_model <- glm.nb(count ~ as.factor(after_doc), data=collab_pop_readme) summary(simple_collab_readme_model) simple_collab_readme_model <- glm.nb(count ~ as.factor(after_doc) + age_in_days, data=collab_pop_readme) summary(simple_collab_readme_model) simple_collab_readme_model <- glm.nb(count ~ as.factor(after_doc) + scaled(age_in_days), data=collab_pop_readme) simple_collab_readme_model <- glm.nb(count ~ as.factor(after_doc) + scale(age_in_days), data=collab_pop_readme) summary(simple_collab_readme_model) qqnorm(residuals(simple_collab_readme_model)) simple_readme_model <- glm.nb(count ~ as.factor(after_doc) + scale(age_in_days), data=contrib_pop_readme) summary(simple_collab_readme_model) qqnorm(residuals(simple_collab_readme_model)) simple_readme_model <- glm.nb(count ~ as.factor(after_doc) + scale(age_in_days), data=expanded_readme_data) summary(simple_collab_readme_model) qqnorm(residuals(simple_collab_readme_model)) View(expanded_readme_data) library(tidyverse) library(plyr) library(stringr) try(setwd(dirname(rstudioapi::getActiveDocumentContext()$path))) #load in data full_df <- read_csv("../final_data/deb_full_data.csv") contrib_df <- read_csv("../final_data/deb_contrib_pop_change.csv") readme_df <- read_csv("../final_data/deb_readme_pop_change.csv") contrib_df <- merge(full_df, contrib_df, by="upstream_vcs_link") readme_df <- merge(full_df, readme_df, by="upstream_vcs_link") # age is calculated against December 11, 2023 #some expansion needs to happens for each project expand_timeseries <- function(project_row) { longer <- project_row |> pivot_longer(cols = ends_with("new"), names_to = "window", values_to = "count") |> unnest(count) |> mutate(after_doc = as.numeric(str_detect(window, "after"))) |> mutate(is_collab = as.numeric(str_detect(window, "collab"))) return(longer) } expanded_readme_data <- expand_timeseries(readme_df[1,]) for (i in 2:nrow(readme_df)){ expanded_readme_data <- rbind(expanded_readme_data, expand_timeseries(readme_df[i,])) } expanded_contrib_data <- expand_timeseries(contrib_df[1,]) for (i in 2:nrow(contrib_df)){ expanded_contrib_data <- rbind(expanded_contrib_data, expand_timeseries(contrib_df[i,])) } expanded_readme_data$log1pcount <- log1p(expanded_readme_data$count) expanded_contrib_data$log1pcount <- log1p(expanded_contrib_data$count) expanded_readme_data$logcount <- log(expanded_readme_data$count) expanded_contrib_data$logcount <- log(expanded_contrib_data$count) #scale age expanded_readme_data$scaled_age <- scale(expanded_readme_data$age_in_days) expanded_contrib_data$scaled_age <- scale(expanded_contrib_data$age_in_days) #breaking out the types of population counts collab_pop_readme <- expanded_readme_data[which(expanded_readme_data$is_collab == 1),] contrib_pop_readme <- expanded_readme_data[which(expanded_readme_data$is_collab == 0),] collab_pop_contrib <- expanded_contrib_data[which(expanded_contrib_data$is_collab == 1),] contrib_pop_contrib <- expanded_contrib_data[which(expanded_contrib_data$is_collab == 0),] #import models library(lme4) library(optimx) library(MASS) simple_readme_model <- glm.nb(count ~ as.factor(after_doc) + scale(age_in_days), data=expanded_readme_data) summary(simple_collab_readme_model) simple_collab_readme_model <- glm.nb(count ~ as.factor(after_doc) + scale(age_in_days), data=collab_pop_readme) summary(simple_collab_readme_model) qqnorm(residuals(simple_collab_readme_model)) View(contrib_pop_readme) simple_contrib_readme_model <- glm.nb(count ~ as.factor(after_doc) + scale(age_in_days), data=collab_pop_readme) summary(simple_contrib_readme_model) qqnorm(residuals(simple_contrib_readme_model)) View(collab_pop_readme) View(collab_pop_readme) View(contrib_pop_readme) #contrib_readme_model <- readRDS("final_models/0623_pop_rm_contrib.rda") collab_contrib_model <- glmer.nb(log1pcount ~ after_doc + (after_doc| upstream_vcs_link), data=collab_pop_contrib) #contrib docs simple_collab_contrib_model <- glm.nb(count ~ as.factor(after_doc) + scale(age_in_days), data=collab_pop_contrib) summary(simple_collab_contrib_model) #readme docs simple_collab_readme_model <- glm.nb(log1pcount ~ as.factor(after_doc) + scale(age_in_days), data=collab_pop_readme) summary(simple_collab_readme_model) simple_contrib_readme_model <- glm.nb(log1pcount ~ as.factor(after_doc) + scale(age_in_days), data=collab_pop_readme) summary(simple_contrib_readme_model) # I don't think MLM is the right one collab_readme_model <- glmer.nb(log1pcount ~ as.factor(after_doc) + scaled_age + (after_doc| upstream_vcs_link), data=collab_pop_readme) summary(collab_readme_model) saveRDS(collab_readme_model, "final_models/0624_pop_rm_collab_better.rda") contrib_readme_model <- glmer.nb(log1pcount ~ as.factor(after_doc) + scaled_age + (after_doc| upstream_vcs_link), data=contrib_pop_readme) summary(collab_contrib_model) summary(contrib_readme_model) summary(collab_readme_model) summary(contrib_readme_model) saveRDS(contrib_readme_model, "final_models/0624_pop_rm_contrib.rda") texreg(list(collab_readme_model, contrib_readme_model), stars=NULL, digits=2, custom.model.names=c( 'collab','contrib.' ), custom.coef.names=c('(Intercept)', 'after_introduction', 'etc'), use.packages=FALSE, table=FALSE, ci.force = TRUE) #contrib_readme_model <- readRDS("final_models/0623_pop_rm_contrib.rda") collab_contrib_model <- glmer.nb(log1pcount ~ after_doc + scaled_age + (after_doc| upstream_vcs_link), data=collab_pop_contrib) summary(collab_contrib_model) contrib_pop_readme |> ggplot(aes(x = after_doc, y = log1pcount, col = as.factor(after_doc))) + geom_violin() View(contrib_pop_contrib) #contrib_readme_model <- readRDS("final_models/0623_pop_rm_contrib.rda") #contributing models are not statistically significant contrib_contrib_model <- glm.nb(log1pcount ~ as.factor(after_doc) + event_gap , data=contrib_pop_contrib) summary(contrib_contrib_model) #contrib_readme_model <- readRDS("final_models/0623_pop_rm_contrib.rda") #contributing models are not statistically significant contrib_contrib_model <- glmer.nb(log1pcount ~ as.factor(after_doc) + event_gap + (after_doc | upstream_vcs_link), data=contrib_pop_contrib) #contrib_readme_model <- readRDS("final_models/0623_pop_rm_contrib.rda") #contributing models are not statistically significant contrib_contrib_model <- glmer.nb(log1pcount ~ as.factor(after_doc) + scale(event_gap) + (after_doc | upstream_vcs_link), data=contrib_pop_contrib) summary(contrib_contrib_model) #all_gmodel <- glmer.nb(log1p_count ~ D * week_offset + scaled_project_age + scaled_event_gap + (D * week_offset | upstream_vcs_link), # control=glmerControl(optimizer="bobyqa", # optCtrl=list(maxfun=2e5)), nAGQ=0, data=all_actions_data) all_gmodel <- readRDS("0512_contrib_all.rda") summary(all_gmodel) #all_gmodel <- glmer.nb(log1p_count ~ D * week_offset + scaled_project_age + scaled_event_gap + (D * week_offset | upstream_vcs_link), # control=glmerControl(optimizer="bobyqa", # optCtrl=list(maxfun=2e5)), nAGQ=0, data=all_actions_data) all_gmodel <- readRDS("0512_contrib_all.rda") #identifying the quartiles of effect for D test_condvals <- broom.mixed::tidy(all_gmodel, effects = "ran_vals", conf.int = TRUE) test_glmer_ranef_D <- test_condvals [which(test_condvals $term == "D"),] has_zero <- function(estimate, low, high){ return(ifelse((low < 0),ifelse((high > 0), 1, 0), 2)) } test_glmer_ranef_D <- test_glmer_ranef_D |> mutate(ranef_grouping = has_zero(estimate, conf.low, conf.high)) |> mutate(rank = rank(estimate)) g <- test_glmer_ranef_D |> ggplot(aes(x=rank, y=estimate, col = as.factor(ranef_grouping))) + geom_linerange(aes(ymin= conf.low, ymax= conf.high)) + theme_bw() library(tidyverse) g <- test_glmer_ranef_D |> ggplot(aes(x=rank, y=estimate, col = as.factor(ranef_grouping))) + geom_linerange(aes(ymin= conf.low, ymax= conf.high)) + theme_bw() g test_glmer_ranef_D <- test_glmer_ranef_D |> mutate(ranef_grouping = has_zero(estimate, conf.low, conf.high)) |> mutate(rank = rank(estimate)) g <- test_glmer_ranef_D |> ggplot(aes(x=rank, y=estimate, col = as.factor(ranef_grouping))) + geom_linerange(aes(ymin= conf.low, ymax= conf.high)) + theme_bw() g library(tidyverse) library(plyr) library(gridExtra) library(ggpubr) # script for the analysis of document readability metrics # readability metrics will be studied controlled by their length # gaughan@u.northwestern.edu # loading in the data try(setwd(dirname(rstudioapi::getActiveDocumentContext()$path))) source("~/Desktop/git/24_deb_gov/R/documentReadabilityAnalysis.R", echo=TRUE) source("~/Desktop/git/24_deb_gov/R/documentReadabilityAnalysis.R", echo=TRUE) source("~/Desktop/git/24_deb_gov/R/documentReadabilityAnalysis.R", echo=TRUE) aggregate(readme_df[, 3:10], list(readme_df$subdir), median) readme_df <- read_csv("../text_analysis/dwo_readability_readme.csv") aggregate(readme_df[, 3:10], list(readme_df$subdir), median) aggregate(contributing_df[, 3:10], list(contributing_df$subdir), median) aggregate(readme_df[, 3:10], list(readme_df$subdir), median) readme_df <- read_csv("../text_analysis/dwo_readability_readme.csv") contributing_df <- read_csv("../text_analysis/dwo_readability_contributing.csv") #getting basic stats for the readme readability median(readme_df$flesch_reading_ease) median(readme_df$linsear_write_formula) readme_rdd <- readRDS("final_models/0624_readme_all_rdd.rda") contrib_rdd <- readRDS("final_models/0624_contrib_all_rdd.rda") textreg(list(readme_rdd, contrib_rdd), stars=NULL, digits=3, use.packages=FALSE, table=FALSE, ci.force = TRUE)) textreg(list(readme_rdd, contrib_rdd), stars=NULL, digits=3, use.packages=FALSE, table=FALSE, ci.force = TRUE) reg(list(readme_rdd, contrib_rdd), stars=NULL, digits=3, use.packages=FALSE, table=FALSE, ci.force = TRUE) texreg(list(readme_rdd, contrib_rdd), stars=NULL, digits=3, use.packages=FALSE, table=FALSE, ci.force = TRUE) library(texreg) texreg(list(readme_rdd, contrib_rdd), stars=NULL, digits=3, use.packages=FALSE, table=FALSE, ci.force = TRUE) summary(readme) summary(readme_rdd) texreg(list(readme_rdd, contrib_rdd), stars=NULL, digits=3, use.packages=FALSE, custom.model.names=c( 'README','CONTRIBUTING'), custom.coef.names=c('(Intercept)', 'Indtroduction', 'Week (Time)', 'Project Age', 'Introduction:Week', 'Event Gap'), table=FALSE, ci.force = TRUE) readme_groupings <- read.csv('../final_data/deb_readme_interaction_groupings.csv') contrib_groupings <- read.csv('../final_data/deb_contrib_interaction_groupings.csv') View(readme_groupings) library(tidyverse) readme_g <- readme_groupings |> ggplot(aes(x=rank, y=estimate, col = as.factor(ranef_grouping))) + geom_linerange(aes(ymin= conf.low, ymax= conf.high)) + theme_bw() readme_g subdirColors <- setNames( c('firebrick1', 'forestgreen', 'cornflowerblue') , c(0,1,2) ) readme_g <- readme_groupings |> ggplot(aes(x=rank, y=estimate, col = as.factor(ranef_grouping))) + geom_linerange(aes(ymin= conf.low, ymax= conf.high)) + scale_color_manual(values = subdirColors) + theme_bw() readme_g contrib_groupings <- read.csv('../final_data/deb_contrib_interaction_groupings.csv') contrib_g <- contrib_groupings |> ggplot(aes(x=rank, y=estimate, col = as.factor(ranef_grouping))) + geom_linerange(aes(ymin= conf.low, ymax= conf.high)) + scale_color_manual(values = subdirColors) + theme_bw() contrib_g grid.arrange(readme_g, contrib_g, nrow = 1) library(gridExtra) grid.arrange(readme_g, contrib_g, nrow = 1) readme_g <- readme_groupings |> ggplot(aes(x=rank, y=estimate, col = as.factor(ranef_grouping))) + geom_linerange(aes(ymin= conf.low, ymax= conf.high)) + scale_color_manual(values = subdirColors) + guides(fill="none", color="none")+ theme_bw() readme_g grid.arrange(readme_g, contrib_g, nrow = 1) grid.arrange(contrib_g, readme_g, nrow = 1) contrib_g <- contrib_groupings |> ggplot(aes(x=rank, y=estimate, col = as.factor(ranef_grouping))) + geom_linerange(aes(ymin= conf.low, ymax= conf.high)) + scale_color_manual(values = subdirColors) + theme_bw() + theme(legend.position = "top") grid.arrange(contrib_g, readme_g, nrow = 1) library(jtools) plot_summs(readme_rdd, contrib_rdd) ?plot_summs plot_summs(readme_rdd, contrib_rdd, plot.distributions = TRUE) 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 <- read_csv('../final_data/deb_contrib_did.csv') 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,]) library(plyr) contrib_df <- read_csv('../final_data/deb_contrib_did.csv') 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,])) } View(expand_timeseries) View(expanded_data) window_num <- 8 windowed_data <- expanded_data |> filter(week >= (27 - window_num) & week <= (27 + window_num)) |> mutate(D = ifelse(week > 27, 1, 0)) windowed_data$week_offset <- windowed_data$week - 27 View(windowed_data) time_plot <- expanded_data |> ggplot(aes(x=week_offset, y=count)) time_plot time_plot <- windowed_data |> ggplot(aes(x=week_offset, y=count)) time_plot time_plot <- windowed_data |> ggplot(aes(x=week_offset, y=count)) + geom_point() time_plot time_plot <- windowed_data |> ggplot(aes(x=week_offset, y=median(count))) + geom_point() time_plot time_plot <- windowed_data |> ggplot(aes(x=week_offset, y=mean(count))) + geom_point() time_plot time_plot <- windowed_data |> ggplot(aes(x=week_offset, y=count)) + geom_point() time_plot all_actions_data <- windowed_data[which(windowed_data$observation_type == "all"),] all_actions_data$log1p_count <- log1p(all_actions_data$count) time_plot <- all_actions_data |> ggplot(aes(x=week_offset, y=log1p_count)) + geom_point() time_plot time_plot <- all_actions_data |> ggplot(aes(x=week_offset, y=log1p_count)) + geom_smooth()+ geom_point() time_plot time_plot <- all_actions_data |> ggplot(aes(x=week_offset, y=log1p_count)) + geom_smooth() time_plot time_plot <- all_actions_data |> ggplot(aes(x=week_offset, y=log1p_count)) + geom_smooth() + theme_bw() time_plot windowed_readme_data$week_offset <- windowed_readme_data$week - 27 all_actions_readme_data <- windowed_readme_data[which(windowed_readme_data$observation_type == "all"),] source("~/Desktop/git/24_deb_gov/R/gam_plot_documents.R") time_plot time_plot <- all_actions_data |> ggplot(aes(x=week_offset, y=log1p_count, color=factor(document_type))) + geom_smooth() + theme_bw() time_plot View(expanded_readme_data) mean(all_actions_readme_data$event_gap) mean(median$event_gap) median(all_actions_readme_data$event_gap) mean(all_actions_readme_data$event_gap) mean(all_actions_contrib_data$event_gap) median(all_actions_contrib_data$event_gap) time_plot <- all_actions_data |> ggplot(aes(x=week_offset, y=log1p_count, color=factor(document_type))) + geom_smooth() + theme_bw() + theme(legend.position = "top") time_plot time_plot <- all_actions_data |> ggplot(aes(x=week_offset, y=log1p_count, color=factor(document_type))) + geom_smooth() + geom_vline(x=0) theme_bw() + theme(legend.position = "top") time_plot <- all_actions_data |> ggplot(aes(x=week_offset, y=log1p_count, color=factor(document_type))) + geom_smooth() + geom_vline(x=0)+ theme_bw() + theme(legend.position = "top") time_plot time_plot <- all_actions_data |> ggplot(aes(x=week_offset, y=log1p_count, color=factor(document_type))) + geom_smooth() + geom_vline(x=0)+ theme_bw() + theme(legend.position = "top") time_plot <- all_actions_data |> ggplot(aes(x=week_offset, y=log1p_count, color=factor(document_type))) + geom_smooth() + geom_vline(0)+ theme_bw() + theme(legend.position = "top") time_plot time_plot <- all_actions_data |> ggplot(aes(x=week_offset, y=log1p_count, color=factor(document_type))) + geom_smooth() + geom_vline(xintercept = 0)+ theme_bw() + theme(legend.position = "top") time_plot #looking at event gap document_event_gap <- ggplot(all_actions_data, aes(x=event_gap, group=as.factor(document_type))) + geom_density(aes(color = as.factor(document_type), fill=as.factor(document_type)), alpha=0.2, position="identity") + theme_bw() document_event_gap #looking at event gap document_event_gap <- ggplot(all_actions_data, aes(x=scale(event_gap), group=as.factor(document_type))) + geom_density(aes(color = as.factor(document_type), fill=as.factor(document_type)), alpha=0.2, position="identity") + theme_bw() document_event_gap #looking at event gap mean(all_actions_readme_data$event_gap) sd(all_actions_readme_data$event_gap) mean(all_actions_contrib_data$event_gap) sd(all_actions_contrib_data$event_gap) mode(all_actions_contrib_data$event_gap) mean(all_actions_contrib_data$event_gap)