24_deb_pkg_gov/R/model_presentation.R
2024-08-24 17:04:46 -05:00

45 lines
1.6 KiB
R

library(tidyverse)
library(texreg)
readme_rdd <- readRDS("final_models/0624_readme_all_rdd.rda")
contrib_rdd <- readRDS("final_models/0711_contrib_all_rdd.rda")
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'),
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')
subdirColors <-
setNames( c('#31449c', '#4a7c85', '#c5db68')
, 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) +
guides(fill="none", color="none")+
theme_bw() +
labs(x="RE Coefficient Rank", y="RE Coefficient Estimate", color="Estimate Grouping")
readme_g
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, labels=c('CI < 0', '0 in CI', '0 < CI')) +
theme_bw() +
theme(legend.position = "top") +
labs(x="RE Coefficient Rank", y="RE Coefficient Estimate", color="Estimate Grouping")
contrib_g
library(gridExtra)
grid.arrange(contrib_g, readme_g, nrow = 1)
library(jtools)
plot_summs(readme_rdd, contrib_rdd, plot.distributions = TRUE)
?plot_summs