xuyiqing / gsynth

Generalized Synthetic Control Method
Other
132 stars 40 forks source link

Is it possible to include factor variable as matches? #33

Open AGSCL opened 4 years ago

AGSCL commented 4 years ago

When I try to incorporate factor variables to gsynth, i get the following error:

gsynth::gsynth( formula= as.formula(paste0("T14_Tot_Op", " ~ ", "proac_rep_et +", "perc_white + B19013_001E +perc_rented_occupied_hous_units + perc_us_cit + SAEPOVRTALL_PT + B19083_001E + B25064_001E + B19301_001E + perc_less_than_highscool")), data = output_stata_PR, na.rm=T, index = c("FIPS","year_quart"), se = TRUE, inference = "nonparametric", r = 0, CV = T, force = "two-way", nboots = 1000, seed = 02139)

Error in if (PC < min(CV.out[, "PC"])) { : argument is of length zero

The rest of the covariates works well, but only urbrural is composed by 6 categories: Large Central Metro, Large Fringe Metro, , Medium Metro, Micropolitan, Noncore and Small Metro.