From d6e671c7a5a08b3b2a8c83b98350b6992f2b7f4d Mon Sep 17 00:00:00 2001 From: Matthew Gaughan Date: Thu, 16 Jan 2025 08:57:43 -0600 Subject: [PATCH] update with multicolinearity and autocorr edits --- R/contribRDDAnalysis.R | 9 ++++++++- R/readmeRDDAnalysis.R | 11 ++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/R/contribRDDAnalysis.R b/R/contribRDDAnalysis.R index 1d9671e..0420bf5 100644 --- a/R/contribRDDAnalysis.R +++ b/R/contribRDDAnalysis.R @@ -67,11 +67,18 @@ print("fitting 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("0711_contrib_all.rda") +library(car) +library(forecast) + +all_gmodel <- readRDS("final_models/0711_contrib_all_rdd.rda") summary(all_gmodel) #saveRDS(all_gmodel, "0711_contrib_all_01.rda") +#autocorrelation +tes <- vif(all_gmodel) +tes all_residuals <- residuals(all_gmodel) +acf(all_residuals) qqnorm(all_residuals) #identifying the quartiles of effect for D test_condvals <- broom.mixed::tidy(all_gmodel, effects = "ran_vals", conf.int = TRUE) diff --git a/R/readmeRDDAnalysis.R b/R/readmeRDDAnalysis.R index c5a3d65..474752b 100644 --- a/R/readmeRDDAnalysis.R +++ b/R/readmeRDDAnalysis.R @@ -70,9 +70,18 @@ median(all_actions_data$count) # 0 print("fitting model") #all_log1p_gmodel <- glmer.nb(log1p_count ~ D * week_offset+ scaled_project_age + scaled_event_gap + (D * week_offset | upstream_vcs_link), data=all_actions_data, nAGQ=1, control=glmerControl(optimizer="bobyqa", # optCtrl=list(maxfun=1e5))) -#all_log1p_gmodel <- readRDS("final_models/0624_readme_all_rdd.rda") +all_log1p_gmodel <- readRDS("final_models/0624_readme_all_rdd.rda") summary(all_log1p_gmodel) print("model fit") + +library(car) +library(forecast) + +tes <- vif(all_log1p_gmodel) +tes +all_residuals <- residuals(all_log1p_gmodel) +acf(all_residuals) + #I grouped the ranef D effects on 0624 all_residuals <- residuals(all_log1p_gmodel) qqnorm(all_residuals)