Skip to content

Applying pysynthdid, obtaining homogeneous weights and no plot #4

@slavakung

Description

@slavakung

I am trying to apply the code to a time series dataset I am working with. I arranged it as in the example

When I run:

'sdid = SynthDID(df_int, pre_terem, post_terem, treatment )
sdid.fit(zeta_type="base")
hat_omega_simple = sdid.estimated_params(model="sc")
hat_omega_simple'

the sc_weight is the same for all the features, at 0.027

Then when I run:

'sdid.plot(model="sc")'

I get:


TypeError Traceback (most recent call last)
Input In [139], in <cell line: 1>()
----> 1 sdid.plot(model="sc")

File ~/anaconda3/lib/python3.9/site-packages/synthdid/plot.py:12, in Plot.plot(self, model, figsize)
10 result = pd.DataFrame({"actual_y": self.target_y()})
11 post_actural_treat = result.loc[self.post_term[0] :, "actual_y"].mean()
---> 12 post_point = np.mean(self.Y_post_c.index)
14 if model == "sdid":
15 result["sdid"] = self.sdid_trajectory()

File <array_function internals>:5, in mean(*args, **kwargs)

File ~/anaconda3/lib/python3.9/site-packages/numpy/core/fromnumeric.py:3438, in mean(a, axis, dtype, out, keepdims, where)
3436 pass
3437 else:
-> 3438 return mean(axis=axis, dtype=dtype, out=out, **kwargs)
3440 return _methods._mean(a, axis=axis, dtype=dtype,
3441 out=out, **kwargs)

File ~/anaconda3/lib/python3.9/site-packages/pandas/core/indexes/extension.py:95, in _inherit_from_data..method(self, *args, **kwargs)
93 if "inplace" in kwargs:
94 raise ValueError(f"cannot use inplace with {type(self).name}")
---> 95 result = attr(self._data, *args, **kwargs)
96 if wrap:
97 if isinstance(result, type(self._data)):

TypeError: mean() got an unexpected keyword argument 'dtype'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions