Example code for sample splitting
A sample code for learning sample splitting.
latin1
SMPLSplit_example(data,dep,indep,th1,th2,trim_per,rep,plot)
data
: the data in either data.frame or matrix.dep
: the name of dependent variable.indep
: the name(s) of independent variable(s)th1
: the first threshold variable.th2
: the second threshold variable.trim_per
: trimmed percentage.rep
: nNumber of bootstrap repetitions.plot
: =1, plot; =0, do not plot.This code is the learning example for learning Hansen's econometric sample splitting. I detailed the description of each threshold stage.
Original code offered by Dr. B. E.Hansen (http://www.ssc.wisc.edu/~bhansen/).
Hanse B. E. (2000) Sample Splitting and Threshold Estimation. Econometrica, 68, 575-603.
## Not run, becasue of bootstrap replicaiton takes time. Users may unmark # and run. data("dur_john") #rep <- 500 #trim_per <- 0.15 #dep <- "gdpGrowth" #indep <- colnames(dur_john)[c(2,3,4,5)] #th1 <- "GDP60" #th2 <- "Literacy" #OUT=SMPLSplit_est(data=dur_john,dep,indep,th=th1,plot=0,h=1,nonpar=2) #OUT$TEST #OUT$Hypothesis #OUT$Threshold #stat=matrix(as.numeric(OUT$TEST),byrow = TRUE,8,2) #colnames(stat)=c("F-Stat","P-value") #rownames(stat)=OUT$Hypothesis #stat
Useful links