0

Just trying to replicate the Callaway and Sant'Anna average treatment group effect for my research where I would like to see how a particular law implementation is affecting all the treated states' wages compared to the never treated states' ( control group ) wage.

But the error I'm getting is -

Error in var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm) : Calling var(x) on a factor x is defunct. Use something like 'all(duplicated(x)[-1L])' to test for a constant vector.

Can anyone tell me what's the issue ? My code is like following

## Cleaning treated and never treated 

dat$treat = ifelse(is.na(dat$law_effective_year),0,1)

dat$nevertreated = ifelse(dat$treat==0,1,0)

## Command for CSDID 

out1 <- att_gt(yname="ln_incwage",
               tname="year",
               gname="law_effective_year",
               xformla=~male + age + age2 + age3 + age4 + black + asian + hispanic + lths + hsdegree + somecollege ,
               data=dat, 
               est_method = "dr", # "dr" is doubly robust. "ipw" is inverse probability weighting. "reg" is regression
               control_group = "nevertreated", # set the comparison group which is either "nevertreated" or "notyettreated" 
               print_details = FALSE, # if TRUE, print detailed results
               clustervars = "statefip", # cluster level
               panel = FALSE) # wh)

summary(out1)
  • 3
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input that can be used to test and verify possible solutions. Please explicitly list all non-base R packages you are using. – MrFlick Jun 25 '21 at 18:42

0 Answers0