楼主: 路路畅通
1665 1

[问答] 有关门限模型 门槛选择问题,求大神解答!!! [推广有奖]

  • 0关注
  • 0粉丝

初中生

0%

还不是VIP/贵宾

-

威望
0
论坛币
9 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
375 点
帖子
6
精华
0
在线时间
15 小时
注册时间
2010-8-2
最后登录
2016-6-26

5论坛币
本人利用门限模型做的门槛分别是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                     

fp <- data[,5]              
yf <- data[,7]                                 
d  <- data[,8]  
zb <- data[,10]
zc <- data[,11]  
dd <- data[,12]
wx <- data[,13]

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
}

y  <- lag_v(fp,0)#
yff <- lag_v(yf,1) #
zb1 <- lag_v(zb,1)#
zc1 <- lag_v(zc,1)#
dd1 <- lag_v(dd,1)#
wx1 <- lag_v(wx,1)#
d1 <- lag_v(d,1)   # set to threshold variable
yt <- tr(y)#
ct <- tr(yff)

关键词:门限模型 选择问题 percentage trimming percent 模型 程序
沙发
moretc 学生认证  发表于 2016-5-22 18:02:41 |只看作者 |坛友微信交流群
楼主能把门限模型的代码和资料发我吗,3105046469@qq.com

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-6-28 15:56