Skip to content

[harrison_kreps]: Fix axis - #645

Merged
mmcky merged 1 commit into
QuantEcon:mainfrom
UdohNakamura:main
Oct 15, 2025
Merged

mmcky merged 1 commit into
QuantEcon:mainfrom
UdohNakamura:main

Conversation

@UdohNakamura

Copy link
Copy Markdown
Contributor
  • Problem: np.max(..., axis=1) / np.min(..., axis=1) compares across states, not across investor types.
  • Spec: Per equations (78.3) and (78.5), the max/min must be taken across types → axis=0.
  • Fix: Replace axis=1 with axis=0 in the three lines below.

@HumphreyYang

HumphreyYang commented Oct 15, 2025 •

Copy link
Copy Markdown
Member

Many thanks @UdohNakamura! This looks great to me.

Hi @mmcky, this is a small (but important) fix. Should we merge it when you are ready? @UdohNakamura's change does not affect output because the two agent case is pretty special (with the same off diagnoal entries being the smallest ones). If we add a three-state two-agent exercise then it will cause issue.

@HumphreyYang
HumphreyYang requested review from Copilot and mmcky October 15, 2025 06:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the axis parameter in numpy max/min operations within the Harrison-Kreps model implementation. The issue was that the code was taking max/min across states (axis=1) instead of across investor types (axis=0) as required by the mathematical equations.

Key changes:

  • Corrected axis parameter from 1 to 0 in three numpy operations
  • Ensures proper computation according to equations (78.3) and (78.5)
  • Affects both optimistic and pessimistic belief pricing functions

@mmcky

mmcky commented Oct 15, 2025

Copy link
Copy Markdown
Contributor

thanks @UdohNakamura -- there seems to be an issue with permissions to netlify b/c this originates from a fork.

@HumphreyYang the logs indicate this is building well so I'll merge now.

@mmcky
mmcky merged commit 56903df into QuantEcon:main Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants