Thursday, July 12, 2012

Sustainable programming habits - Abstraction

Programming, or more specifically, coding is the process of stating what you want in a precise language that computer can understand. Compared to general human languages, computer programming languages have inconvenient structures for their clarity. It's because you have to tell your computer the details that you wouldn't have to tell when you were dealing with a human being.


Since you have to state every tiny detail, the coding process easily becomes a series of tedious and monotonous tasks. Therefore, making the code you once built be in a reusable form comes to be very important in order to avoid monotonous tasks as much as possible.


Then how should we write reusable code? You can achieve it by following the big rule that one logic (logical flow) should be stated only once in the code. For instance, suppose there is the code that performs  the function of buying an apple and the code for purchasing a bunch of grapes. the series of actions required in the process of 'purchasing a product' - such as comparing prices in the market, selecting one, paying the price, and receiving the product - should be the same regardless of whether the product is an apple or a bunch of grapes. Since the two processes share the same logic, they can be implemented by the same code upon abstraction of an apple and a bunch of grapes into a 'product.' If you write the code for the same logic of purchasing a product separately for two products, that task will be boring and unnecessarily take your time. Moreover, if you find there is something wrong with your logic for buying a product, you have to modify two (or possibly pretty many) different parts of code for one modification of the logic. It severly increases your chance of making mistakes without a doubt. To write proper code that fits our big rule, we can use Top-Down or Buttom-Up approach.

Top-Down approach is to group and separate the parts of the logic that is likely to be re-used before starting to write code. Although it has an advantage that you can establish a well-defined structure of the code, this can lead to unnecessarily complex code structure because actually even any tiny part of a logic can be grouped and reused. That's why I don't recommend this approach.

Bottom-Up approach is first to write code that performs the desired task without extracting any sub-logics from the logic you are about to implement, and then adjust the code when needed. To be specific, in Bottom-Up approach, when you come to have to write similar code that shares some part of the logic used previously, you will separate that intersecting sub-logic into a form such as a function, a class, or etc. Let's assume that you have written the code for purchasing a bunch of grapes. In Bottom-Up approach, when you need to write the code for buying an apple later, you will extract the code for purchasing a 'product' from the previously written code for buying a bunch of grapes. Then in the code for purchasing a bunch of grapes you will replace the whole code with the code of setting a bunch of grapes as a 'product,' and calling the function (or the code) for purchasing a product, and you will do the same for the code for purchasing an apple except that you will put in the new code the element of code that sets an apple as the 'product.'

I prefer Bottom-Up approach to Top-Down one. Top-Down approach contributes to unnecessarily complex code, and thus to the code which is hard to understand (or hard to debug). On the other hand, Bottom-Up approach allows you to write the code for immediate neccesity without hesitation, and to conduct abstraction when it's actually needed. We call the process of extracting necessary elements for abstraction from the previous code as "Refactoring." There are several Refactoring tools that can be used in Visual Studio development environment, which is largely used for C++ and C# language based program development. Unfortunately, I couldn't find a Refactoring tool for VBA, which I'm currently using very much. However, I think you can use a Refactoring tool for VB.Net as a substitute.


In short, although coding can be a tedious and monotonous job, you can minimize such monotonic tasks by using abstraction technique properly. To achieve this, I recommend Bottom-Up type coding style and I suggest you use the Bottom-Up type programming support tools, which are available for several well-known programming environments.

Friday, July 6, 2012

Time Series Divider


(download link)

This excel file divides a time series whenever the linear trend of the time series changes. To achieve this, I used my own modified version of Quandt (1960) statistic. Since Quandt type dividing requires a regression model, I used a simple linear trend regression model as the underlying model.

Tuesday, April 10, 2012

Thin Plate Spline


The results of Thin Plate Spline Smoothing with 30 sample points

I have implemented Thin Plate Spline (TPS) smoothing for constructing initial Implied Volatility Surface estimate from limited data points that has different forward-moneyness grid points for each maturity. With this feature, I have tested the performance of TPS with a sample function.

Original function: sqrt( (x-0.5)^2 + (y-0,5)^2 )
domain: [0,1]x[0,1]
Construction of the input data: I generated 30 random points in the domain and calculated the theoretical function values of them.

After applying thin plate spline to 30 sample input points, we get the above approximated function values for each point in the grid on the domain [0,1]x[0,1].

Thursday, February 9, 2012

Coming up!

Posts on the following issues will be updated shortly.
Issues:

  • Cholesky decomposition for the MLE estimation of a correlation matrix
  • Parallel computing in MATLAB

Wednesday, February 8, 2012

Nonlinear Optimization


Presented on February 8, 2012

Pair Copula Contructions of Multiple Dependencies


Presented on April 4, 2011

