Tuesday, February 19, 2013

CRR Tree

Since we are assigned to report on the CRR tree, our group made a powerpoint presentation on this. It includes the basics of a CRR tree.



Notes: CRR presentation.pptx, CRRBOPMv2.xlsx

Jarrow-Rudd Tree (JR) tree is assumes 50% probability in the u and d. CRR don't.

Slide 6 


Step 1. Binomial model acts similarly to the asset that exists in a risk neutral world.
\[ pu+qd = e^{i * \Delta t} = r\]
where

\[\begin{split}
\Delta t &= \frac{t}{n} \\
t &= \text{term of the option} \\
n &= \text{number of periods}
\end{split}\]
Its variance: 
 \[ pu^2 + qd^2 – e^{(i* \Delta t)^2} = \sigma^2 \Delta t \]

Slide 9 - Notice that the lattice is symmetrical, that is due to the assumption that d=1/u (ud=1). Thus , it is easier to program since it involves fewer steps.

References:

Individual Project Ideas

Multivariate Analysis
  • Multivariate Regression 
  • 4 tests of assumptions (normality, homoskedasticity,  line, serial correlation or area of volatility)
  • pros: topic is easy to understand  
  • cons: familiar with Excel, Stata or Gretl, not practical to use in the near future
Time Series
  • AR and MA models
  • cons: familiar with Stata and Gretl
Portfolio Optimization: Non Linear LP
  • involving numerical methods for managing risks and return  
  • pro: very user specific (Objective functions and constraints)
  • cons: challenging to conceptualize through code
Portfolio Optimization: PCA and Factor Analysis
  • for managing risks and return, groupings for regression  
  • pro: familiar with the coding except for the eigenvalues
  • cons: familiar with other statistical software, not practical for long term use
CRR vs BS functions
  • CRR and BS for option pricing
  • pros: biased over this, will use in the near future
  • cons: have to review in detail
Monte Carlo Simulation: Option Pricing
  •  
  • pro: a fun idea
  • cons: 

Thursday, February 14, 2013

PCA and FA II

As the book by watsham tells us, PCA has two objectives:

  • to reduce the dimensionality
  • to interpret data.
Now I got confused with the reducing the dimensionality. As far as i know, it can only reduce linear combinations as non significant proportions of variability are eliminated. So I looked it up in myriad sources and found how can it actually reduce the dimensions.

This is how I got enlightened:

Let's say I have 100 stocks returns in an index and wanted to reduce or squeeze it into two or three variables. Since I have 100 stock returns, then I have also 100 principal components. The first of which (who has the highest eigenvalue) accounts for the highest variance and the 100th principal component accounts for the least as it is already ranked.  Note that what PCA do is it makes the principal components uncorrelated to each other. That means that even if the returns (input) itself is highly correlated as assumed, the principal components(output) which explains the variance are not.

There are two ways to do PCA. First is the eigenvalue decomposition (in the previous posts) and the other is  the singular value decomposition (still have to to research on this). Once we figure out the PC's that explain the majority of the variance, those PC's can serve as dependent variables in a regression. 

How is it different to factor analysis?

Even though PCAs appears to have "mathematically intuition", it is somehow lacks to have the "economic intuition". As I have understood, the PCA is only a subset of FA. FA group together variables according to its variability and in assumption that those variables are somewhat related or show characteristics that are the same.

Sources:
CAPM vs APT:
http://www.r-bloggers.com/principal-component-analysis-use-extended-to-financial-economics-part-2/

http://programming-r-pro-bro.blogspot.com/2011/10/principal-component-analysis-use.html

PCA and FA I

Principal Components Analysis 
    - answers the question " what are the major contributors to the overall variability?"
    - so we look at the "dependent" variables and analyze them


Sample Application:

  • Age Groups as variable - who among the age group contributes more. 
  • What moves the bond return the most? 
    • First, we make a lot of guesses on the x's variables such as:
      • tenor
      • coupon rate
      • yield
      • credit rating
      • duration
      • demand for the bond
      • inflation expectation
      • supply
      • money supply
      • political stability
      • GDP expectation
    • Next, we eliminate the some of the variables based on redundancy, data, etc.
      • credit ratings are all risk free (means 0 variance), so we eliminate it.
      • demand and supply are related. It can be considered as one. 
      • political stability is not measurable.
    • Then, we determine the data for the other variables as they are measurable
      • tenor
      • coupon rate
      • yield
      • duration
      • demand and supply for the bond - bid ask spread
      • inflation expectation - BSP futures curve or consensus estimate for GDP
      • money supply - entry growth BSP
      • GDP expectation 
    • we now can apply PCA to the variables
