Synthetic Nearest Neighbor (SNN)
Please find more details in :cite:p:`snn`.[1]:
from azcausal.core.error import Bootstrap
from azcausal.core.parallelize import Joblib
from azcausal.data import CaliforniaProp99
from azcausal.estimators.panel.snn import SNN
# create the panel to be fed into the estimator
panel = CaliforniaProp99().panel()
# initialize an estimator object
estimator = SNN()
# run the SNN
result = estimator.fit(panel)
# estimate the standard error
estimator.error(result, Bootstrap(n_samples=31), parallelize=Joblib(progress=True))
# print out information about the estimate
print(result.summary(title="CaliforniaProp99"))
100%|██████████| 31/31 [00:01<00:00, 21.77it/s]
╭──────────────────────────────────────────────────────────────────────────────╮
| CaliforniaProp99 |
├──────────────────────────────────────────────────────────────────────────────┤
| Panel |
| Time Periods: 31 (19/12) total (pre/post) |
| Units: 39 (38/1) total (contr/treat) |
├──────────────────────────────────────────────────────────────────────────────┤
| |
| Effect (±SE): -21.34 (±2.1270) |
| Confidence Interval (95%): [-25.51 , -17.17] (-) |
| Observed: 60.35 |
| Counter Factual: 81.69 |
├──────────────────────────────────────────────────────────────────────────────┤
| Percentage |
| Effect (±SE): -26.12 (±2.6038) |
| Confidence Interval (95%): [-31.23 , -21.02] (-) |
| Observed: 73.88 |
| Counter Factual: 100.00 |
├──────────────────────────────────────────────────────────────────────────────┤
| Cumulative |
| Effect (±SE): -256.08 (±25.52) |
| Confidence Interval (95%): [-306.11 , -206.05] (-) |
| Observed: 724.20 |
| Counter Factual: 980.28 |
╰──────────────────────────────────────────────────────────────────────────────╯