The Hamilton Regime Switching Model


Presented on October 15, 2010

Exchange Rate Risk and International Investment with Regime Switching Mixed Copula (submitted)


download pdf

Curriculum Vitae

Curriculum Vitae (download pdf)

Kyuwon Choi
100-241Bunji, Haengun Dong, Gwanak Gu, Seoul City, Republic of Korea
Phone: +82-2-877-2714
Cell: +82-10-5040-5333
diekun84@snu.ac.kr

Research Interest:

Financial Derivatives Pricing, Asymmetric Dependence between Financial Assets, Market Efficiency, International Asset Allocation, Risk Management, Credit Risk Modeling

Education:

M.S., Industrial Engineering, Seoul National University, Feb 2012
ŸConcentrations: Financial Engineering
ŸThesis: Exchange Rate Risk and International Investment with Regime Switching Mixed Copula
ŸGPA: 4.10/4.30

B.S, Industrial Engineering, Seoul National UniversityFeb 2010
ŸGPA: 3.80/4.30, Cum Laude

Awards and Honors:

Recipient, 10th Samsung Scholarship Program, 2012-2017 (awarded)
Graduated Cum Laude, Seoul National University, 2010
Recipient, Korea Student Aid Foundation Scholarship (merit based), 2003-2005 & 2009
Korea Physics Olympiad, Bronze Medal at the Seoul Contest, 2002

Conference Proceedings:

“Exchange Rate Risk and International Investment with Regime Switching Mixed Copula,” (with Hyung-Sik Oh), 2011, Korean Securities Association Conference Proceedings, May 2011.

“Empirical Analysis: Order Imbalance of Each Investor Group and Forecasts of Short Term Equity Returns,” (with Hyung-Sik Oh), 2010, Korean Institute of Industrial Engineers, Fall Conference Proceedings, Nov 2010.

“Asymmetry of volatilities and correlation coefficients, and returns in KOSPI200 stocks,” (with Yeonsik Jang, Sue-Jeong Kwon, Hyung-Sik Oh), 2010, Korean Institute of Industrial Engineers, Fall Conference Proceedings, Nov 2010.

Publications:

“Exchange Rate Risk and International Investment with Regime Switching Mixed Copula,” (with Hyung-Sik Oh), submitted.

Working papers:

“Market inefficiency in the Japanese Swaption market” (with Dong-Hyun Ahn, Ji-Yeong Chung)

Experience:

Computer Programmer, Jan 2006 – Jan 2008, YoungWoo CnI, Seoul, Korea
ŸDeveloped several Computer Aided Design software packages including TexPro, TexKnit, TexWeave
ŸUsed C++, Boland Studio 6.0, Adobe Flex extensively
Computer Programmer, Feb 2008 – Feb 2009, ESTsoft, Seoul, Korea
ŸDuties included Developing multimedia applications including ALSee Moviemaker (link), and a user authentication module, ALtools Package Authentication Module
ŸUsed C++, Visual Studio 2005 & 2008 extensively
Teaching Assistant, Engineering Economy, 2010, Industrial Engineering Department, Seoul National University, Seoul, Korea
Research Assistant, Investment Engineering Lab., 2009 - Present, Industrial Engineering Department, Seoul National University, Seoul, Korea
ŸConducting a research project on international investment
ŸDuties include literature review, designing models, programming experiments, and writing a paper on the results
Proofreader, 2011 - Present, Department of Economics, Seoul National University, Seoul, Korea
ŸAssisting Professor ByoungSeon Choi in writing a textbook on Financial Engineering
ŸExamining the manuscripts to make sure proofs in the book are free of errors

Activities:

Peer Tutoring Program, 2011-Present, Tutor, Teaching English to freshmen, Seoul National University, Seoul, Korea
English Café, 2011-Present, Member, Managing the café and talking with visitors in English, Seoul National University, Seoul, Korea
AIESEC, 2003-2004, Vice President, International Student Internship Program, Recruited companies, matched, delivered and managed foreign students as interns for the companies, Seoul National University, Seoul, Korea

Skills and Qualifications:

Statistical Package:
ŸExtensive knowledge of MATLAB statistical programming
ŸWorking knowledge of SPSS, SAS
Econometrics:
ŸNonlinear Stochastic Optimization
ŸMarkov Regime Switching Model Estimation, Multivariate Copula Estimation
ŸFinancial Time Series
Mathematical Methods:
ŸStochastic Calculus
ŸFinite Differential Methods, Monte Carlo Simulation
Chartered Financial Analyst (CFA) Level III Candidate
Extensive programming ability in C#, C++, VBA and PHP
Native in Korean and Fluent in English (TOEFL iBT 115 (29/29/27/30), GRE 760/800/3.0)