Closed elsavoytas closed 5 years ago
hi @elsavoytas, thanks for using the package! Could you provide some sample code? I'm guessing that you just need to update some syntax to work with the new updates.
Of course!
matches <- PanelMatch(lag = 4, unit.id = "nameID", time.id = "time.id", treatment = "reparation", outcome.var = "vote", qoi = "att", refinement.method = "mahalanobis", data = rettig, match.missing = T, covs.formula = ~ lag('vote', 1:4), size.match = 5, verbose = T,lead = 0:12)
returns
Error in
contrasts<-(
tmp, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels
and
`matches.val <- PanelMatch(lag = 4, unit.id = "nameID", time.id = "time.id", treatment = "reparation", outcome = "vote", qoi = "att", refinement.method = "mahalanobis",
data = new_df, match.missing = T,
covs.formula = ~ lag('vote', 1:4)+gender+birthyear ,
size.match = 5, verbose = T,lead = 0:12)`
returns Error in model.frame.default(form, x, na.action = NULL) : variable lengths differ (found for 'gender')
though all the vectors are the same length.
Thanks!
Could you try changing the syntax of the covs.formula argument? Specifically, change lag('vote', 1:4)
to I(lag(vote, 1:4))
in both specifications? We made some changes to that syntax so that things work better internally.
Looks like that did it! Thanks for the quick assistance @adamrauh!
Hi,
My PanelMatch and PanelEstimate functions were running ok, but since I updated, I have not been able to successfully run these functions. I get one of two errors when running PanelMatch:
contrasts<-
(*tmp*
, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levelsI've tried some troubleshooting but can't figure it out. I'm happy to send on sample code/data.
Thanks!