Dear Sven,
Thank you for the suggestions. I attach the data and a minimal program to replicate the
results. Any feedback or change in the code is welcome.
Best regards,
Andreas
On Tuesday, April 8, 2025 at 07:02:22 PM GMT+2, Andreas Zervas
<anzervas(a)yahoo.com> wrote:
Many thanks,
Most likely a small sample problem (the estimate from the first function leaves 18% of
observations in first regime, while that of the second even less). However, maybe you
should decide what is the preferred approach to estimate the threshold, so that results do
not differ.
Many thanks though for the program and the reply.
Best regards,
Andreas
P.S.
The commands I use are (no other parameter is pre-set):
bundle b_nfc_td_@vn = H_thresh_test(d_EA_nfc_td, l1, test_var, FALSE, 1000, 0.95, 0.15)
b_nfc_td_@vn = H_thresh_estim(d_EA_nfc_td, l1, test_var, FALSE, 0.9, 0.7, 2)
and the output is:
Test of Null of No Threshold Against Alternative of Threshold
Under Maintained Assumption of Homoskedastic Errors
Number of Bootstrap Replications: 1000
Trimming percentage: 0.150000
Threshold Estimate: 0.160979
(18 % of obs in 1st regime)
LM-test for no threshold: 25.684802
Bootstrap p-value: 0.009000
*******************************************
Threshold regression based on Hansen (2000)
User choice: assume homoskedasticity
*******************************************
Global OLS Estimation, Without Threshold
Dependent Variable: d_EA_nfc_td
OLS Standard Errors Reported
coefficient std. error z p-value
-------------------------------------------------------
Constant -0.00673135 0.00420391 -1.601 0.1093
d_DFR 0.483153 0.0314844 15.35 3.78e-53 ***
d_DFR_1 0.303526 0.0317247 9.567 1.10e-21 ***
d_DFR_2 0.166300 0.0316151 5.260 1.44e-07 ***
d_DFR_3 -0.0447660 0.0312387 -1.433 0.1518
d_DFR_4 -0.0825148 0.0310742 -2.655 0.0079 ***
Observations = 301
Degrees of Freedom = 295
Sum of Squared Errors = 1.56605
Residual Variance = 0.00530865
R-squared = 0.692068
Heterosked. test p-val = 0.000971344
*************************************************************
Threshold Estimation, dependent variable: d_EA_nfc_td
Threshold Variable: test_var
Threshold Estimate = 0.528682 90% CI: [0.528682, 0.528682]
Sum of Sq. Errors = 1.18205 Residual Var. = 0.00409013
Joint R-squared = 0.768
Heterosked. test p-value: 0.000
*************************************************************
Regime 1: test_var <= 0.528682
(standard errors do not take into account threshold uncertainty)
coefficient std. error z p-value
--------------------------------------------------------
Constant -0.00301783 0.00374876 -0.8050 0.4208
d_DFR 0.434563 0.0285556 15.22 2.68e-52 ***
d_DFR_1 0.329858 0.0284484 11.59 4.37e-31 ***
d_DFR_2 0.173306 0.0281670 6.153 7.61e-10 ***
d_DFR_3 -0.0265575 0.0281749 -0.9426 0.3459
d_DFR_4 -0.0782675 0.0283734 -2.758 0.0058 ***
Observations = 292
Degrees of Freedom = 286
Sum of Squared Errors = 1.14915
Residual Variance = 0.00401801
R-squared = 0.74057
Regime 2: test_var > 0.528682
(standard errors do not take into account threshold uncertainty)
coefficient std. error z p-value
-------------------------------------------------------
Constant -0.138555 0.0277248 -4.998 5.81e-07 ***
d_DFR 1.20773 0.142826 8.456 2.77e-17 ***
d_DFR_1 -0.306680 0.156734 -1.957 0.0504 *
d_DFR_2 0.443741 0.237662 1.867 0.0619 *
d_DFR_3 -0.275100 0.169861 -1.620 0.1053
d_DFR_4 0.284360 0.123145 2.309 0.0209 **
Observations = 9
Degrees of Freedom = 3
Sum of Squared Errors = 0.0328959
Residual Variance = 0.0109653
R-squared = 0.934906
On Tuesday, April 8, 2025 at 04:49:22 PM GMT+2, Andreas Zervas
<anzervas(a)yahoo.com> wrote:
Hi all, especially Sven,
I was playing with the package thres_infer, and it appears that the threshold estimates
from functions H_thresh_test() and H_thresh_estim() differ. Is it intented? Should they be
the same? In the particular example from the sample script, which I pasted below, the
values are similar, but I run it with data that give totally different results.
Any thought - suggestions?
Best regards,
Andreas
gretl version 2024d
Current session: 2025-04-08 16:37
# Sample script for thresh_infer
Read datafile C:\Program Files\gretl\data\misc\denmark.gdt
periodicity: 4, maxobs: 55
observations range: 1974:1 to 1987:3
Listing 5 variables:
0) const 1) LRM 2) LRY 3) IBO 4) IDE
Test of Null of No Threshold Against Alternative of Threshold
Under Maintained Assumption of Homoskedastic Errors
Number of Bootstrap Replications: 1000
Trimming percentage: 0.150000
Threshold Estimate: 0.088000
(46 % of obs in 1st regime)
LM-test for no threshold: 4.154898
Bootstrap p-value: 0.923000
*******************************************
Threshold regression based on Hansen (2000)
User choice: assume homoskedasticity
*******************************************
Global OLS Estimation, Without Threshold
Dependent Variable: mg
OLS Standard Errors Reported
coefficient std. error z p-value
-------------------------------------------------------
Constant 0.0705718 0.0272334 2.591 0.0096 ***
IBO -0.469693 0.229408 -2.047 0.0406 **
IDE 0.110332 0.500081 0.2206 0.8254
Observations = 54
Degrees of Freedom = 51
Sum of Squared Errors = 0.0487311
Residual Variance = 0.000955512
R-squared = 0.162774
Heterosked. test p-val = 0.365732
*************************************************************
Threshold Estimation, dependent variable: mg
Threshold Variable: IDE
Threshold Estimate = 0.074 90% CI: [0.074, 0.11]
Sum of Sq. Errors = 0.0435625 Residual Var. = 0.000907553
Joint R-squared = 0.252
Heterosked. test p-value: 0.225
*************************************************************
Regime 1: IDE <= 0.074000
(standard errors do not take into account threshold uncertainty)
coefficient std. error z p-value
-------------------------------------------------------
Constant -0.833454 0.386015 -2.159 0.0308 **
IBO -0.774593 0.915857 -0.8458 0.3977
IDE 13.4116 6.06844 2.210 0.0271 **
Observations = 5
Degrees of Freedom = 2
Sum of Squared Errors = 0.00612267
Residual Variance = 0.00306133
R-squared = 0.425631
Regime 2: IDE > 0.074000
(standard errors do not take into account threshold uncertainty)
coefficient std. error z p-value
-------------------------------------------------------
Constant 0.0727286 0.0303053 2.400 0.0164 **
IBO -0.487763 0.233237 -2.091 0.0365 **
IDE 0.116314 0.505722 0.2300 0.8181
Observations = 49
Degrees of Freedom = 46
Sum of Squared Errors = 0.0374399
Residual Variance = 0.000813911
R-squared = 0.178561