thr_test_hom: Threshold Test under Homoskedasticity

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

View source: R/thr_test_hom.R

Description

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

Usage

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

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 (default) for efficient, quick computation; set quick = 0 if memory is limited (perhaps for large data sets).

Details

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

  2. The function stores the sequential design matrices in order to speed up the bootstrap computations. It is possible that if your dataset is very large, this will exceed your computer RAM memory. If so, function will crash, and the message Error: allocMatrix: too many elements specified will be displayed. If more RAM is not available, switch to quick = 0. The switch quick = 0 requires the bootstrap to re-calculate the design matrices for each bootstrap replication, which requires less memory, but somewhat more computer time.

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_het for threshold test under heteroskedasticity, 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_hom(data, 1, 2:5, 6)

output$f_test
output$p_value

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