Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to add Linear Trends to formula? #196

Open
anzonyquispe opened this issue Jun 3, 2024 · 0 comments
Open

Is it possible to add Linear Trends to formula? #196

anzonyquispe opened this issue Jun 3, 2024 · 0 comments

Comments

@anzonyquispe
Copy link

This is my original specification

out <- att_gt(yname = "per_treecover",
              gname = "min_year",
              idname = "block_id",
              tname = "year",
              xformla = ~ 1 ,
              data = df2, 
              control_group = c( "notyettreated" ), 
              base_period = 'universal', 
              alp = 0.05, 
              clustervars = 'block_id'
)

I would like to add linear trends since I see quadratic forms before treatment application
image

I added the linear trends using these lines of code

df2$trend = df2$year - min(df2$year) + 1
df2$state_factor = as.factor(df2$pc11_s_id)

df2$trend_fac = as.factor(df2$trend)
df2$block_id_fac = as.factor(df2$block_id)

out <- att_gt(yname = "per_treecover",
              gname = "min_year",
              idname = "block_id",
              tname = "year",
              xformla = ~ trend * block_id_fac ,
              data = df2, 
              control_group = c( "notyettreated" ), 
              base_period = 'universal', 
              alp = 0.05, 
              clustervars = 'block_id'
)

I am not sure fi we can add linear trends like this. I tried with a small dataset, it seems that it does not work, is any other way to add linear trends to the specification?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant