-
differences.ATTgt.aggregate(type_of_aggregation: str | None =
'simple'
, overall: bool =False
, difference: bool | list | dict[str, list] =False
, alpha: float =0.05
, cluster_var: list | str =None
, boot_iterations: int =0
, random_state: int =None
, n_jobs: int =1
, backend: str ='loky'
) DataFrame Aggregate the ATTgt
- Parameters:¶
- type_of_aggregation: str | None =
'simple'
¶ "simple"
to calculate the weighted average of all cohort-time average treatment effects, with weights proportional to the cohort size.
"event"
or"event"
to calculate the average effects in each relative period: periods relative to the treatment; as in an event study.
"cohort"
to calculate the average treatment effect in each cohort.
"time"
or"time"
to calculate the average treatment effect in each time time.
- overall: bool =
False
¶ calculates the average effect within each type_of_aggregation.
- if type_of_aggregation is set to
"event"
or"event"
to calculate the average effect of the treatment across positive relative periods
- if type_of_aggregation is set to
- if type_of_aggregation is set to
"cohort"
to calculate the average effect of the treatment across cohorts
- if type_of_aggregation is set to
- if type_of_aggregation is set to
"time"
or"time"
to calculate the average effect of the treatment across time times
- if type_of_aggregation is set to
- difference: bool | list | dict[str, list] =
False
¶ take the difference of the estimates
Available options are:
True
to calculate the difference between 2 samples or 2 strata of treatments
Note
Samples difference: if the estimation is run on 2 samples and more than 2 strata, the estimates for the two samples will be subtracted, as long as there are no strata that have the same names as the samples, in that case use a dictionary as indicated below
strata difference: if the estimation is run on 2 strata and more than 2 samples, the estimates for the two strata will be subtracted, as long as there are no samples that have the same names as the strata, in that case use a dictionary as indicated below
[sample-0, sample-1]
or[stratum-A, stratum-B]
to calculate the difference between 2 samples listed in the argument or the 2 strata of treatments listed in the argument
Note
Samples difference: if there are strata with the same name as the two samples listed, use a dictionary as indicated below
strata difference: if there are samples with the same name as the two strata listed, use a dictionary as indicated below
{'strata': [stratum-A, stratum-B]}
or{'sample_names': [sample-0, sample-1]}
- alpha: float =
0.05
¶ The significance level.
- cluster_var: list | str =
None
¶ cluster variables
- boot_iterations: int =
0
¶ bootstrap iterations
- random_state: int =
None
¶ seed for bootstrap
- n_jobs: int =
1
¶ The maximum number of concurrently running jobs. If -1 all CPUs are used.
If ≠ 1, concurrent jobs will be run for:
computing the bootstrap; the influence function is split into n_jobs parts and the boostrap is computed concurrently for each part
Parallelization is implemented using joblib, refer to its documentation for additional details on n_jobs.
- backend: str =
'loky'
¶ Parallelization backend implementation.
Parallelization is implemented using joblib, refer to its documentation for additional details on backend.
- type_of_aggregation: str | None =
- Return type:¶
A DataFrame with the requested aggregation