Skip to content

Instantly share code, notes, and snippets.

View kongscn's full-sized avatar
💭
I may be slow to respond.

Shel Kong kongscn

💭
I may be slow to respond.
View GitHub Profile
@kongscn
kongscn / naoperation.r
Last active December 20, 2015 14:49
Remove NA in R
# Reference:
# http://stackoverflow.com/questions/4862178/remove-rows-with-nas-in-data-frame
# example from ?na.omit, changed.
# use complete.cases to get a bool vector of cases without missing data.
DF <- data.frame(x = c(1, 2, 3), y = c(0, 10, NA), z = c(NA, 10, 6))
DF[complete.cases(DF), ]
# this can be used to choose specific columns of interests
#NoTrayIcon
PythonDir = %A_ScriptDir%\..\python\App
MeldDir = %A_ScriptDir%
params := ""
firstParam := true
Loop, %0%
{
@kongscn
kongscn / profile.do
Created October 31, 2013 09:05
Stata profile.do
**************************************
* Stata profile.do
**************************************
if "`c(os)'" == "Windows" {
sysdir set PLUS "`c(sysdir_stata)'ado/plus"
sysdir set PERSONAL "C:/Users/`c(username)'/stata/ado"
}
else {
sysdir set PLUS "~/stata/ado/puls"
@kongscn
kongscn / solution_35.r
Last active August 29, 2015 13:59
Solution of 3.5
# 3.5
setwd("D:/")
a = read.table("m-intc7308.txt", head = T)
# 调整成时间序列数据
ts1 = ts(data = a[[2]], start = 1973, frequency = 12)
lts1 = log(1 + ts1)
# 转化成对数收益率
acf(lts1)
# 观察 ARIMA 模型的阶数 (定阶)
pacf(lts1)
@kongscn
kongscn / learning-R.md
Last active August 29, 2015 14:01
R notes

R notes

Recommanded packages

  • plyr
  • describe{Hmisc} Generate latex tables.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% LaTeX snippet: language and style definition of Stata for listings package.
% [listings](http://www.ctan.org/pkg/listings)
% [Stata](http://www.stata.com/)
%
% Usage:
% Copy the code into your preamble, or import it by `\include` .
% then in your doc:
% \lstinputlisting[style=numbers]{DO-SCRIPT}
% \lstinputlisting[style=numbers, style=stata-editor]{DO-SCRIPT}
; Common Lisp code example
(defun foo (n)
(lambda (i) (incf n i)))
@kongscn
kongscn / reading_plan.md
Last active August 29, 2015 14:02
Reading plan

Reading Plan 2014-06-12

Economics/Finance

  • Modern Portfolio Theory and Investment Analysis
  • Options, Futures, and Other Derivatives 8th
  • Statistics of Financial Markets 3rd
  • Analysis of Financial Time Series 3rd
  • Econometric Analysis of Cross Section and Panel Data

研究课题

  • 融资融券业务量化交易策略研究
  • 券商柜台转让相关问题研究
  • 券商做市策略研究及自主开发
  • 证券公司财富管理业务发展模式及其应用研究
  • 证券公司资本管理方案研究
  • 证券公司经济资本分配体系建设研究
  • 互联网金融模式下证券业务的风险管理及对策
@kongscn
kongscn / rmd-demo.Rmd
Last active August 29, 2015 14:03
rmd demo
---
title: "Rmd Demo: Chinese Enabled"
author: "Shel Kong"
date: "Wednesday, July 02, 2014"
hello: "world"
output:
html_document:
highlight: pygments
number_sections: yes
theme: flatly