insongkim / PanelMatch

117 stars 35 forks source link

Problem Adding Covariates #24

Closed Akbar36 closed 5 years ago

Akbar36 commented 5 years ago

I am PhD student in one of UK university and planning to apply this technique. I did the estimation with covars.lagged =NULL. But when include co-variates it gives error, i.e.,

matches.cbps <- PanelMatch(lag = 2, max.lead = 4, time.id = "year", unit.id = "pidp", treatment = "dem", covars.lagged =c("agefelg"), formula = lwagegross ~ dem, method = "Pscore", weighting = TRUE, qoi = "ate", M = 3, data = dem) Error in names(new_cols) <- lagged_names : 'names' attribute [2] must be the same length as the vector [1] traceback() 4: FUN(X[[i]], ...) 3: lapply(df_list, lags_df, sort_var = sort_var, covar_combos, lagged_names) 2: make_lags(data, unit.id, time.id, covar_combos, lagged_names) 1: PanelMatch(lag = 2, max.lead = 4, time.id = "year", unit.id = "pidp", treatment = "dem", covars.lagged = c("agefelg"), formula = lwagegross ~ dem, method = "Pscore", weighting = TRUE, qoi = "ate", M = 3, data = dem)

I tried for online solution but it is not working, neither I see any issue with my data. New to R, so not sure how to solve this prob. I will highly appreciate any help...

Akbar36 commented 5 years ago

Thanks Prof Kim,,,,the latest dev. package works https://github.com/insongkim/PanelMatch/tree/development...note that a comma is missing in installing this package from the link above.