Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Calculating excess returns using factor models Phong Lan Nguyen September 2011 Dissertation submitted in partial fulfilment for the degree of Master of Science in Computing for Financial Markets Computing Science and Mathematics University of Stirling Abstract Problem: This dissertation is to build a Java program which interfaces to the data.txt which includes excess returns and the variable data of the Single-index model formula Objectives: The purpose of this dissertation is to help users calculate stock excess returns quickly and analyse the significant of it. Moreover, the program helps users decide to invest in specific stocks or not. Methodology: Single-index model formula is used to build this Java program to easy calculate the stock excess return. To calculate each part of the formula, there is some regression formulas applied. And the analysis of the significant of the model will be showed in the program. Achievements: A Java program was created to help investors evaluate the effective of invests throughout single-index model. Using this model to calculate excess return of a security is the easy way to make a good decision. However, users may have to collect data and save txt file to make sure it can be applied to the java program. The significant of the analysis will be concluded after calculating data. -i- Attestation I understand the nature of plagiarism, and I am aware of the University’s policy on this. I certify that this dissertation reports original work by me during my University project except for the equation is taken directly from the text book. Signature Date - ii - Acknowledgements I would like to show my appreciation to all kind people who had helped me a lot for this dissertation. Firstly, I would like to say thank to my supervisor Dr Savi Maharaj who helped me a lot when I get any problems and very kind to help me solve the problems, and also suggest me a lot for my dissertation. It will be very difficult for me to finish this dissertation without her help. Secondly, I would like to thank my classmates and my friends who test the program and help me when I get stucked with the code. Lastly, I want to show my really appreciate to my parents who support me to study here and encourage me through all the student life. - iii - Table of Contents Abstract ................................................................................................................................. i Attestation............................................................................................................................. ii Acknowledgements ............................................................................................................. iii Table of Contents ................................................................................................................. iv List of Figures...................................................................................................................... vi 1 Introduction ..................................................................................................................... 1 1.1 Background and Context ......................................................................................... 1 1.2 Scope and Objectives............................................................................................... 1 1.3 Achievements .......................................................................................................... 1 1.4 Overview of Dissertation ......................................................................................... 2 2 State-of-The-Art .............................................................................................................. 3 2.1 Overview ................................................................................................................. 3 2.1.1 Holding Period Returns ....................................................................................... 3 2.1.2 Expected return and standard deviation............................................................... 3 2.2 Diversification ............................................................................................................ 4 2.3 Variance and covariance ............................................................................................. 5 2.4 Excess return .............................................................................................................. 6 2.5 Factor models ............................................................................................................. 7 2.5.1 Single-factor model and Single-index model ...................................................... 8 2.5.1.1 The estimate of Alpha α .............................................................................. 11 2.5.1.2 The estimate of Beta β ................................................................................ 12 2.5.2 The Fama-French (FF) Three-factor Model ...................................................... 12 2.5 Computing tools ....................................................................................................... 13 2.6 Summary................................................................................................................... 15 3 Java Program ................................................................................................................. 17 3.1 Introduction for Users ............................................................................................ 17 3.2 Program structure .................................................................................................. 22 3.3 Problem and Solution ............................................................................................ 23 3.4 Java program in the project.................................................................................... 26 3.4.1 Advantages ....................................................................................................... 26 3.4.2 Disadvantages ................................................................................................... 26 3.5 Summary ................................................................................................................ 27 4 Conclusion ..................................................................................................................... 28 4.1 Summary ................................................................................................................ 28 - iv - 4.2 Feedback ................................................................................................................ 28 4.3 Future Work ........................................................................................................... 28 4.3.1 Limitation ......................................................................................................... 28 4.3.2 Future Work ...................................................................................................... 29 References .......................................................................................................................... 30 Appendix 1 – The variable’s data for Apple from 8th July 2011 to 18th August 2011......... 31 Appendix 2 – Stock excess return of Apple plc and Market excess return S&P500 from 8th July 2011 to 18th August 2011.................................................................................................. 33 Appendix 3 – Questionnaire ............................................................................................... 35 Appendix 4 – Users’ guide ................................................................................................. 36 -v- List of Figures Figure 1. Excel output: Regression statistic ....................................................................... 11 Figure 2. Example of manually calculate by Excel ............................................................ 14 Figure 3. Example of regression analysis function of Excel .............................................. 14 Figure 4. Example of a Java program ................................................................................ 15 Figure 5. The Main Interface of the program ..................................................................... 17 Figure 6. Select file to open. .............................................................................................. 18 Figure 7. Data file is successfully loading ......................................................................... 18 Figure 8. Warning Message when open wrong file ............................................................ 19 Figure 9. Excess return of market index ............................................................................ 19 Figure 10. Excess return of a security .............................................................................. 20 Figure 11. Result of Beta (the slope coefficient).............................................................. 20 Figure 12. Result of Alpha (the expected excess return of a security) ............................. 21 Figure 13. Result of e (the firm specific risk) .................................................................. 21 Figure 14. Result of Analysis ........................................................................................... 22 Figure 15. Structure of the program ................................................................................. 23 Figure 16. Example of blank table ................................................................................... 25 Figure 17. Program output ............................................................................................... 26 Figure 18. The main interface of the program ................................................................. 36 Figure 19. Select file to open. .......................................................................................... 37 Figure 20. Data file is successfully loading ..................................................................... 37 Figure 21. Warning Message when open wrong file ........................................................ 38 Figure 22. Fail to load file warning .................................................................................. 38 Figure 23. Excess return of market index ........................................................................ 39 Figure 24. Excess return of a security .............................................................................. 40 Figure 25. Result of Beta (the slope coefficient).............................................................. 40 Figure 26. Result of Alpha (the expected excess return of a security) ............................. 40 Figure 27. Result of e (the firm specific risk) .................................................................. 41 Figure 28. Result of Analysis ........................................................................................... 41 - vi - 1 Introduction 1.1 Background and Context With the development of finance and economics, there are many investors desire to use their money in best way to earn profit. . Such good ways is looking at raw data of stock then do some analyses then decide to invest. Computing science plays an important part in helping investors to evaluate the significant of each investment. They can use some applications that make them save time calculate profit. However, there are a limited number of programs which help investors to be easy calculating benefit or make decision of doing an investment. Although calculating stock excess return using factor models is not widely used, it is still a good way to evaluate the ability of investment. 1.2 Scope and Objectives - To build a java program interface which use the data save from txt file to calculate. All the data collected from the DataStream and other sources need to be suitable with the single-index model. - To create a java program that will produce the excess return with a button click - To have a conclusion of the significant of statistics factors and value of a security together with an ability of investment. 1.3 Achievements - A java program with an interface of the program with all steps of running the program. - All calculation functions are completed and easy to use, users can have the result in a pop-up window. - The significant of factors are shown in the analyse button. - The value of stock : undervalued or overvalued - Investors can have benefit or not based on the result of calculation stock excess return. -1- 1.4 Overview of Dissertation Chapter One: Introduction Briefly introduce some background and purpose of the dissertation. This dissertation will focus on how to calculate stock excess return using single factor model and a java application to do that. Moreover, it shows my achievements of what I did for this dissertation. Chapter Two: State-of-Art This chapter will list relative knowledge or studies about excess returns, how to calculate excess return and factor models. Firstly, introduce focus on the background and the contexts of some definitions such as risk and returns, measure of risk, diversification, excess returns, and factor models. Briefly list some factor models. Secondly, define single factor model and FamaFrench three factor model. Chapter Three: Java Program Describe how the java program was created and the design of this dissertation. This dissertation will mention what I have achieved and what I failed in the program with the careful explanations. Together with the important codes of the java, it shows the problem in the process and how to solve. Describe the advantages and disadvantages of the java program compare to other software. French three factor model. Chapter Four: Conclusion This chapter describe what I have already done and limitation of the program. There are some work must do in the future to improve the program. -2- 2 State-of-The-Art In this chapter, all the basic knowledge for stock excess return will be shown to make clearly of Java program. All the equation given in this chapter is taken from Investment Analysis text book. 2.1 Overview Both expected returns and investment risk are important to investors. There are many theories show the relationship between these two factors. 2.1.1 Holding Period Returns Holding-Period Returns (HPR) or the realized return is the simple measure of investment performance which assumes the total return on an asset or portfolio over the holding period. HPR is the result of dividend yield (the per cent return from dividends) plus the capital gains. It is the dividend paid at the end of the period. 2.1.2 Expected return and standard deviation Expected rate of return is the weighted average of a probability distribution of the rates of return in each scenario such as economics or finance. The formula to calculate expected return is Where: p(s) is the probability of each scenario r(s) is the HPR in each scenario E(r) is the expected return A widely used measurement of risk for investors is standard deviation - σ. It shows how spread out numbers is. Technically, the standard deviation is the square root of its vari- -3- ance which in turn is the expected value of the squared deviations from the expected return. Both variance and standard deviation can show the spread out of distribution. In other words, they are measures of variability. The standard deviation is an important attribute because if the mean the standard deviation of a normal distribution are known, the percentile rank associated with any given score is possible to compute. About 70 per cent of the scores in a normal distribution are within one standard deviation of the mean while within two standard deviation of the mean is about 94 per cent. The standard deviation is mathematically tractable so it has proven to be an extremely useful measure of spread and many formulas in inferential statistics based on it. The basic idea of the standard deviation is a measure of volatility. When the volatility in outcomes becomes higher, it will lead to the higher in the average value of these squared deviations. In other words, the more a stock’s returns vary from the stock’s average return, the more volatile the stock. Therefore, to calculate the uncertainty of outcomes, it is necessary to use variance and standard deviation measure. Where: σ is the standard deviation of the rate of return, so to calculate σ, apply the following formula 2.2 Diversification Linsmeier and Pearson (1997 and 2000) studies show that risks and uncertainties are important part of financial reporting and get a tight relationship. Together with the expanding of firms overseas, the growth in international presence leads to the impact of diversification on systematic risk and firm characteristics. K. Olibe, F. Michello and J. Thorne (2008) prove evidence on how systematic risk is affected by international diversification and it is relevant to managers, investors and regulators. In finance, diversification is defined as investing in a variety of assets to reduce risk. Diversification and hedging are two general techniques for reducing investment risk. In other word, diversification is a risk management technique which mixes various investments within a portfolio. A portfolio of different kinds of investments will set a lower risk and yield higher returns than any individual investment which can be found within the portfolio .Diversification still works when correlations are near zero or somewhat positive, and it relies on the lack of a tight positive relationship among the asset’s returns. It works as investment in each individual asset is reduced. And only if the securities in the portfolio are not perfectly correlated, the benefits of diversification will hold. The business cycle, inflation, interest rates and exchange rates are some conditions in the general economy of which risk comes from. However, to predict these macroeconomic -4- factors with certainty is impossible, and all these factors affect to the rate of return of a firm stock. Moreover, firm-specific influences, research and development, and personnel changes are added to these macroeconomic factors which affect the firm without noticeably affecting other firms in the economy. Risk can be decreased by diversification to arbitrary low levels when all risk is firmspecific. The reason is that with all risk resources independent, the exposure to any particular source of risk is reduced to a negligible level. The reduction of risk to very low levels in the case of independent risk sources is sometimes called the insurance principle. When the firms are affected by the common sources of risk, diversification could not reject risk. Portfolio standard deviation can be reduced if the number of securities rises however it cannot be reduced to zero. Market risk is the risk that is attributable to market-wide risk sources and remains even when extensive diversification appears. Market risk is also called systematic risk or non-diversifiable risk. In contrast, non-systematic risk or diversifiable risk is the risk that can be rejected by diversification. It is also called unique risk, firm-specific risk. . 2.3 Variance and covariance Variance, semi-variance, correlation and covariance are elements of the mean-variance framework which used to analysis modern risk, portfolio management and mechanics. Variance is defined as a measure of how far a set of numbers are spread out from each other, it describes how far the numbers lie from the expected value (the mean). In particular, it is one of several descriptors of a probability distribution and one of the moments of a distribution. If the expected value (mean) of a random variable X, then the variance of X is given by: And it can be expanding as: Var(X) = E[X2] – E[X] where variance is equal to the mean of the square minus the square of the mean or it is defined as the average of the square differences from the mean. Due to the square are positive or zero so variance is non-negative. If and only if all entries have the same value, the variance of a constant random variable is zero and the variance of a variable in a data set is zero as well. Variance is invariant with respect to changes in a location parameter. -5- To predict and hedge risk related to the magnitude of volatility of some underlying product such as interest rate, exchange rate or stock index, a variance swap is a financial derivative allows doing that. The variance swap may be hedged and hence priced using a portfolio of European call and put options with weights inversely proportional to the square of strike. Variance is a special case of the covariance when the two variables are identical so covariance is a measure of how much two variables change together. The covariance between two real-valued random variables X and Y is Cov(X,Y) = E[(X – E(X)) (Y – E(Y))] 2.4 Excess return The rate of return of an investment without risk of financial loss is called risk-free rate. It is the interest rate the investor would expect over a period of time. The different between expected HPR on the index stock fund and the risk-free rate is risk premium on common stocks which investors can earn by leaving money in risk-free assets. Risk-free assets are often referring to short-dated government bond such as Treasury bills, money market funds or the bank. For example, if the risk-free rate is 5% per year, the expected return is 12% so the risk premium on stock is the result of expected return minus risk-free rate return which is 12% - 5% equals to 7%. This risk premium is the expected value of the excess return which is the difference between the actual rate of return on a risky asset and the risk-free rate in any particular period. Then an appreciate measure of its risk is the standard deviation of the excess return. Expected future returns and future dividends growth rates relationship is expressed by the Campbell-Shiller model of which high prices should lead to high future dividends, low future returns or could be combination of these two (Campbell and Shiller’s (1988)). This model based on the stability of corporate dividend policy which cannot be always fixed however it is useful for empirical execution. Besides dividends, book-to-market is another ratio which gets relationship with stock excess returns. There is an alternative book-to-market model developed by Vuolteenaho, 2000 and Vuolteenaho, 2002 which relates the current book-tomarket ratio to expected future profitability, interest rate and stock excess returns. His model connotes that if the future cash flows are high and the stock excess returns are low, the bookto-market ratio may be temporarily low. Both models help for clear understanding of stock price in terms of cash flow fundamentals or profitability. Based on the main knowledge of these two models together with some models like Fama and French, 1988, Fama and French, -6- 1989, Fama and French, 1993, and so on, Xiaoquan Jang and Bong-Soo Lee, 2006 proposed a new model named a log-linear cointergration model that explains future profitability and stock excess returns by a linear coordination of log book-to-market ratio and log dividend yield. Their model is considered an extension of Campbell and Shiller, 1988, Vuolteenaho,2000 and Vuolteenaho,2002 models. Compare with the log dividend yield model or the log book-tomarket model in terms of cross-equation limited tests and forecasting performance, their model is better. Fabio Canova and Jane Marrinan, 1995, built a model that using representative agent cash in advance to reproduce the time series properties of nominal stock excess returns in various financial markets. Their model proved that some forecasting ideas about excess returns for a period from 1978 to 1991 could be widen however the serial correlation was not taken into account and for the joint properties of one and three months excess returns. Thomas C.Chiang and Shuh-Chyi Doong, 1999 used the data taken from Taiwan industry areas to test the relationship between stock excess returns and risk factors. Their paper tested the relation through the volatility of macroeconomic factors and time series volatility. Risk was divided into real and financial volatility. The hypothesis that the stock excess returns are independent of these two volatilities is rejected by the evidence given from industry data for excess returns and market excess return. 2.5 Factor models A disadvantage of using the Modern Portfolio Theory of Markowitz is that it needs a various number of variables. For example, 100 stocks require more than 2300 estimates of covariance or 3000 stocks require more than 4.5 million estimates. Solving this problem by using factor models is a good choice. Factor model is a way of decomposing the forces that influence the rate of return of a security into two sources a common or macro-economic factor and firm-specific events. The common factor is used to measure new information concerning the macro-economy which has zero expected value so it has zero expected value as the result. It affects a large number of different investments because of its proxies for events in the economy. There are three ways to estimate factors, they are: factor analysis, macro-economic variables and firm characteristics. And each way has its own advantages and disadvantages. Moreover, the covariance (the correlations) of factor models can predict future correlations than those calculated from historical data. -7- Roll and Ross (1980) tested 42 groups of 30 securities using pure factor analysis and conclude that at least 3 factors are important. However, pure factor analysis is hardly to use due to factors cannot be named. Chen, Roll and Ross (1986) chose some factors and based on them to build a picture of the macro-economy. There might be some factors such as IP (% change in industrial production), EI (% change in expected inflation), UI (% change in unanticipated inflation), CG (excess return of long term corporate bonds over long term government bonds) and GB (excess return of long term government bonds over T-bills) have significant effect. Size, P/E (Price/earnings) ratio, B/M (book to market) ratio and momentum are some characteristics of the firm which are possible to look through. The most important of firm characteristics way to estimate factors is the Fama-French Three-factor model. 2.5.1 Single-factor model and Single-index model Single factor model assumes that the actual return deviates from expectation due to macro event and firm specific event. Formally, the single-factor model is described by the equation below: ri=E(ri) + βim + ei Where: E(ri) is the expected return on stock i. If the value of the macro factor is zero in any particular period, the return on the security will be the result of its previously expected value E(ri) and the effect of firm-specific events only. βi= index of a securities’ particular return to the factor m = some macro-economic factor; m is commonly related to security returns ei= firm-specific surprises or the non-systematic components of returns; the mean of ei is zero. Holding systematic risk to a single factor model is not compelling due to the systematic or macro factor summarized by the market return arises from a number of sources such as interest rate, uncertainty about business cycle, inflation, and so on. The market return reflects both macro factors and the average sensitivity of firms to those factors. When a broad market index replaces macro events and is taken as the factor, single index model states the holding period excess return for a stock. In other word, the index model assumes that a broad index of stock returns represents macro factor and it reduces the neces- -8- sary inputs in the Markowitz portfolio selection procedure. Moreover in security analysis, the index model helps to specialize of labour. The equation shows that each security has two types of risk. They are systematic risk (βiRM) and firm specific risk (ei). It is: Ri = αi + βiRM + ei Where Ri = ri – rf is the excess return of a security. RM= rM – rf is the excess return of market index. α (alpha) is the security’s expected excess return when the market excess return is zero. βi (beta) is the slope coefficient, the sensitivity of the security to the index or also the security’s responsiveness to market movements. ei is the zero mean or also called the residual is the firm specific surprise in the security return or the unexpected component of return due to unexpected events that are relevant only to this security. Both alpha and beta have an important role in Modern portfolio theory. Because E(ei) = 0 so the relationship between expected return and beta of single-index model is shown as followed: E(Ri) = αi + βiE(RM) The market risk premium which is multiplied by the relative beta of the individual security is called systematic risk premium due to it derives from the risk premium. Alpha is a nonmarket premium which is the remainder of the risk premium. If a security is under-priced and offers an attractive expected return, alpha may be large. When security prices are in equilibrium, alpha will be driven to zero because attractive opportunities might be competed away. It is possible to find stocks with non-zero values of alpha if there is a superior job of security analysis. The operation of macroeconomic and security analysis is totally elucidated by the index model separation of risk premium of an individual security and nonmarket components. The overall risk of each security in the single-index model is divided into systematic and firm specific components, and yields the covariance between any pair of securities. The security beta and the properties of the market index determine both variances and covariance. Total risk σi² = = Systematic risk + Firm- specific risk βi²σ²M + -9- σ²(ei) Covariance = Cov(ri,rf) = Correlation = Corr(ri,rf) = βi βj σ²M = βi σ2M βj σ²M / = Product of betas × Market index risk βiβj σ²M Product of correlations with the market index / σi σj σi σM σj σM Corr(ri,rM) x Corr(rj,rM) It is clearly that the set of estimates needed for the single-index model are α , β , σ(e) , risk premium and variance of the market index. It is easy to realize that the single index model is such a useful abstraction. There are only a small number of estimates required for the index model for the large number of securities. Moreover, it is important for specialists to analyse security. However, it is difficult for security analysts to specialize by industry if they calculate a covariance term directly for each security pair. If the single-index model is perfectly accurate, it will ignore the correlation between two stocks which are correlated while it can be automatically take the residual correlation into account by minimizing portfolio variance by Markowitz algorithm. Moreover the potential diversification value of these securities will be ignored when correlation among them is negative. The index model and diversification relationship is shown by diversifiable risk and systematic risk. Market wide movements and the sensitivity coefficients of the individual securities are the two factors which influence the systematic risk component of the portfolio variance. This part of risk will exist through all the extent of portfolio diversification and mainly depends on σ and β. Portfolio systematic risk will reflect common exposure without basing on how many stocks are held. In contrast, σ which is the non-systematic component of the portfolio variance depends on ei which is defined as firm-specific independent components with zero expected value. When portfolio is added by more stocks, ei seems to be out leads to the smaller in non-market risk. Such this risk is called diversifiable. Diversification’s power is limited so this systematic risk is said to be non-diversifiable. Due to the diversification of ei , the portfolio variance will decrease if a portfolio is created by more and more securities. Input for the single-index model includes risk premium on the market portfolio, estimation of the standard deviation of the market portfolio and number of estimations for beta coefficients, stock residuals and alpha values. By applying regression analysis to excess rate of - 10 - returns the output of index model is estimated. The slope of the regression will be the beta of the asset while the intercept is the alpha. Here is an example of excel output: SUMMARY OUTPUT Regression Statistics Multiple R 0.885388 R Square Adjusted RSquare 0.783911 Standard Error 0.011178 0.775908 Observations 29 ANOVA df Regression SS MS F 97.94871 1 0.012238 0.012238 Residual 27 0.003374 0.000125 Total 28 0.015612 Coefficients Standard Error Significance F 1.77E-10 t Stat P-value Lower 95% Upper 95% Lower 95.0% Upper 95.0% Intercept 0.005389 0.002128 2.532669 0.017442 0.001023 0.009754 0.001023 0.00974 S&P500 0.848851 0.085769 9.896904 1.77E-10 0.672867 1.024835 0.672867 1.02483 Figure 1. Excel output: Regression statistic 2.5.1.1 The estimate of Alpha α In the excel output above, the intercept which is 0.005389 or 0.53% per month is the estimate of alpha (in this example is the Apple’s alpha) for the sample period. To estimate alpha is statistically significant or not mainly based on the three statistics. They are standard error, t-Statistic and p-value. The standard error is an imprecise measurement of estimate alpha; in this case it gets a value of 0.002128. If the standard error value is large, the estimation error is large as the result. The t-Statistic is used to access the unobserved value which might be estimated directly equal to zero rather than estimated from the data. Thus the t-Statistic is the ratio which shows the regression of the standard error. When the t-Statistic is large, the probabilities that true value is zero will be low. The p-value is the probability of obtaining an estimate; in this case the p-value for the alpha estimate is 0.017442l. If the p-value is less than the significant level (0.05), the null hypothesis is rejected so the result is statistic significant. Alpha is more than just one of the components of expected return because it is a key to show whether a security is good or bad. However, alpha is not the factor that forecast the per- 11 - formance of the firms in the future. The estimate of alpha is only used for ensure the economically and statistically significant. To ensure these significant, p-value needs to be less than 0.05 and the estimate of alpha should be different from zero (α # 0). When α is less than 0 and p-value less than 0.05, stocks are overvalued and vice versa stocks are undervalued. The meaning of undervalued and overvalued is that the price investors pay for the stocks compared to risk-free market. When stocks are undervalued compared to the price in the risk-free market, investors will earn profit. 2.5.1.2 The estimate of Beta β To estimate the risk premium and risk of the market index, macroeconomic analysis is used while beta coefficients of all securities and residual variances are estimated by statistical analysis. The beta estimate for Apple in the example below is 0.848851 and the standard error is approximate 0.08. The estimate of beta coefficient in this case shows the relationship between stock returns and market returns. Based on t-statistics or p-value, when p-value is less than 0.05 or t-statistics is more than 1.96, both alpha and beta have statistics significant. When beta is less than 1, stocks are defensive and when beta is more than 1, stocks are aggressive. 2.5.2 The Fama-French (FF) Three-factor Model The Fama and French Three-factor model is very popular in practice to estimate factors and it is very good at explaining stock returns: rit = αi + βiMRMt + βiSMBSMBt + βiHMLHMLt + eit In that equation, factor SMB has a meaning of Small minus Big and shows the excess return of small stocks’ portfolio to large stocks’ portfolio. Factor HML has a meaning of High minus Low and shows the excess return of high book-to-market ratio stocks’ portfolio to the low one. The market index in that model does not play any role except for it is expected to capture systematic risk from macro-economic factors. Firm size and book-to-market ratio and the market index are the systematic factors in Fama and French model. Fama and French pointed out that the more likely to suffering financial situation of high ratios of book-to-market value; the more sensitive the small stocks may be to changes in business condition of the firm. Because the Fama and French model based on an analysis of historical returns so it may be not relevant in the future. However, Fama and French has shown that size, book to - 12 - market and beta explain average returns in various time periods on securities in all the world markets. Davis, Fama and French tested the three-factor model by forming nine portfolios with the same sensitivities to each factor. Firms are divided into three size groups of which are small(S), medium(M) and big(B) while book-to-market ratios are sorted into three groups high(H), medium(M) and large(L). Combine them to get the nine portfolios S/H, M/H, B/H, S/M, M/M, B/M, S/L, M/L, B/L. For example, B/H portfolio is comprised stocks in the biggest third of firms and the highest third of book-to-market ratio. To conclude the use of Fama-French three-factor model, it is clear that the returns on securities are explained by beta, firm sizes and book-to market ratios, small firms get higher returns while high book-to-market firms have higher returns. The advantage of three-factor model is very important by explaining stock returns. However, as it mentioned above, the Fama and French three-factor model based on the analysis of historical returns so it becomes the disadvantages because these historical returns may not relevant to the future. 2.5 Computing tools Excel is a very popular tool for investment analysis due to all the function inside its software. In this case, Excel can be used for calculating stock excess return using single-index model. However, Excel tools include many complicated steps and its output of is not easy to understand. If users do not use the regression function of Excel to analyse the excess return, they need to know exactly what the formulas are and then do it manually. The result will not clearly and it is hard for others users for checking. Users will find it difficult to open the file again and check the result due to the mixed number appeared. The output can be like the figure 2 below - 13 - Figure 2. Example of manually calculate by Excel If regression function of Excel is used, it saves time for users and the output looks better than doing manually. Figure 3. Example of regression analysis function of Excel However, users must know what the output shows to understand the regression. In the figure 3 above, users need to understand the meaning of each output; for example : coefficients, standard error, t-statistic and so on. Moreover, users need to clearly ensure what number should be taken, from Intercept or from X Variable 1. - 14 - With these complicate steps and formula need to be remembered in Excel, Java program which directly calculate and show the result of the formula will be a better choice. Users can easily click a button then see the result. Figure 4. Example of a Java program It is quite simple for users to use a Java program than use Excel, after a click, the result has shown. And they can check the result anytime. There should be other software or computing tools to do this, but in the restriction of knowledge, Excel and Java are the only two applications shown in this dissertation 2.6 Summary This chapter briefly discuss the relationship between risk and returns in financial theory and how excess return is calculated using factor models such as single-factor model, singleindex model or Fama-French three-factor model. Excel and Java are the two tools that users use to calculate stock excess return. Even using single-index model or Fama-French three-factor model, these two tools will help user save much time and work. - 15 - In this dissertation, there is a Java program to calculate stock excess return using single-index model based on data collected from Apple plc. This program will help investors have an easy decision for choosing stocks to invest in. - 16 - 3 Java Program The purpose of this chapter is described how I created a Java program for users. There is a .txt file data which converted from the excel file. The data in that file include the date, price of security (price of Apple plc securities), price of market (price of S&P500 market), return of security, return of market and risk-free rate. The program is built for the single-index model only. This chapter will show all the steps and java structure of the program 3.1 Introduction for Users At first, I will clearly show each steps of the program that users need to follow to run the program and how the result will be shown. - Step 1: Run the program by double-clicking the main class “Calculation” then the interface will pop-up Figure 5. The Main Interface of the program - Step 2: Click the button “Load File” to choose the data file which is used to evaluate. In this program, file Data.txt will be used. - 17 - Figure 6. Select file to open. If the chosen file is correct, the program will show a message in green that it is successfully loading. Figure 7. Data file is successfully loading There will be a warning message if the file chosen is not the format one - 18 - Figure 8. Warning Message when open wrong file - Step 3: Press the first Calculate button to calculate the excess return of the market index. The result will be shown in a pop-up table Figure 9. Excess return of market index - 19 - - Step 4: Press the second Calculation button to calculate the excess return of the security. The result will be shown in a new pop-up table Figure 10. - Excess return of a security Step 5: Press the third Calculation button to calculate Beta (the slope coefficient). The result will be shown in the a pop-up window Figure 11. Result of Beta (the slope coefficient) - 20 - - Step 6: Press the forth Calculation button to calculate Alpha (expected excess return of a security). The result will be shown in a new pop-up window. Figure 12. - Result of Alpha (the expected excess return of a security) Step 7: Press the last Calculation button to calculate E (the firm specific risk). The result will be shown in a new pop-up window. Figure 13. Result of e (the firm specific risk) - 21 - - Step 8: This is the last step of the program. Press the Analyse button to see the result of analysis of the excess return of a security. The result will be shown in a new pop-up window. Figure 14. Result of Analysis Program structure 3.2 There are five java files in my program. They are Calculation.java, Formula.java, Record.java, StockData.java and Result.java - Calculation.java is the main class where the code for appearance of the interface and button controlling are. - The structure of the program is as below: - 22 - Figure 15. - Structure of the program Formula.java includes all the function and all the financial statistic formula which are used throughout the program. 3.3 - StockData.java is used to convert data from imported file into objects. - Record.java is entity object which record each line of the data. - Result.java is the interface of showing result. Problem and Solution The program is built using the formula of single-index model: Ri = αi + βiRM + ei . In the data.txt, the data for return of security, the return of market and risk-free rate will be used to calculate the stock excess return and market excess return for each date by the formula below : Ri = ri –rf and Rm = rm - rf After these two calculation, α , β and e need to estimate using regression formula. The regression will use 30 data variables given. Before creating a Java program, I collected the raw data from DataStream, Yahoo! Finance and some stock website and convert these data to Excel file. I use Excel to calculate a simple formula to get the result of stock return, market return. And then copy that file to txt file. I test the data with the regression analysis function of Excel to find out the result. The Java program has more things to deal with. 1. The file data save in file txt doesn’t include the first line of Excel because there is no need to put one more code to remove that in calculation. However, the first line in the data file get some special character which means it gets no value, so in StockData.java, I need to have a code to block the first line . That code is: /* Using this try-catch block to escape the first data line in file */ dataLine = br.readLine(); - 23 - /* Begin Reading the second data line instead of first line */ while((dataLine = br.readLine()) != null){ st = new StringTokenizer(dataLine,"\t"); The program will start with the second line instead of the first line. A record sub-class is created to record all the data calculated. To calculate alpha, beta and e, I need to use the regression formula. These formula are taken from Introduction to Econometrics text book. And all these formula is inside the Formula.java which will be called to calculate. Because of the complicate formula I spent much time in checking the code then compare with the result from the Excel file. There is a hide code to calculate t-statistic which is not shown in the interface, but it is useful for analysis button. public static double calculateTStatistic2(ArrayList<Double> listRM, ArrayList<Double> listRS) { double se2 = calculateStandardError2(listRM, listRS); double beta = calculateBeta(listRM, listRS); double result = beta/se2; return result; } public static double calculateTStatistic1(ArrayList<Double> listRM, ArrayList<Double> listRS) { double alpha = calculateAlpha(listRM, listRS); double se1 = calculateStandardError1(listRM, listRS); double result = alpha/se1; return result; In the formula, the number of variable n needs to be counted then put in the code, however, I put directly the number I counted without the program . For example. : - 24 - double var1 = sumsqOfE/27*sumsqOfMarketReturn/(29*sumsqOfDifferenceWithMean); double se1 = Math.sqrt(var1); 27 should be (n-2) and 29 is n , but I find it difficult to do that, so i just put the number directly. All the buttons still work even the file data can be loaded or not, but it shown the blank table Figure 16. Example of blank table I should make the output pop-up nicer and bigger - 25 - Figure 17. Program output Java program in the project 3.4 In practice, Excel is other tool that can be used to calculate these factors. Compared to Excel, Java program get some advantages and disadvantages. 3.4.1 - Advantages It is simple; users press the button and get the results for the calculation. In Excel it needs to be step by step and needs to obey Excel rules. - The results are described nicely and friendly to users. - Java program can record the data inside the program which is not necessary to show in the output. - In Excel users must install the analysis tools to do regression then have a look at the output to evaluate. In this program, users only need to press the button then the result will pop-up. 3.4.2 - Disadvantages The file using in Java program needs to be a txt file, so users need to save data in correct file. - 26 - - Users need to know how to open Java application which is not as popular as Excel one. - If there is more than one factor influence the price of the security which in practice are always happened, the program will be not suit. - There are some mistakes of the program which will be discussed carefully in the limitation and future work. 3.5 Summary With a friendly interface to users, a Java program is a good choice to calculate and evaluate the effective of investment without doing complicated steps in other software. It also makes investors have good opinions about considering project. - 27 - 4 Conclusion Summary 4.1 Due to the time restriction and the limited in knowledge, my dissertation is not perfect enough and there is a lot of work need to improve in the future. However, this program still has some good advantages. The data taken is reliable and accurate will lead to the best result for investors. Feedback 4.2 With the cooperation of some classmates and friends, after testing the program and answer the questionnaire, there are some conclusions: - The interface is friendly to user, easy to use and clearly understanding button. The warning message and the colour of the file loaded are nice. However only one file data to choose is quite simple. - It is really quick to get the result without remembering any formula, save the time and easy to do. The result from the Java program is correct compared to the Excel one or manually calculating. - The output clearly shows the result and can check the previous step easily however the window for alpha, beta and e is small. - The analysis sentence is easy to understand and clearly. - However, there is limited in file data so the effective of the program is not clear enough. They wonder if some data are not perfect. Future Work 4.3 4.3.1 - Limitation The data collections are taken from multiple websites such as Yahoo! Finance or London exchange and so on together with the DataStream of University of Stirling. It is difficult to collect data from only one source. - There is no chart built in the program so users are hard to imagine the excess returns. - After converting raw data, users still have some self-calculation steps before using this program. - 28 - - In the first step when open the file data to be loaded, if users choose wrong file, there is a warning message appeared. However, if they fail to attempt the correct file for many times, the program needs to be restarted to do next steps. - The format file for the data is restriction due to the .txt format. So there is an extra step to convert raw data into data in .txt file. - There is only one file saved to test the program. - The output window is not shown nicely and makes users feel mixed. 4.3.2 - Future Work In the example for this java program, there is only one data file was collected and save to test the program. It will not be enough in practice. So the first work in the future to improve the program is collecting more data and tests it. If all the calculation steps necessary for the program can be put together, users only need to collect raw data and save into .txt file then the program can do everything. - The problem when users press the button “Open file” needs to be fixed. When users choose file TextMe.txt, the file is loading successfully but the result is meaningless. The program needs to check that in file txt including data or not. If users choose wrong file format, a warning message appeared. However if they choose wrong file at least 3 times, then choose the correct file, the program cannot run. It needs to be restarted and run. - When no file is loaded or wrong file, all the other buttons should be disable, users cannot click or press any button. - At first the interface will have an analysis button for showing chart but due to the time restriction, I haven’t done it so I should be done soon to complete the program. The graph will make users clearly understand the meaning of calculating. - The program is calculating stock excess returns using only single-index models whereas there is more factors models influence to excess returns in practice. So the program based on more factor models need to built soon. - 29 - References [1] Jang, X. and Lee, B. (2007), “Stock returns, dividend yield, and book-to-market ratio”, Journal of Banking and Finance volume 31, issue 2, pages 455-475 [2] John, Y. C. and Robert, J. S. (1988), “The dividend-price ratio and expectations of future dividends and discount factors”, Review of Financial Studies 1, pp.195-228 [3] Vuolteenaho, V. (2000), “Understanding the aggregate book-to-market ratio and its implications to current equity-premium expectations”. Working paper, Harvard University. [4] Vuolteenaho, V. (2002), “What drives firm-level stock returns”, Journal of Finance 57, pp. 233–264. [5] Canova, F. and Marrinan, J. (1995), “Predicting excess returns in financial markets”, European Economic Review, volume 39, issue 1, pp. 35-69 [6] Thomas C. C. and Shuh C. D. (1999), “Empirical analysis of real and financial volatilities on stock excess returns: evidence from Taiwan industrial data”, Global Finance Journal, Volume 10, Issue 2, pp. 187-200 [7] Chen, N., Roll, R. and Ross, S. (1986), “Economic Forces and the Stock Market,” Journal of Business 59, pp. 383-403 [8] Eugene F. F. and Kenneth R. F. (1996), “Multifactor Explanations of Asset Pricing Anomalies,” The Journal of Finance 51, pp. 55-84 [9] Kingsley O. O., Franklin A. M. and Thorne, J. (2008), “Systematic risk and international diversification: An empirical perspective”, International Review of Financial Analysis, Volume 17, Issue 4, pp. 681-698. [10] Linsmeier, T. and Pearson, N. (1997), “Quantitative disclosures of market risk in the SEC release”, Accounting Horizons 11, pp. 107-135 [11] Linsmeier, T. and Pearson, N. (2000), “Value at risk”, Financial Analysts Journal 56, pp. 47-67. [12] Bodie, Z., Kane, A., Marcus, A., J. (2009), Investment analysis, Eighth Edition [13] Bell, D., Parr, M., Java for Students (5th Edition) [14] James, S., Mark, W., (2007), Introduction to Econometrics, Second Edition [15] http://www.bloomberg.com [16] http://www.cs.stir.ac.uk - 30 - Appendix 1 – The variable’s data for Apple from 8th July 2011 to 18th August 2011 Apple price Date pi S&P price Stock return mi Market return ri rm Risk free rate rf 08/07/2011 359.71 1343.8 - - 0.00011 11/07/2011 354 1319.49 -0.01587 -0.01809 0.00011 12/07/2011 353.75 1313.64 -0.00071 -0.00443 0.00011 13/07/2011 358.02 1317.72 0.012071 0.003106 0.00011 14/07/2011 357.77 1308.87 -0.0007 -0.00672 0.00011 15/07/2011 364.92 1316.14 0.019985 0.005554 0.00011 18/07/2011 373.8 1305.44 0.024334 -0.00813 0.00011 19/07/2011 376.85 1326.73 0.008159 0.016309 0.00011 20/07/2011 386.9 1325.84 0.026668 -0.00067 0.00011 21/07/2011 387.29 1343.8 0.001008 0.013546 0.00011 22/07/2011 393.3 1345.02 0.015518 0.000908 0.00011 25/07/2011 398.5 1337.43 0.013221 -0.00564 0.00011 26/07/2011 403.41 1331.94 0.012321 -0.0041 0.00011 27/07/2011 392.59 1304.89 -0.02682 -0.02031 0.00011 28/07/2011 391.82 1300.67 -0.00196 -0.00323 0.00011 29/07/2011 390.48 1292.28 -0.00342 -0.00645 0.00011 01/08/2011 396.75 1286.94 0.016057 -0.00413 0.00011 02/08/2011 388.91 1254.05 -0.01976 -0.02556 0.00011 03/08/2011 392.57 1260.34 0.009411 0.005016 0.00011 04/08/2011 377.37 1200.07 -0.03872 -0.04782 0.00011 05/08/2011 373.62 1199.38 -0.00994 -0.00057 0.00011 - 31 - 08/08/2011 353.21 1119.46 -0.05463 -0.06663 0.00011 09/08/2011 374.01 1172.53 0.058888 0.047407 0.00011 10/08/2011 363.69 1120.76 -0.02759 -0.04415 0.00011 11/08/2011 373.7 1172.64 0.027523 0.04629 0.00011 12/08/2011 376.99 1178.81 0.008804 0.005262 0.00011 15/08/2011 383.41 1204.49 0.01703 0.021785 0.00011 16/08/2011 380.48 1192.76 -0.00764 -0.00974 0.00011 17/08/2011 380.44 1193.89 -0.00011 0.000947 0.00011 18/08/2011 366.05 1140.65 -0.03782 -0.04459 0.00011 - 32 - Appendix 2 – Stock excess return of Apple plc and Market excess return S&P500 from 8th July 2011 to 18th August 2011 Date R(Apple) R S&P500 08/07/2011 - - 11/07/2011 -0.01599 -0.01820 12/07/2011 -0.00082 -0.00454 13/07/2011 0.01196 0.00299 14/07/2011 -0.00081 -0.00683 15/07/2011 0.01987 0.00544 18/07/2011 0.02422 -0.00824 19/07/2011 0.00805 0.01620 20/07/2011 0.02656 -0.00078 21/07/2011 0.00090 0.01344 22/07/2011 0.01541 0.00080 25/07/2011 0.01311 -0.00575 26/07/2011 0.01221 -0.00422 27/07/2011 -0.02693 -0.02042 28/07/2011 -0.00207 -0.00335 29/07/2011 -0.00353 -0.00656 01/08/2011 0.01595 -0.00424 02/08/2011 -0.01987 -0.02567 03/08/2011 0.00930 0.00490 04/08/2011 -0.03883 -0.04793 05/08/2011 -0.01005 -0.00069 08/08/2011 -0.05474 -0.06675 - 33 - 09/08/2011 0.05878 0.04730 10/08/2011 -0.02770 -0.04426 11/08/2011 0.02741 0.04618 12/08/2011 0.00869 0.00515 15/08/2011 0.01692 0.02167 16/08/2011 -0.00775 -0.00985 17/08/2011 -0.00022 0.00084 18/08/2011 -0.03794 -0.04470 - 34 - Appendix 3 – Questionnaire This is a java program to calculate stock excess returns based on single-index model. Please follow all the steps of the interface to test my program and answer this questionnaire. 1. Is the interface of the program friendly to you? 2. Is the output of the program easy to understand? 3. Are the results of the Java correct compared to the Excel one? 4. Is the program helpful for you to calculate using single-index model? 5. Is the program easy to use? 6. Is the program convenient? 7. Do you have any advice? Thanks for your help. Hope you all the best in life. Your co-operation helps me a lot in my work. - 35 - Appendix 4 – Users’ guide - Step 1 : Users open BlueJ or Eclipse or else which are used to run a java application, then choose to run file Calculation.java - Step 2: Compile the program and run it. The interface of the program will be pop-up Figure 18. - The main interface of the program Step 3: Click the button “Load File” to choose the data file which is used to evaluate. In this program, file Data.txt will be used. - 36 - Figure 19. Select file to open. If the chosen file is correct, the program will show a message in green that it is successfully loading. Figure 20. Data file is successfully loading There will be a warning message if the file chosen is not the format one - 37 - Figure 21. Warning Message when open wrong file When no file is loaded or wrong file format, there will be a red message Figure 22. Fail to load file warning - 38 - - Step 4: Press the first Calculate button to calculate the excess return of the market index. The result will be shown in a pop-up table Figure 23. - Excess return of market index Step 5: Press the second Calculation button to calculate the excess return of the security. The result will be shown in a new pop-up table - 39 - Figure 24. - Excess return of a security Step 6: Press the third Calculation button to calculate Beta (the slope coefficient). The result will be shown in the a pop-up window Figure 25. - Result of Beta (the slope coefficient) Step 7: Press the forth Calculation button to calculate Alpha (expected excess return of a security). The result will be shown in a new pop-up window. Figure 26. Result of Alpha (the expected excess return of a security) - 40 - - Step 8: Press the last Calculation button to calculate E (the firm specific risk). The result will be shown in a new pop-up window. Figure 27. - Result of e (the firm specific risk) Step 9: This is the last step of the program. Press the Analyse button to see the result of analysis of the excess return of a security. The result will be shown in a new pop-up window. Figure 28. Result of Analysis - 41 -