Untitled
7 months ago in Python
def subgroup_ate(x,y,k=1,data=med_df,c="dist"):
res=smf.ols(formula="{}~{}".format(y,x),data=data[(data[c]>=(-1*k))&(data[c]<=k)]).fit(cov_type="HC0")
return res

bandwidth=[subgroup_ate("eligible","income_af",.25),
subgroup_ate("eligible+dist+eligible*dist","income_af",.25),
subgroup_ate("eligible","income_af",1),
subgroup_ate("eligible+dist+eligible*dist","income_af",1),
subgroup_ate("eligible","income_af",2),
subgroup_ate("eligible+dist+eligible*dist","income_af",2)]

columns=["k=.25","k=.25","k=1","k=1","k=2","k=2"]
s=Stargazer(bandwidth)
s.custom_columns(columns,[1,1,1,1,1,1])
s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15