R_quant

quant

  ind1 <- which(tmp$market_per < x )
  ind2 <- sort(c(ind1,ind1+1))
  ans <- tmp[ind2,]
  a <- ans$other_clo[seq(2,nrow(ans),2)]/ans$other_clo[seq(1,nrow(ans),2)]-1
  a<- f.rNA(a)
  a <- a[-which(a==max(a),arr.ind = TRUE)]
  per <- mean(a)
  t.s <- t.test(a)
  t_value <- unname(t.s$statistic)
  num=length(a)/2
  res <- data.frame(other_profit=per,other_Tvalue=t_value,other_index=x,other_num=num)
  result <- rbind(result,res)
  x=x+0.1
}
table(substr(ans$date,1,4))/2

mean(ans$other_per[seq(2,nrow(ans),2)],na.rm=T)
result$cum <- result$other_profit*result$other_num
result
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章