Detect discontinuities using the Lasso-based covariance test as proposed in Backus and Peng (2018). If you use this package, please cite the our article below:
The functions in this package are:
detectdisc: This is the main function for the test using a polynomial basis and 10-folded cross validation. The inputs are: an independent variable X, a dependent variable Y, and False Discovery Rate (FDR) control alpha. The outputs are the detected location of discontinuities and plot.
lassocovtest: This is the main function for the test. Users can customize the basis functions, cross-validation, the maxmium number of discontinuities allowed and support trimming within this function.
mylarsp: This is the function implementing the algorithm proposed in the paper including a moddified combination of
- LARs algorithm by Bradley Efron, Trevor Hastie, Iain Johnstone and Robert Tibshirani "Least Angle Regression" and code modified from Sung Soo Kim's work,
- Lasso covariance test by Richard Lockhart, Jonathan Taylor, Ryan J. Tibshirani, Robert Tibshirani "A significance test for the lasso"
- False Discovery Control by Max Grazier G'Sell, Stefan Wager, Alexandra Chouldechova and Robert Tibshirani in "Sequential selection procedures and false discovery rate control".
Example: This script implements our method with one simulation example and one real data example. The plots for both examples are displayed below.
Simulation example with y = exp(x) + 5(x>-0.5) + 5(x>1)+\epsilon
Real data example from Lee (2008). "Randomized experiments from non-random selection in
U.S. House elections"