Applying PCA to the x variables
  • From the variance-covariance matrix, we get the correlation matrix. It is so because the data needs to be normalized first and we are able to achieve it by dividing the data by the standard deviation. And correlation matrix is the standardized form of the variance-covariance matrix.
  • Then get eigenvectors and the eigenvalues.
    • Eigenvectors - produce the matrix of linear combinations 
    • Eigenvalues - its total sum is the total number of variables in the standardized matrix
    • each eigenvector (linear combination) has its own eigenvalue 
  • Interpretation of the eigenvectors and the eigenvalues
    • divide the each eigenvalue by its sum gives us the proportion that eigenvector accounts to the total variance. The higher the proportion the more significant its contribution to the total variability. 
    • Some says that getting eigenvalues greater than 1 are the ones that are significant. So we disregard the ones that are less than one since they are not significant.
  • As application in portfolio management, this gives the portfolio manager the opportunity to adjust the weights of the portfolio components so as to reduce the element of risk.
  Factor Analysis
  • main focus: summarization and data reduction
  • Given the variables, it answers the question "What drives the variables?"
  • this analysis is an ends by itself  or can be a part of a process
  • Stock = A Factor1 + B Factor2 + C Factor3, where the factors are the groups.
Example: 

Given stocks 1-10, (in the dummy stocks excel, and quant prof) we apply factor analysis. First we get the correlation matrix from group statistics, and then apply factor analysis with the correlation matrix.

From the unrotated loadings, we determine each group or factor by ranking as shown on the example below.


There are other ways to get the factor analysis. What is important is that we know how to analyze the data given.

This can be one of the individual projects. can also be ANOVA, test of hypothesis, etc.

PCA and FA application - factoranalysis.xlsx

Consider the linear combinations of 3 factors given below. We assumed that there are 3 factors affecting stockA, B and C.


For Problem1, we want to find the weights to invest in stock A,B and C, considering equal returns for the three stocks. For Problem2, we want to find the weights to invest in stock A,B and C, considering only Stock C returns. This is called one factor analysis. For Problem3, we want to find the weights to invest in stock A,B and C, considering only Stock A and half of Stock C returns. The problem is summarized on the table below.

 Solution:

To solve for the weights, we used the "matrix OLS" as a solution.
\[\hat{y} = \hat{x}\hat{b} \to \hat{b} = \hat{x}^{-1}\hat{y}\]
 In this case $\hat{y}$ is our expected returns, $\hat{b}$ is our weights and \hat{x} is the factors affecting the returns.

With problem 1, we applied multi-factor sensitivity as all of the factors and stocks are considered. After solving for the weights, we have to buy 47% of stock A, sell 77% of stock B and buy 145% of Stock C. Also it is found that we have to borrow 15% since the total sum of the weights is 115%.

