From d4b9cbf14164d2ffb9a8e5dbf909183c81676615 Mon Sep 17 00:00:00 2001 From: Max Ghenis <6076111+MaxGhenis@users.noreply.github.com> Date: Sun, 29 Nov 2026 20:59:59 -0500 Subject: [PATCH 1/3] Clarify US behavioral elasticity defaults --- src/data/elasticities.ts | 5 ++- src/test/ukValidationAndCapitalGains.test.tsx | 9 ++++- src/test/usElasticities.test.tsx | 38 +++++++++++++++++++ 3 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 src/test/usElasticities.test.tsx diff --git a/src/data/elasticities.ts b/src/data/elasticities.ts index 3c10b2d..c26e0b8 100644 --- a/src/data/elasticities.ts +++ b/src/data/elasticities.ts @@ -12,6 +12,7 @@ export interface ElasticityDefaults { capitalGainsTransitory: number; } +// CBO sensitivity estimates. PolicyEngine US defaults to zero for these responses. export const cboDefaults: ElasticityDefaults = { incomeElasticity: { lower: -0.10, central: -0.05, higher: 0.00 }, substitutionElasticities: [ @@ -58,12 +59,12 @@ export const UK_BEHAVIOURAL_REPORT_URL = 'https://www.policyengine.org/uk/resear export const OBR_LABOUR_SUPPLY_NOTE_URL = 'https://obr.uk/docs/dlm_uploads/NICS-Cut-Impact-on-Labour-Supply-Note.pdf'; -export const BLOG_URL = 'https://policyengine.org/us/research/us-behavioral-responses'; +export const BLOG_URL = 'https://www.policyengine.org/us/research/us-behavioral-responses'; export const sources = { laborSupply: 'CBO, "How the Supply of Labor Responds to Changes in Fiscal Policy" (2012)', elasticityReview: 'CBO, "A Review of Recent Research on Labor Supply Elasticities" (Working Paper 2012-12)', - capitalGains: 'CBO, "New Evidence on the Tax Elasticity of Capital Gains" (Working Paper 2012-09)', + capitalGains: 'CBO, "New Evidence on the Tax Elasticity of Capital Gains" (Working Paper 2012-09). PolicyEngine US defaults to zero for the capital gains response.', ukCapitalGains: 'Advani, Lonsdale and Summers (2024), "Reforming Capital Gains Tax", CenTax, pages 36-37', }; diff --git a/src/test/ukValidationAndCapitalGains.test.tsx b/src/test/ukValidationAndCapitalGains.test.tsx index 3990e90..658591f 100644 --- a/src/test/ukValidationAndCapitalGains.test.tsx +++ b/src/test/ukValidationAndCapitalGains.test.tsx @@ -48,7 +48,9 @@ describe('Capital gains elasticity', () => { render(); expect(screen.getByText(cboDefaults.capitalGainsPersistent.toFixed(2))).toBeInTheDocument(); expect(screen.getByText(cboDefaults.capitalGainsTransitory.toFixed(2))).toBeInTheDocument(); - expect(screen.getByText(sources.capitalGains)).toBeInTheDocument(); + expect(screen.getByText(sources.capitalGains)).toHaveTextContent( + 'PolicyEngine US defaults to zero for the capital gains response.', + ); expect(screen.queryByText(/scales each person’s/)).toBeNull(); }); }); @@ -78,7 +80,10 @@ describe('Labour supply responses', () => { expect(screen.getByText('CBO preset elasticity parameters')).toBeInTheDocument(); expect(screen.getByText('Substitution elasticity by income decile')).toBeInTheDocument(); expect(screen.getByText(sources.laborSupply)).toBeInTheDocument(); - expect(container.querySelector(`a[href="${BLOG_URL}"]`)).toHaveTextContent('Read our full methodology'); + expect(screen.getByRole('link', { name: /Read our full methodology/ })).toHaveAttribute( + 'href', + 'https://www.policyengine.org/us/research/us-behavioral-responses', + ); expect(container.textContent).toContain('responses using the elasticity of taxable income framework'); expect(screen.queryByText('Labour supply elasticities')).toBeNull(); }); diff --git a/src/test/usElasticities.test.tsx b/src/test/usElasticities.test.tsx new file mode 100644 index 0000000..b49e260 --- /dev/null +++ b/src/test/usElasticities.test.tsx @@ -0,0 +1,38 @@ +import { expect, it } from 'vitest'; +import { render, screen, within } from '@testing-library/react'; +import BehavioralResponses from '../components/theory/BehavioralResponses'; + +// Parameter paths below are from PolicyEngine/policyengine-us at +// ee1b3e79b63bf60901c7512f4b48e331b68e0c14. They default to zero. +it('displays the US sensitivity estimates with their labels', () => { + render(); + + // policyengine_us/parameters/gov/simulation/labor_supply_responses/elasticities/income.yaml + const income = within(screen.getByRole('heading', { name: 'Income elasticity (all earners)' }).parentElement!); + for (const [label, value] of [['Lower', '-0.10'], ['Central', '-0.05'], ['Upper', '0.00']]) { + expect(within(income.getByText(label).parentElement!).getByText(value)).toBeInTheDocument(); + } + + // policyengine_us/parameters/gov/simulation/labor_supply_responses/elasticities/substitution.yaml + const [heading, ...deciles] = within(screen.getByRole('table')).getAllByRole('row'); + expect(within(heading).getAllByRole('columnheader').map(cell => cell.textContent)).toEqual([ + 'Decile', 'Lower', 'Central', 'Upper', + ]); + expect(deciles.map(row => within(row).getAllByRole('cell').map(cell => cell.textContent))).toEqual([ + ['0-10%', '0.15', '0.31', '0.47'], + ['10-20%', '0.15', '0.28', '0.42'], + ['20-30%', '0.15', '0.28', '0.42'], + ['30-40%', '0.15', '0.27', '0.38'], + ['40-50%', '0.15', '0.27', '0.38'], + ['50-60%', '0.15', '0.25', '0.35'], + ['60-70%', '0.15', '0.25', '0.35'], + ['70-80%', '0.15', '0.22', '0.29'], + ['80-90%', '0.15', '0.22', '0.29'], + ['90-100%', '0.15', '0.22', '0.29'], + ]); + + // policyengine_us/parameters/gov/simulation/capital_gains_responses/elasticity.yaml + for (const [label, value] of [['Persistent', '-0.79'], ['Transitory', '-1.20']]) { + expect(within(screen.getByText(label).parentElement!).getByText(value)).toBeInTheDocument(); + } +}); From da2f88c034c617b8ef130cd58f38c581df0e10ec Mon Sep 17 00:00:00 2001 From: Max Ghenis <6076111+MaxGhenis@users.noreply.github.com> Date: Mon, 30 Nov 2026 21:35:04 -0500 Subject: [PATCH 2/3] Scope the US substitution elasticity table test --- src/test/usElasticities.test.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/test/usElasticities.test.tsx b/src/test/usElasticities.test.tsx index b49e260..b495d24 100644 --- a/src/test/usElasticities.test.tsx +++ b/src/test/usElasticities.test.tsx @@ -14,7 +14,10 @@ it('displays the US sensitivity estimates with their labels', () => { } // policyengine_us/parameters/gov/simulation/labor_supply_responses/elasticities/substitution.yaml - const [heading, ...deciles] = within(screen.getByRole('table')).getAllByRole('row'); + const substitution = within( + screen.getByRole('heading', { name: 'Substitution elasticity by income decile' }).parentElement!, + ); + const [heading, ...deciles] = within(substitution.getByRole('table')).getAllByRole('row'); expect(within(heading).getAllByRole('columnheader').map(cell => cell.textContent)).toEqual([ 'Decile', 'Lower', 'Central', 'Upper', ]); From 7b94a4ff084668037df14180fc1a7fd395a6cb5c Mon Sep 17 00:00:00 2001 From: Max Ghenis <6076111+MaxGhenis@users.noreply.github.com> Date: Mon, 30 Nov 2026 21:39:32 -0500 Subject: [PATCH 3/3] Align US substitution elasticity estimates with CBO Table 1 --- src/data/elasticities.ts | 8 ++++---- src/test/usElasticities.test.tsx | 9 ++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/data/elasticities.ts b/src/data/elasticities.ts index c26e0b8..f9a8117 100644 --- a/src/data/elasticities.ts +++ b/src/data/elasticities.ts @@ -18,11 +18,11 @@ export const cboDefaults: ElasticityDefaults = { substitutionElasticities: [ { decile: '0-10%', lower: 0.15, central: 0.31, higher: 0.47 }, { decile: '10-20%', lower: 0.15, central: 0.28, higher: 0.42 }, - { decile: '20-30%', lower: 0.15, central: 0.28, higher: 0.42 }, + { decile: '20-30%', lower: 0.15, central: 0.27, higher: 0.38 }, { decile: '30-40%', lower: 0.15, central: 0.27, higher: 0.38 }, - { decile: '40-50%', lower: 0.15, central: 0.27, higher: 0.38 }, + { decile: '40-50%', lower: 0.15, central: 0.25, higher: 0.35 }, { decile: '50-60%', lower: 0.15, central: 0.25, higher: 0.35 }, - { decile: '60-70%', lower: 0.15, central: 0.25, higher: 0.35 }, + { decile: '60-70%', lower: 0.15, central: 0.22, higher: 0.29 }, { decile: '70-80%', lower: 0.15, central: 0.22, higher: 0.29 }, { decile: '80-90%', lower: 0.15, central: 0.22, higher: 0.29 }, { decile: '90-100%', lower: 0.15, central: 0.22, higher: 0.29 }, @@ -63,7 +63,7 @@ export const BLOG_URL = 'https://www.policyengine.org/us/research/us-behavioral- export const sources = { laborSupply: 'CBO, "How the Supply of Labor Responds to Changes in Fiscal Policy" (2012)', - elasticityReview: 'CBO, "A Review of Recent Research on Labor Supply Elasticities" (Working Paper 2012-12)', + elasticityReview: 'Primary earners by earnings decile. CBO, "How the Supply of Labor Responds to Changes in Fiscal Policy" (2012), Table 1.', capitalGains: 'CBO, "New Evidence on the Tax Elasticity of Capital Gains" (Working Paper 2012-09). PolicyEngine US defaults to zero for the capital gains response.', ukCapitalGains: 'Advani, Lonsdale and Summers (2024), "Reforming Capital Gains Tax", CenTax, pages 36-37', }; diff --git a/src/test/usElasticities.test.tsx b/src/test/usElasticities.test.tsx index b495d24..7ce6176 100644 --- a/src/test/usElasticities.test.tsx +++ b/src/test/usElasticities.test.tsx @@ -17,6 +17,9 @@ it('displays the US sensitivity estimates with their labels', () => { const substitution = within( screen.getByRole('heading', { name: 'Substitution elasticity by income decile' }).parentElement!, ); + expect(substitution.getByText(/Primary earners by earnings decile/)).toHaveTextContent( + 'CBO, "How the Supply of Labor Responds to Changes in Fiscal Policy" (2012), Table 1.', + ); const [heading, ...deciles] = within(substitution.getByRole('table')).getAllByRole('row'); expect(within(heading).getAllByRole('columnheader').map(cell => cell.textContent)).toEqual([ 'Decile', 'Lower', 'Central', 'Upper', @@ -24,11 +27,11 @@ it('displays the US sensitivity estimates with their labels', () => { expect(deciles.map(row => within(row).getAllByRole('cell').map(cell => cell.textContent))).toEqual([ ['0-10%', '0.15', '0.31', '0.47'], ['10-20%', '0.15', '0.28', '0.42'], - ['20-30%', '0.15', '0.28', '0.42'], + ['20-30%', '0.15', '0.27', '0.38'], ['30-40%', '0.15', '0.27', '0.38'], - ['40-50%', '0.15', '0.27', '0.38'], + ['40-50%', '0.15', '0.25', '0.35'], ['50-60%', '0.15', '0.25', '0.35'], - ['60-70%', '0.15', '0.25', '0.35'], + ['60-70%', '0.15', '0.22', '0.29'], ['70-80%', '0.15', '0.22', '0.29'], ['80-90%', '0.15', '0.22', '0.29'], ['90-100%', '0.15', '0.22', '0.29'],