Skip to content

Two bugs found #1

Open
Open

Description

@marcingretl

Hi Artur,

While testing Threshold_Panel with gretl4py, I found two bugs affecting double-threshold estimation.

  1. In estimateTpm(), the threshold search passes rhats[lreg,2] to estimate_and_bootstrap(). For the second threshold, this element has not yet been estimated and is still zero. As a result, the routine repeats the single-threshold estimation, producing identical LR profiles for both thresholds. The fix is to pass the previously estimated thresholds, rhats[1:lreg-1,2].

  2. In the bootstrap loop of estimate_and_bootstrap(), the call to compute_optimal_threshold() contains an extra argument (self.trimming_values). Removing it fixes the runtime error encountered after correcting the first issue.

Both fixes have been tested using the package's Hansen (1999) investment panel example with 20 cross-sectional units. Before the fixes, both thresholds were estimated at 0.26826, and the LR profiles were identical. After the fixes, the thresholds are 0.26826 and 0.32031, with a maximum absolute difference of 4.05821 between the LR profiles.

I've attached a single patch against the original version 2.3 of Threshold_Panel.gfn.

Best regards,
Marcin

Threshold_Panel_2_3_double_threshold_complete_fix.patch

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions