diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29b..0c434d91 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: minor + changes: + added: + - General `calculate` method. diff --git a/policyengine/simulation.py b/policyengine/simulation.py index 65f8bad9..09036e7b 100644 --- a/policyengine/simulation.py +++ b/policyengine/simulation.py @@ -307,6 +307,26 @@ def _data_handle_cps_special_case(self): ) self.data = Dataset.from_file(self.data, "2023") + def calculate( + self, + ) -> ( + SingleEconomy + | EconomyComparison + | SingleHousehold + | HouseholdComparison + ): + """Calculate the default output statistics for the simulation type.""" + if self.options.scope == "macro": + if self.is_comparison: + return self.calculate_economy_comparison() + else: + return self.calculate_single_economy() + elif self.options.scope == "household": + if self.is_comparison: + return self.calculate_household_comparison() + else: + return self.calculate_single_household() + def calculate_economy_comparison(self) -> EconomyComparison: """Calculate comparison statistics between two economic scenarios.""" return calculate_economy_comparison(self)