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