Problem 2 only considered Stock C. When we do this, one factor sensitivity is used. As a result in finding for the weights, we have to sell 145% and 174% for stocks A and C respectively. (Can we sell what we don't have??) The total sum of the weights are 9% meaning it is not fully allocated.
 

Problem 3 considers a return for Stock A and half of Stock C only. This results to allocating 60%, 130% and -134% to the stocks A, B and C respectively. Total sum of the weights is 55% which pertains to the total allocation.



Sources: ppt class presentations, class lectures and quantprof VBA

PCA and FA Intro

Difference between PCA and FA to Others

Recall:

Multiple Regression (MR): relationship between an exogenous variable and many endogenous variable

Cointegration: endogenous variables are stationary (means the joint probability distribution does not shift through time and space, mean and variance remain constant throughout time and position)

Mean-Variance Analysis: measures the total collective variability of a group of variables, without specifically identifying which subgroups contribute to that variability

PCA and FA
  • compared to MR examines only the endogenous variables
  • compared to Cointegration it may not need to be stationary
  • compared to Mean-Variance Analysis, PCA identify and rank subgroups and their contribution to the total variability
  • Both uses variance-covariance matrix
Characteristics of Mutivariate Statistics
  • Volatility in the multivariate structure
  • Correlation or colinearity between variables
Principal Components Analysis

- volatility of multivariate structure is measured and analyzed
- total variability is measured by the sum of the eigenvalues (sum of the diagonals in the matrix)

Factor Analysis
- correlation between the variables of  a multivariate structure is analyzed

Sources: Quantitative Methods in Finance by Watsham and Parramore

Thursday, February 7, 2013

Portfolio Optimization Problems

Portfolio Optimization is a way to determine the weights to be allocated in each investment so that the amount of expected return and the level of risk optimally meets the investor's objective. To do that, we can either maximize the returns subject to the maximum level of risk or minimize the risk subject to the acceptable level of expected return.

LP Application

From the book, the applications of LP and Non LP in Finance involves portfolio selection. The construction of the portfolios is within the framework of CAPM and details can be found in the book as to how it was derived. It can maximize the expected return while controlling systematic risk.

Sample: Given 3 assets portfolio
\[ \text{Max (return)} = 0.11W_a +0.15W_b+0.08W_c\]
subject to:
  1. $W_a+1.2W_b+0.9W_c \le 1.1$
  2. $0 \le W_a, W_b, W_c \le 1$
  3. $W_a + W_b + W_c = 1$
Explanation:
  • The expected return of the individual assets A, B and C are 0.11, 0.15 and 0.08 respectively.
  • Constraint 1 tell us that the individual risks $\beta_a$, $\beta_b$ and $\beta_c$ for the assets are 1, 1.2 and 0.9 respectively. It also tells us that the portfolio risk or $\beta$ must not exceed 1.1.
  • Constraint 2 tell us that all assets must have non negative weights
  • Constraint 3 tells us that the funds must be fully invested for sum of the weights is equal to 1.
This can be solved using Graphical Method or the Simplex Method. Consequently, the objective function and constraints can still be reduced into much simpler form when $W_c=1-W_a-W_b$ is substituted to each of the equations.

\[ \text{Max (return)} =0.03W_a+0.07W_b+0.8\]
subject to:
  1. $0.1W_a+0.3W_b = 0.2$
  2. $ W_a + W_b = 1$
Note that the individual expected returns and asset \betas are fixed subject to portfolio manager point of view because they are determined by the market. Weightings on the other hand are variable and at the discretion of the portfolio manager as it can be adjusted in order to achieve the objective. Therefore, the portfolio return and the portfolio risk can be engineered by the portfolio manager by adjusting the proportions of each asset in the portfolio.

Non LP Application

Investor requirements usually constrain the selection process. Thus, they can require that the risk to be minimized subject to the greater or acceptable level of expected return. Since the risk is a quadratic function of the variance of the security returns, a non LP optimization is needed. In mathematical terms, three asset portfolio optimization can be formally written as
\[ \text{Min} Z = W^T V W \]
subject to
  1. $W_a+W_b+W_c = 1$
  2. $W_aE(r_a)+W_bE(r_b)+W_cE(r_c) \ge R$
The objective function may look familiar as it is the variance of the portfolio. We are after all minimizing risk. The first constraint tells us that we want the assets to be fully invested. And the second constraint explains that we want the portfolio return to be greater than or equal to the minimum level of expected return.

Sample: Given a three asset portfolio whose
\[ V = \begin{bmatrix}
0.00015 & 0.0005 & -0.00007 \\
0.00005 & 0.00025 & -0.00003 \\
-0.0007 & 0.00003 & 0.00010
\end{bmatrix}\]
then, we have

\[ \text{Min} Z = W^T V W \]
subject to
  1. $W_a+W_b+W_c = 1$
  2. $0.11W_a+0.15W_b+0.08W_c \ge 0.11$
Here, we assume that the negative positions in each assets are not possible. We can also transform the OF function into
\[ \begin{align} \text{Min} Z &= 0.00015W_a^2 + 0.00025W_b^2+0.00010W_c^2\\
 &+0.00010W_aW_b-0.00014W_aW_c-0.0006W_bW_c \end{align}\]
subject to
  1. $W_a+W_b+W_c = 1$
  2. $0.11W_a+0.15W_b+0.08W_c \ge 0.11$
Source: Quantitative Methods in Finance by Watsham and Parramore

LP and Non-LP Issues

Linear Programming

  • Mathematical method used for optimization problems
  • Main applications are to maximize profits and minimize costs
  • Objective function is linear when:
    • Optimum always attained at constraint boundaries
    • A local optimum is also global optinum
  • Other applications
    • operational research - solve multi-commodity flow issues and network flow
    • strategic games - chess, manufacturing, resource conservation, transportation systems for buses and trains, and military budgeting
    • microeconomics
  • Assumptions:
    • all variables have non-negative values
    • A negative value will be written as a function of two non negative values
      • ie. If $x = -5$, then we let $x_1 = 0$, $x_2=5$ and assign $x = x_1 - x_2$
  • Advantages:
    • Works with inequalities with non negative coefficients. As long as the inequalities are changed into standard form
    • The simplex algorithm can determine if there is no solution to the problem (if pivot can't be made)
    • Algorithm is easy to program in a computer
  • Disadvantages:
    • The algorithm becomes inefficient if too many variables are used. It may require an exponential number of steps.
    • Strict inequalities might not work in LP
  • Example: same example as earlier, using x as the first pivot

Non Linear LP
  • Objective function is non linear when:
    • Optimum may be interior as well as at boundaries of constraint 
    • A local optimum is not necessarily the global optinum
  • Nonlinearity came from
    • multiplication of variables: economies of scale, transaction costs
    • quadratic terms: variances, interest rates mean-variance optimization
    • nonlinear functions: quantiles in common risk measures
  • Approach to nonlinear optimization: iterative method
    • Basic Numerical methods: Solving for non linear functions
    • Other methods: 
      • Steepest Descent Method
      • Newton's Method 
      • Quasi-Newton Method
      • Lagrange multipliers 
      • Conjugate Gradient Method
      • Penalty Function Method
  • In general, optimization problems are unsolvable.
  • "It's the user's responsibility to choose an algorithm that is appropriate for the specific applications
Take-aways
  • revised way of pivoting starting with $x$ in the simplex method
  • What if the constraints are less than the unknown? Will there be a difference in the simplex method?
  • Always check on the assumptions coz it might not gonna work because of wrong constraints
  • the answer might not be exactly the solution to the problem at hand. We might be creating more problems than the solution of the problems
  • Portfolio optimization technique - "robustness"
  • The methods are just tools for the user to use. The question is, is the user using the right tools for the problem at hand?

Resources: Class groups ppt.