test_that("test basic functionality", { # Simulate data set.seed(1234) df <- simulate_contdid_data( n = 5000, num_time_periods = 4, num_groups = 4, dose_linear_effect = 0, dose_quadratic_effect = 0 ) cd_res <- suppressWarnings( cont_did( yname = "Y", tname = "time_period", idname = "id", dname = "D", data = df, gname = "G", target_parameter = "slope", aggregation = "dose", treatment_type = "continuous", control_group = "notyettreated", biters = 100, cband = TRUE, num_knots = 1, degree = 3, ) ) out <- summary(cd_res) ggcont_did(cd_res, type = "att") ggcont_did(cd_res, type = "acrt") expect_true(abs(out$overall_att) < 0.5) expect_true(abs(out$overall_acrt) < 0.2) cd_res_es_level <- suppressWarnings( cont_did( yname = "Y", tname = "time_period", idname = "id", dname = "D", data = df, gname = "G", target_parameter = "level", aggregation = "eventstudy", treatment_type = "continuous", control_group = "notyettreated", biters = 100, cband = TRUE, num_knots = 1, degree = 3, ) ) out <- summary(cd_res_es_level) ggcont_did(cd_res_es_level) expect_true(abs(out$overall_att$overall_att) < 0.5) expect_true(abs(out$event_study$Estimate[5]) < 0.5) # event study at e=2 cd_res_es_slope <- suppressWarnings( cont_did( yname = "Y", tname = "time_period", idname = "id", dname = "D", data = df, gname = "G", target_parameter = "slope", aggregation = "eventstudy", treatment_type = "continuous", control_group = "notyettreated", biters = 100, cband = TRUE, num_knots = 1, degree = 3, ) ) out <- summary(cd_res_es_slope) ggcont_did(cd_res_es_slope) expect_true(abs(out$overall_att$overall_att) < 0.2) expect_true(abs(out$event_study$Estimate[4]) < 0.2) # event study at e=1 })