32 lines
1.1 KiB
R
32 lines
1.1 KiB
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)
|
|
#saveRDS(all_gmodel, "020125_contributing_model.rda")
|
|
model_residuals <- residuals(all_gmodel)
|
|
acf(model_residuals)
|
|
vif(all_gmodel)
|
|
|
|
#getting between-group variance
|
|
variance_components <- as.data.frame(VarCorr(all_gmodel))
|