25 lines
908 B
R
25 lines
908 B
R
|
library(dplyr)
|
||
|
library(lubridate)
|
||
|
library(rdd)
|
||
|
|
||
|
contributing_df_filepath <- "/mmfs1/gscratch/comdata/users/mjilg/govdoc-cr-data/final_data/CONTRIBUTING_weekly_count_data.csv"
|
||
|
contributing_df = read.csv(contributing_df_filepath, header = TRUE)
|
||
|
|
||
|
window_num <- 5
|
||
|
contributing_df <- contributing_df |>
|
||
|
filter(week_index >= (- window_num) & week_index <= (window_num)) |>
|
||
|
mutate(scaled_age = scale(age)) |>
|
||
|
mutate(scaled_age_at_commit = scale(age_at_commit))|>
|
||
|
mutate(log1p_count = log1p(commit_count))
|
||
|
|
||
|
library(lme4)
|
||
|
library(optimx)
|
||
|
library(lattice)
|
||
|
|
||
|
all_gmodel <- glmer.nb(log1p_count ~ before_after * week_index + scaled_age + (before_after * week_index | project_id),
|
||
|
control=glmerControl(optimizer="bobyqa",
|
||
|
optCtrl=list(maxfun=2e5)), nAGQ=0,
|
||
|
data=contributing_df)
|
||
|
|
||
|
summary(all_gmodel)
|