messing with figuring out postVar
This commit is contained in:
parent
618f225c38
commit
369e775fd3
@ -61,13 +61,22 @@ library(optimx)
|
|||||||
library(lattice)
|
library(lattice)
|
||||||
all_model <- lmer(log1p_count ~ D * I(week_offset)+ scaled_project_age + (D * I(week_offset)| upstream_vcs_link), data=all_actions_data, REML=FALSE, control = lmerControl(
|
all_model <- lmer(log1p_count ~ D * I(week_offset)+ scaled_project_age + (D * I(week_offset)| upstream_vcs_link), data=all_actions_data, REML=FALSE, control = lmerControl(
|
||||||
optimizer ='optimx', optCtrl=list(method='L-BFGS-B')))
|
optimizer ='optimx', optCtrl=list(method='L-BFGS-B')))
|
||||||
summary(all_model)
|
summary_of_all <- summary(all_model)
|
||||||
#identifying the quartiles of effect for D
|
#identifying the quartiles of effect for D
|
||||||
all_model_ranef <- ranef(all_model, condVar=TRUE)
|
all_model_ranef_condvar <- ranef(all_model, condVar = TRUE)
|
||||||
dotplot(all_model_ranef)
|
all_model_ranef <- ranef(all_model, condVar = FALSE)
|
||||||
df_ranefs <- as.data.frame(all_model_ranef)
|
attr(all_model_ranef_condvar$upstream_vcs_link, "postVar")
|
||||||
|
|
||||||
|
all_coefficients <- coef(all_model)
|
||||||
|
all_standard_errors <- sqrt(diag(vcov(all_model)))[1]
|
||||||
|
#all_conf_intervals <- cbind(all_coefficients - 1.96 * all_standard_errors,
|
||||||
|
# all_coefficients + 1.96 * all_standard_errors)
|
||||||
|
|
||||||
|
df_ranefs <- as.data.frame(all_model_ranef_condvar)
|
||||||
|
df_rn_no_cv <- as.data.frame(all_model_ranef)
|
||||||
D_df_ranef <- df_ranefs[which(df_ranefs$term == "D"),]
|
D_df_ranef <- df_ranefs[which(df_ranefs$term == "D"),]
|
||||||
#below this groups the ranefs
|
#below this groups the ranefs
|
||||||
|
"""
|
||||||
has_zero <- function(condval, condsd){
|
has_zero <- function(condval, condsd){
|
||||||
bounds <- condsd * 1.96
|
bounds <- condsd * 1.96
|
||||||
return(ifelse(((condval - bounds) < 0),ifelse(((condval + bounds) > 0), 1, 0), 2))
|
return(ifelse(((condval - bounds) < 0),ifelse(((condval + bounds) > 0), 1, 0), 2))
|
||||||
@ -75,14 +84,17 @@ has_zero <- function(condval, condsd){
|
|||||||
df_ranefs <- df_ranefs |>
|
df_ranefs <- df_ranefs |>
|
||||||
mutate(ranef_grouping = has_zero(condval, condsd)) |>
|
mutate(ranef_grouping = has_zero(condval, condsd)) |>
|
||||||
mutate(rank = rank(condval))
|
mutate(rank = rank(condval))
|
||||||
D_df_ranef <- df_ranefs[which(df_ranefs$term == "D"),]
|
D_df_ranef <- df_ranefs[which(df_ranefs$term == ),]
|
||||||
|
D_df_ranef <- D_df_ranef |>
|
||||||
|
mutate(rank = rank(condval))
|
||||||
hist(D_df_ranef$ranef_grouping)
|
hist(D_df_ranef$ranef_grouping)
|
||||||
#plot the ranefs
|
#plot the ranefs
|
||||||
library(ggplot2)
|
library(ggplot2)
|
||||||
D_df_ranef |>
|
D_df_ranef |>
|
||||||
ggplot(aes(x=rank, y=condval, col = as.factor(ranef_grouping))) +
|
ggplot(aes(x=rank, y=condval, col = as.factor(ranef_grouping))) +
|
||||||
geom_linerange(aes(ymin= condval - (1.96 * condsd), ymax= condval + (1.96 * condsd))) +
|
geom_linerange(aes(ymin= condval - (1.96 * condsd), ymax= condval + (1.96 * condsd))) +
|
||||||
geom_bw()
|
theme_bw()
|
||||||
|
"""
|
||||||
#d_effect_ranef_all <- all_model_ranef$upstream_vcs_link
|
#d_effect_ranef_all <- all_model_ranef$upstream_vcs_link
|
||||||
#d_effect_ranef_all$quartile <- ntile(d_effect_ranef_all$condval, 4)
|
#d_effect_ranef_all$quartile <- ntile(d_effect_ranef_all$condval, 4)
|
||||||
#model residuals
|
#model residuals
|
||||||
|
Loading…
Reference in New Issue
Block a user