ams-q01-sol-04-m.nb 1 AMS 691.02 - Portfolio Theory and Capital Markets I Solutions 4 - Factor Models Robert J. Frey Research Professor Stony Brook University, Applied Mathematics and Statistics frey@ams.sunysb.edu Exercises for Class 3. The Chapters refer to Luenberger’s Investment Science. February 16, 2005 Mathematica Tutorial A matrix in Mathematica is represented by a list of equal length lists. The function "MatrixForm" is useful for displaying both vectors and matrices in a user friendly form. v = 81, 2, 3<; q = 881, 2, 0<, 84, 0, 6<, 80, 8, 9<<; MatrixForm@vD MatrixForm@qD 1y i j z j z j z j j2z z j z k3{ i1 j j j j 4 j j k0 2 0 8 0 6 9 y z z z z z z { In Mathematica vectors are treated as one-dimnsional objects not as row or column vectors per se. Thus, the bilinear form vT Qv can be entered as ams-q01-sol-04-m.nb 2 v.q.v 178 The "Solve" function attempts to solve an equation or system of equations symbolically. It returns its results as a list of a list of production rules. Each top-level list represents a solution. ? Solve Solve@eqns, varsD attempts to solve an equation or set of equations for the variables vars. Solve@ eqns, vars, elimsD attempts to solve the equations for vars, eliminating the variables elims. More… For this system of equations there are four possible solutions. Each solution consists of two production rules. Solve@8y1 == a x12 + b, y1 ã c x22 + d<, 8x1, x2<D è!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!! -b + y1 -d + y1 -b + y1 -d + y1 99x1 Ø - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅ , x2 Ø ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅ =, 9x1 Ø ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅ , x2 Ø ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ è!!! è!!! è!!! è!!! ÅÅÅÅÅÅÅ =, a c a c è!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!! è!!!!!!!!!!!!!!!! -b + y1 -d + y1 -b + y1 -d + y1 9x1 Ø ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ è!!! ÅÅÅÅÅÅÅ , x2 Ø - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ è!!! ÅÅÅÅÅÅÅ =, 9x1 Ø ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ è!!! ÅÅÅÅÅÅÅ , x2 Ø ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ è!!! ÅÅÅÅÅÅÅ == a c a c "Outer" is usually used to perform an outer product of two vectors, although it generalizes to other operations and to more complex list structures. ? Outer Outer@f, list1, list2, ... D gives the generalized outer product of the listi, forming all possible combinations of the lowestlevel elements in each of them, and feeding them as arguments to f. Outer@f, list1, list2, ... , nD treats as separate elements only sublists at level n in the listi. Outer@f, list1, list2, ... , n1, n2, ... D treats as separate elements only sublists at level ni in the corresponding listi. More… ams-q01-sol-04-m.nb 3 MatrixForm@Outer@Times, 8x1, x2, x3<, 8y1, y2<DD x1 y1 i j j j j j x2 y1 j k x3 y1 x1 y2 x2 y2 x3 y2 y z z z z z z { A numerical matrix may be inverted with "Inverse". ? Inverse Inverse@mD gives the inverse of a square matrix m. More… qi = Inverse@qD; MatrixForm@qiD MatrixForm@q.qiD 2 ÅÅÅ i 5 j j j j 3 j ÅÅÅÅÅ j j 10 j j j 4 k - ÅÅÅÅÅ 15 1 i j j j j j0 j k0 0 1 0 3 ÅÅÅÅÅ 20 3 - ÅÅÅÅÅ 40 1 ÅÅÅÅÅ 15 0 0 1 1 - ÅÅÅÅÅ 10 y z z z z 1 z ÅÅÅÅÅ z z 20 z z z 1 ÅÅÅÅÅ { 15 y z z z z z z { There are two common statistical functions used : "Mean" and "Variance". ? Mean ? Variance Mean@listD gives the statistical mean of the elements in list. More… Variance@listD gives the statistical variance of the elements in list. More… Chapter 7, Problem 2 Here's the data we are given in the problem. ams-q01-sol-04-m.nb 4 nRiskFree = 0.1; nMarketReturn = 0.18; mnCovariance = 880.04, 0.01<, 80.01, 0.02<<; vnMarketPortfolio = 80.5, 0.5<; The market variance is a function of the covariance and the market portfolio, both of which are known. nVarMarket = vnMarketPortfolio.mnCovariance.vnMarketPortfolio 0.02 The gradient of the Langrangian implies that Q x ∝ r – r f . Once we know the returns to within proportionality, we can then solve for them using the CAPM and the fact that the market portfolio has a b of 1. 8pA, pB< = mnCovariance.80.5, 0.5<; sol = First@ Solve@ 8 l pA ã bA HnMarketReturn - nRiskFreeL, l pB ã bB HnMarketReturn - nRiskFreeL, 1 ã 8bA, bB<.vnMarketPortfolio <, 8l, bA, bB<D D; Once the b's are known, the CAPM can be used to compute the asset returns. rA = nRiskFree + HbA ê. solL HnMarketReturn - nRiskFreeL rB = nRiskFree + HbB ê. solL HnMarketReturn - nRiskFreeL 0.2 0.16 As a final check, we verify that the asset returns when taken in proportion to the market portfolio yield the market return. nMarketReturn ã 8rA, rB<.vnMarketPortfolio True ams-q01-sol-04-m.nb 5 Chapter 7, Problem 6 Here are the data provided in the table and text of the problem in form appropriate for computation. vnAssetPrice = 81.50, 2.<; vnAssetShares = 8100, 150<; vnAssetReturn = 80.15, 0.12<; vnAssetSdev = 80.15, 0.09<; mnCorrelation = 881, 1 ê 3<, 81 ê 3, 1<<; mnCovariance = Outer@Times, #, #D &@vnAssetSdevD mnCorrelation; First, the market portfolio is computed as the proportion of each asset's market capitalizaion. # vnMarketPortfolio = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ &@vnAssetPrice vnAssetSharesD Plus üü # 80.333333, 0.666667< The expected rate of return and standard deviation are computed from the market portfolio applied to the expect asset returns and asset covariances. nMarketReturn = vnAssetReturn.vnMarketPortfolio è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!! nMarketSdev = vnMarketPortfolio.mnCovariance.vnMarketPortfolio 0.13 0.09 Letting "rf" represent the risk free rate, we can solve for bA and bB in terms of the risk free rate. ams-q01-sol-04-m.nb 6 sol = First@ Solve@ 8 vnAssetReturnP1T - rf ã bA HnMarketReturn - rfL, vnAssetReturnP2T - rf ã bB HnMarketReturn - rfL <, 8bA, bB< D D 1. H-0.15 + 1. rfL 1. H-0.12 + 1. rfL 9bA Ø - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅ , bB Ø - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅ = 0.13 - 1. rf 0.13 - 1. rf However, if we now weight these b's by the market portfolio, then we find the result is 1 independent of the value of "rf". Simplify@H8bA, bB< ê. solL.vnMarketPortfolioD 1. Any risk free rate works in satisfying the requirement that the market has a b of 1. Thus, the risk free rate is indeterminate. Chapter 7, Problem 8 The key returns are: nMarketReturn = 0.33; nRiskFree = 0.09; Note that p – êêp 1 1 E[I ÅÅÅÅÅÅÅÅ ÅÅÅÅ M(rm – rêm )] = E[H ÅÅÅÅ1c L E[Hp – êê pL(rm – rêm )] = ÅÅÅÅ12 ( ÅÅÅÅ ÅÅ + ÅÅÅÅ ÅÅ ) 20 s2m c 20 16 and by the definition of b p– p 1 1 1 ê 2 b = E[I ÅÅÅÅÅÅÅÅ c ÅÅÅÅ M(rm – rm )] / sm = ÅÅÅÅ 2 ( ÅÅÅÅ 20ÅÅ + ÅÅÅÅ 16ÅÅ ) 20 êê 1 1 1 y j nBeta = ÅÅÅÅ i j ÅÅÅÅÅÅÅ + ÅÅÅÅÅÅÅ z z 20. 2 k 20 16 { 1.125 We can now determine the CAPM return. ams-q01-sol-04-m.nb nCapmReturn = nRiskFree + nBeta HnMarketReturn - nRiskFreeL 0.36 The actual rate of return projected is 1 i 24 24 y nExpectedReturn = ÅÅÅÅ j j ÅÅÅÅÅÅÅ + ÅÅÅÅÅÅÅ z z - 1. 2 k 20 16 { 0.35 Thus, the project falls slightly short of the return required by the CAPM. Chapter 8, Problem 2 The data for the problem are as follows. vnReturn = 80.15, 0.20<; nRiskFree = 0.10; mnFactorLoadings = 881, 2, 1<, 81, 3, 4<<; If we assume that the CAPM applies to the factors, then the excess factor returns are vnFactorExcessReturns = Inverse@mnFactorLoadingsPAll, 82, 3<TD.HvnReturn - nRiskFreeL 80.02, 0.01< We can now construct l = {l0 , l1 , l2 } by simply prepending the risk free rate to the factor returns. vnLambda = Prepend@vnFactorExcessReturns, nRiskFreeD 80.1, 0.02, 0.01< When we apply l to the original APT factor loadings we recover the original expected returns. 7 ams-q01-sol-04-m.nb 8 vnReturn ã mnFactorLoadings.vnLambda True Chapter 8, Problem 4 This the well-known statistical results for the sample mean and sample variance. Any text on mathematical statistics will provide a proof. Intuitively, however, we are using the sample, rather than true, mean in the computation of the sample variance and have lost a degree of freedom, i.e., we have n – 1 and not n independent data points. Chapter 8, Problem 6 Here is the raw data for the problem: two-years of monthly returns, expressed as percentages. vnMonthlyReturn = 81.0, 0.5, 4.2, -2.7, -2.0, 3.5, -3.1, 4.1, 1.7, 0.1, -2.4, 3.2, 4.2, 4.5, -2.5, 2.1, -1.7, 3.7, 3.2, -2.4, 2.7, 2.9, -1.9, 1.1<; nSampleSize = Length@vnMonthlyReturnD; The mean and standard deviation of return are nMonthlyMean = Mean@vnMonthlyReturnD è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! nMonthlySdev = Variance@vnMonthlyReturnD 1. 2.68166 Using the approximation suggested in the text, the annualized mean and standard deviation are nAnnualizedMean = 12 nMonthlyMean è!!!!!!! nAnnualizedSdev = 12 nMonthlySdev 12. 9.28955 ams-q01-sol-04-m.nb The standard deviations of the monthly estimates are è!!!!!!!!!!!!!!!!!!!!!!!!!!!!! nMonthlyMeanSdev = nMonthlySdev ë nSampleSize è!!!! è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! nMonthlyVarSdev = I 2 nMonthlySdev 2 M ë nSampleSize - 1 0.547392 2.1206 9