thr_test_het: Threshold Test under Heteroskedasticity

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/thr_test_het.R

Description

Computes a test for a threshold in linear regression under heteroskedasticity.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
thr_test_het(
  df,
  yi,
  xi,
  qi,
  var.names = colnames(df),
  trim_per = 0.15,
  rep = 1000,
  cr = 0.95,
  graph = TRUE,
  quick = 2
)

Arguments

df

Data frame.

yi

Integer or character; index or column name of dependent (y) variable in df.

xi

Integer or character vector; indexes or column names of independent (x) variables in df.

qi

Integer or character; index or column name of threshold (q) variable in df.

var.names

Character vector; variable names with length(var.names) == ncol(df) corresponding to columns in df to be used in threshold regression table. Default is colnames(df).

trim_per

Numeric; percentage of sample to trim from ends. Default is trim_per = .15.

rep

Integer; number of bootstrap replications. Default is rep = 1000.

cr

Numeric; confidence level used to plot the critical value in the graph. It is not used elsewhere in the analysis. Default is cr = .95.

graph

Logical; graph indicator. Set TRUE (default) to view the graph of the likelihood; set FALSE otherwise.

quick

Integer; indicator of method used for bootstrap. Set quick = 1 for quick computation of asymptotic distribution. This method is not a proper bootstrap and may result in excess rejections. It also uses more memory. Set quick = 2 (default) for a better bootstrap procedure, which also uses less memory, but is more time consuming.

Details

  1. Do not include a constant in the independent variables; the function automatically adds an intercept to the regression.

  2. There are two bootstrap methods which the function can use.

    The first method, obtained by setting quick = 1, is the method presented in the paper Hansen, B. E. (1996). Inference When a Nuisance Parameter is Not Identified Under the Null Hypothesis. Econometrica, 64(2):413-430. https://www.ssc.wisc.edu/~bhansen/papers/ecnmt_96.pdf, which simulates the asymptotic null distribution. A computational shortcut is also taken which speeds computational time, at the cost of greater memory usage, so may not be possible for large data sets.

    The second method, obtained by setting quick = 2, is a "fixed regressor bootstrap", which is quite close. The difference is that the bootstrap procedure calculates the variance-covariance matrix in each bootstrap replication. This results in a better finite sample approximation. The cost is greater computation time.

    The function is set by default to use the second method (quick = 2), which has better sampling properties. If computational time is a concern, switch to the first method (quick = 1). If an "out of workspace memory" message appears, switch back to quick = 2.

Value

A list with components:

f_test

the value of Maximal (Quandt) F-statistic.

p_value

the bootstrap p-value.

Author(s)

Marcel Kremer, marcel.kremer@uni-due.de

Bruce E. Hansen, behansen@wisc.edu

References

Hansen, B. E. (2000). Sample splitting and threshold estimation. Econometrica, 68(3):575–603. https://doi.org/10.1111/1468-0262.00124. https://www.ssc.wisc.edu/~bhansen/papers/ecnmt_00.pdf.

See Also

thr_test_hom for threshold test under homoskedasticity, thr_est for threshold estimation.

Examples

1
2
3
4
5
6
## Performs part of the empirical work reported in Hansen (2000)
data <- dur_john
output <- thr_test_het(data, 1, 2:5, 6)

output$f_test
output$p_value

mlkremer/thrreg documentation built on May 8, 2021, 9 p.m.