got the neg binom to work
This commit is contained in:
parent
9dc810bedf
commit
92dcf50bd6
BIN
R/0509_gmodel.rda
Normal file
BIN
R/0509_gmodel.rda
Normal file
Binary file not shown.
BIN
R/0509caterpillar.png
Normal file
BIN
R/0509caterpillar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 103 KiB |
@ -82,8 +82,12 @@ mean (all_actions_data$log1p_count) # 0.6426873
|
|||||||
#all_gmodel <- glmer.nb(count ~ D * I(week_offset)+ scaled_project_age + (D * I(week_offset) | upstream_vcs_link),
|
#all_gmodel <- glmer.nb(count ~ D * I(week_offset)+ scaled_project_age + (D * I(week_offset) | upstream_vcs_link),
|
||||||
# control=glmerControl(optimizer="bobyqa",
|
# control=glmerControl(optimizer="bobyqa",
|
||||||
# optCtrl=list(maxfun=2e5)), data=all_actions_data)
|
# optCtrl=list(maxfun=2e5)), data=all_actions_data)
|
||||||
all_gmodel <- glmer.nb(count ~ D * I(week_offset)+ scaled_project_age + (D | upstream_vcs_link), data=all_actions_data)
|
all_gmodel <- glmer.nb(count ~ D * I(week_offset)+ scaled_project_age + (D * I(week_offset) | upstream_vcs_link), data=all_actions_data, nAGQ=0, control=glmerControl(optimizer="bobyqa",
|
||||||
|
optCtrl=list(maxfun=1e5)))
|
||||||
summary(all_gmodel)
|
summary(all_gmodel)
|
||||||
|
saveRDS(all_gmodel, "0509_gmodel.rda")
|
||||||
|
#readRDS(path)
|
||||||
|
library(broom.mixed)
|
||||||
test_condvals <- broom.mixed::tidy(all_gmodel, effects = "ran_vals", conf.int = TRUE)
|
test_condvals <- broom.mixed::tidy(all_gmodel, effects = "ran_vals", conf.int = TRUE)
|
||||||
test_glmer_ranef_D <- test_condvals [which(test_condvals $term == "D"),]
|
test_glmer_ranef_D <- test_condvals [which(test_condvals $term == "D"),]
|
||||||
has_zero <- function(estimate, low, high){
|
has_zero <- function(estimate, low, high){
|
||||||
@ -92,10 +96,11 @@ has_zero <- function(estimate, low, high){
|
|||||||
test_glmer_ranef_D <- test_glmer_ranef_D |>
|
test_glmer_ranef_D <- test_glmer_ranef_D |>
|
||||||
mutate(ranef_grouping = has_zero(estimate, conf.low, conf.high)) |>
|
mutate(ranef_grouping = has_zero(estimate, conf.low, conf.high)) |>
|
||||||
mutate(rank = rank(estimate))
|
mutate(rank = rank(estimate))
|
||||||
test_glmer_ranef_D |>
|
g <- test_glmer_ranef_D |>
|
||||||
ggplot(aes(x=rank, y=estimate, col = as.factor(ranef_grouping))) +
|
ggplot(aes(x=rank, y=estimate, col = as.factor(ranef_grouping))) +
|
||||||
geom_linerange(aes(ymin= conf.low, ymax= conf.high)) +
|
geom_linerange(aes(ymin= conf.low, ymax= conf.high)) +
|
||||||
theme_bw()
|
theme_bw()
|
||||||
|
ggsave("0509caterpillar.png", g)
|
||||||
#below this groups the ranefs
|
#below this groups the ranefs
|
||||||
"""
|
"""
|
||||||
has_zero <- function(condval, condsd){
|
has_zero <- function(condval, condsd){
|
||||||
|
Loading…
Reference in New Issue
Block a user