本人利用门限模型做的门槛分别是0.11,0.19,0.40,我打算调整程序使得门槛之间的值大于0.1,也就是希望能够生成门槛为0.11和0.40,或者0.19和0.40. 需要修改Trimming Percentage吗,但是试了好几遍,都无法实现。求大神帮忙,谢谢!!!程序如下:
data <- read.csv("data12_1.csv")
t <- 9
nt <- nrow(data)
n <- nt/t
qn <- 150 # number of quantiles to examine
conf_lev <- 0.95 # confidence level for threshold
vgraph <- 1 # set to 1 to graph likelihood ratios
boot_1 <- 300 # number of replications, 0 for no bootstrap, single (300)
boot_2 <- 200 # number of replications, 0 for no bootstrap, double (300)
boot_3 <- 200 # number of replications, 0 for no bootstrap, triple (300)
boot_4 <- 200
trim_1 <- 0.02 # percentage to trim before search, single
trim_2 <- 0.1 # percentage to trim before search, double
trim_3 <- 0.1 # percentage to trim before search, triple
trim_4 <- 0.1 ####
max_lag <- 1
tt <- t-max_lag
ty <- n*(t-max_lag-1)
lag_v <- function(x,lagn){
yl <- matrix(c(0),nrow=n,ncol=t)
for (i in 1:n) {
yl[i,]<-x[(1+(i-1)*t):(t*i)]
}
yl <- yl[,(1+max_lag-lagn):(t-lagn)]
out <- matrix(t(yl),nrow=nrow(yl)*ncol(yl),ncol=1)
out
}
tr <- function(y){
yf <- matrix(c(0),nrow=n,ncol=tt)
for (i in 1:n) {
yf[i,]<-y[(1+(i-1)*tt):(tt*i)]
}
yfm <- yf- colMeans(t(yf))
yfm <- yfm[,1:(tt-1)]
out <- matrix(t(yfm),nrow=nrow(yfm)*ncol(yfm),ncol=1)
out
}