From a5b7ab562c5f6898c8a18a529bdf10ba27daa69e Mon Sep 17 00:00:00 2001 From: mjgaughan Date: Tue, 16 Apr 2024 11:43:32 -0500 Subject: [PATCH] further refining rdd --- R/didAnalysis.R | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/R/didAnalysis.R b/R/didAnalysis.R index d3890d3..10a59b2 100644 --- a/R/didAnalysis.R +++ b/R/didAnalysis.R @@ -31,12 +31,17 @@ expanded_data <- expand_timeseries(readme_df[1,]) for (i in 2:nrow(readme_df)){ expanded_data <- rbind(expanded_data, expand_timeseries(readme_df[i,])) } -#filter out the timewindows +#filter out the windows of time that we're looking at window_num <- 8 expanded_data <- expanded_data |> filter(week >= (26 - window_num) & week <= (26 + window_num)) |> - mutate(D = ifelse(week >= 26, 1, 0)) + mutate(D = ifelse(week > 26, 1, 0)) # 3 rdd in lmer analysis +# rdd: https://rpubs.com/phle/r_tutorial_regression_discontinuity_design +# lmer: https://www.youtube.com/watch?v=LzAwEKrn2Mc library(lme4) -draft_model <- lmer(count ~ D * I(week - 26) + (1|upstream_vcs_link), REML=FALSE, data=expanded_data[which(expanded_data$observation_type == "all"),]) -summary(draft_model) +draft_all_model <- lmer(count ~ D * I(week - 26) + (1|upstream_vcs_link), REML=FALSE, data=expanded_data[which(expanded_data$observation_type == "all"),]) +summary(draft_all_model) +draft_mrg_model <- lmer(count ~ D * I(week - 26) + (1|upstream_vcs_link), REML=FALSE, data=expanded_data[which(expanded_data$observation_type == "mrg"),]) +summary(draft_mrg_model) +# need to calculate inter-class correlation coefficient? \ No newline at end of file