diff --git a/src/data/elasticities.ts b/src/data/elasticities.ts index 3c10b2d..f9a8117 100644 --- a/src/data/elasticities.ts +++ b/src/data/elasticities.ts @@ -12,16 +12,17 @@ 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: [ { 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 }, @@ -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)', + 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/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..7ce6176 --- /dev/null +++ b/src/test/usElasticities.test.tsx @@ -0,0 +1,44 @@ +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 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', + ]); + 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.27', '0.38'], + ['30-40%', '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.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'], + ]); + + // 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(); + } +});