Learn R Programming

pdR (version 1.9.3)

SMPLSplit_example: Example code for sample splitting

Description

A sample code for learning sample splitting.

Usage

SMPLSplit_example(data,dep,indep,th1,th2,trim_per,rep,plot)

Arguments

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.

Details

This code is the learning example for learning Hansen's econometric sample splitting. I detailed the description of each threshold stage.

References

Hanse B. E. (2000) Sample Splitting and Threshold Estimation. Econometrica, 68, 575-603.

Examples

Run this code
## 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

Run the code above in your browser using DataLab