Closed SUonGH closed 7 months ago
It works for me, please can you provide a minimal reproducible example.
The example I ran was exactly the one you provided, but as a python script. For completion ...
import pandas as pd
from pysyncon import Dataprep, Synth
df = pd.read_csv("german_reunification.csv")
dataprep_train = Dataprep(
foo=df,
predictors=["gdp", "trade", "infrate"],
predictors_op="mean",
time_predictors_prior=range(1971, 1981),
special_predictors=[
("industry", range(1971, 1981), "mean"),
("schooling", [1970, 1975], "mean"),
("invest70", [1980], "mean"),
],
dependent="gdp",
unit_variable="country",
time_variable="year",
treatment_identifier="West Germany",
controls_identifier=[
"USA",
"UK",
"Austria",
"Belgium",
"Denmark",
"France",
"Italy",
"Netherlands",
"Norway",
"Switzerland",
"Japan",
"Greece",
"Portugal",
"Spain",
"Australia",
"New Zealand",
],
time_optimize_ssr=range(1981, 1991),
)
synth_train = Synth()
synth_train.fit(dataprep=dataprep_train)
dataprep = Dataprep(
foo=df,
predictors=["gdp", "trade", "infrate"],
predictors_op="mean",
time_predictors_prior=range(1981, 1991),
special_predictors=[
("industry", range(1981, 1991), "mean"),
("schooling", [1980, 1985], "mean"),
("invest80", [1980], "mean"),
],
dependent="gdp",
unit_variable="country",
time_variable="year",
treatment_identifier="West Germany",
controls_identifier=[
"USA",
"UK",
"Austria",
"Belgium",
"Denmark",
"France",
"Italy",
"Netherlands",
"Norway",
"Switzerland",
"Japan",
"Greece",
"Portugal",
"Spain",
"Australia",
"New Zealand",
],
time_optimize_ssr=range(1960, 1990),
)
synth = Synth()
synth.fit(dataprep=dataprep, custom_V=synth_train.V)
print(synth.weights())
synth.path_plot(time_period=range(1960, 2004), treatment_time=1990)
synth.gaps_plot(time_period=range(1960, 2004), treatment_time=1990)
print(synth.att(time_period=range(1990, 2004)))
print(synth.summary())
Error on line 88 now.
If you are using the v1.1.0 of the module, att
method was added since then. I will publish a new version with att
.
Edit: If you want to use att
before that, clone the repo and copy the notebooks to top level
This is published now to PyPI as @v1.2.0
Run python -m pip install pysyncon==1.2.0
to get it.
Thanks, this worked.
On Tue, Jan 30, 2024 at 2:30 PM Stiofáin Fordham @.***> wrote:
This is published now to PyPI as @v1.2.0 https://github.com/sdfordham/pysyncon/releases/tag/v1.2.0
Run python -m pip install pysyncon==1.2.0 to get it.
— Reply to this email directly, view it on GitHub https://github.com/sdfordham/pysyncon/issues/38#issuecomment-1916998445, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJWWG6XPICKGUM2KKCQH53TYRD7X3AVCNFSM6AAAAABCLM5TVOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJWHE4TQNBUGU . You are receiving this because you authored the thread.Message ID: @.***>
When trying to replicate the 'germany' example, I get the following error: