1. Homepage
  2. Programming
  3. BENG0091: Stochastic Calculus and Uncertainty Analysis - Coursework 1: Efficient frontier theory

BENG0091: Stochastic Calculus and Uncertainty Analysis - Coursework 1: Efficient frontier theory

Contact Us On WeChat
UKUCLUniversity College LondonBENG0091Stochastic Calculus and Uncertainty AnalysisMatlabPythonEfficient frontier theory

BENG0091 Coursework 1

To be submitted on Moodle by 24th Mar 2023. Please read the following guidelines before starting the work. CourseNana.COM


  • You need to provide all MATLAB, Python or equivalent code that you have developed as part of your submission to Turnitin. This is compulsory. Include clarifications/comments in your code whenever you feel appropriate. CourseNana.COM

  • You need to submit one version of the code that is executable. Unless the code is executable locally reaching the same results as those in your report, it will not receive full marks. o One option is to have the code in the submitted document in a state where we can copy it off your submission and execute. A few tips to assist you in the process: Please note that line numbers left in the code often creates an issue with executability. Python codes embedded in LaTeX can also create problems with executability. Please ensure that prior to submission, you can copy the code back from the document you plan to submit and execute it, just to double check. CourseNana.COM

o If you do not want to worry about the Turnitin version being executable or not, you can additionally choose to use Datalore as suggested. A detailed video on how to use it is available in Moodle. Please note that submitting via Datalore is optional. CourseNana.COM

  • Your submission (excluding the space taken up by your code) should be no more than 15 pages and contain no more than 15 Figures. Clarity is expected in the Text, in your Figures, and in your codes. A single figure/image cannot comprise of 10 illegible plots, please use your reasoning when preparing your report. CourseNana.COM

  • Please make sure that you address the answer for each section or question at its respective slot, e.g., a correct answer to section (a) provided as response to section (b) will not be considered for marking. CourseNana.COM

  • You need to develop your own code. You are not allowed to use pre-existing toolboxes to conduct stochastic simulations, for example. However, the use of standard Python packages such as pandas or NumPy are acceptable. Regarding random number generators (r.n.g.), you are only allowed to use a/the uniform r.n.g. available in the programming language you chose (MATLAB, Python etc.). Uniqueness of your scripts will be assessed and will contribute to your mark. CourseNana.COM

  • To achieve full marks in each question, your methodology needs to be correctly implemented and your code needs to be original (i.e., your own work). CourseNana.COM

  • You will be allowed to submit your work multiple times until the deadline. The Turnitin submission will be made available weeks before the deadline. Please note that it is your responsibility to ensure that the submission is made on time. Late submissions, SORAs and ECs will be handled by the Admin Team, not your tutors. CourseNana.COM

Problem Statement

Trading in the stock market is subject to significant and unavoidable risk. Hence, the key question that arises is how a risk-averse investor can construct a portfolio that yields the desired returns at the lowest possible risk. Efficient frontier theory, pioneered by Nobel Laureate Harry Markowitz, provides an answer to this question, and allows us to identify investment portfolios that strike the best balance between risk and return. While this theory makes certain assumptions that are probably oversimplifications (notably, assuming that past performance is an indicator of future trends and that asset returns are normally distributed), the theory is extremely important in understanding the effect of diversification in investing and has been extended in attempts to better capture the real market behaviour (e.g., post-modern portfolio theory, Black–Litterman model, etc.). In this coursework, we will explore the main concepts of modern portfolio theory and we will try to come up with efficient portfolios of stocks of three fictitious companies: CourseNana.COM

Elysium Investment Forecasting(abbreviated as EIF) CourseNana.COM

Centurion Energy Solutions(abbreviated as CES) CourseNana.COM

Quantum Nanomaterials Technologies(abbreviated as QNT) CourseNana.COM

Data analysis of the stock prices of these companies in the past 10 years has shown that the daily closing prices of EIF adhere to the following stochastic process: CourseNana.COM

S0EIF = 7.78 CourseNana.COM

SnEIF = (1 + X n ) SnEIF−1 n = 1,2, ..., nmax CourseNana.COM

where X n , n = 1,2,... are i.i.d. that follow the Laplace distribution, X n Laplace ( μ, b ) , n denotes the day, and nmax the maximum number of days we want to predict the stock price for. The Laplace distribution is continuous with two parameters, b and , and has the following probability density: pX ( x ) =x −μ 1exp −2bb CourseNana.COM

From the data analysis we know that X n Laplace ( 0.00031, 0.0097 ) The prices of the stocks of CES and QNT can be expressed as follows: CourseNana.COM

S0CES = 31.03 CourseNana.COM

SnCES = (1 + 0.3 X n + 0.8Yn ) SnCES−1n = 1,2,... CourseNana.COM

S0QNT = 25.09 CourseNana.COM

SnQNT = (1 + 0.2Yn + 0.9 Z n ) SnQNT−1n = 1,2,... CourseNana.COM

where Yn Laplace ( 0.00048,0.0108 ) i.i.d. and Z n Laplace ( 0.00012,0.0077 ) i.i.d. for n = 1,2,3,… Note also that the sequencies of X n , Yn and Z n are independent with respect to each other, e.g. CourseNana.COM

X 1 is independent of all Yn and Zn , n = 1,2,... , etc. CourseNana.COM

Things to do

  1. We will first do some preliminary work that will enable us to simulate stochastic realisations of the prices of the stocks of interest.

(a) Derive an explicit mathematical formula for the cumulative distribution function of the Laplace distribution. CourseNana.COM

(b) Describe a simple approach for the generation of random deviates from the Laplace distribution. CourseNana.COM

(c) Write a program that generates 100000 samples from the Laplace distribution with = 1.5 and b = 0.8 (use the approach you developed in the previous question; do not use built-in functions for this). To verify that your method works correctly, show a histogram of these samples and a line-graph of the probability density function (both in the same plot). [6] CourseNana.COM

  1. We are now able to perform the stochastic simulations of the prices of the three stocks of interest. We will assume that each year contains 260 days of trading (roughly 52 weeks of 5 working days each), and we will simulate stock prices for a 5-year window, i.e. nmax = 1300 days.

(a) Write a program that simulates the stock price sequencies SnEIF , SnCES , SnQNT , n = 0,1,2,..., nmax . To do this, first generate three random streams, one for X n , n = 1,2,..., nmax , one for Yn and similarly, one for Z n , using the method you developed in Question 1. Thus, you are allowed to use only a uniform random number generator available for the programming language of your choice (MATLAB, Python etc.), initialised with a seed value of your choice. Subsequently, use these sequences in the application of the equations that give the stock CES price per day, e.g. for CES, you will evaluate the expression SnCES = (1 + 0.3 X n + 0.8Yn ) Sn− recursively. Present graphs of the stock prices per day in the same plot. CourseNana.COM

(b) Repeat the procedures of Question 2(a) with two more different random seeds and produce plots of the stock prices ped day. You will present two separate plots, one for each random seed. Each of these plots will contain three line-graphs, one for each stock (EIF, CES, and QNT). Comment on the observed behaviour in the three “scenarios” that you simulated and plotted in Questions 2(a) and 2(b). For instance, how does the magnitude of the fluctuations (volatility) compare with the overall “average” behaviour of a stock (drift) in the three different scenarios? Which stock(s) would you pick for your portfolio if you were an investor? [10] CourseNana.COM

  1. We will continue with the calculation of certain quantities that will allow us to apply the efficient frontier approach to the data we generated for the prices of the three stocks over time. (a) Pick one of the three scenarios you simulated (whichever you want), and for each of the stock price sequencies, calculate the daily returns as follows:

where ABC will be each one of the stocks in discussion (EIF, CES, QNT). Present, in three separate plots, one for each stock, histograms of the daily returns you calculated. Discuss the appearance of these histograms with reference to the plots of the stock price movements you plotted earlier. CourseNana.COM

(b) Calculate and report the following quantities to 3 significant figures: Report one number for each stock, ABC = EIF, CES, QNT. Annualised (co)variances of the daily returns. The following formula is used to calculate variances when ABC = DEF, but also covariances when ABC ≠ DEF (where ABC and DEF can be any of the stock symbols: EIF, CES, QNT): CourseNana.COM

Thus, report 6 numbers in total: 3 variances, one for each stock, and 3 covariances, one for each pair: EIF-CES, EIF-QNT, CES-QNT. [9] CourseNana.COM

  1. We now have the data necessary to apply efficient frontier theory. To this end, we will consider an ensemble (collection) of portfolios, all of which invest in the three stocks under consideration. However, each portfolio will have different weighting factors per stock, e.g. in one portfolio the allocation may be 40% EIF, 20% CES and 40% QNT; for another portfolio the allocation may be 30% EIF, 35% CES and 35% QNT. Note that the weighting factors will have to sum up to 1 (i.e. 100%). (a) For the scenario you picked in Question 3(a), create an ensemble of 2000 portfolios, each with different allocation. Thus, for each portfolio you will generate 3 weights that sum up to 1 and represent the relative numbers of shares bought for each of the 3 assets (EIF, CES, QNT). Then calculate the expected (annualised) return and variance of each portfolio according to the following formulas:

where wABC is the weight of the stock of ABC. Present a scatter plot of the return in the yaxis with respect to the standard deviation, i.e. Variance½ in the x-axis. Find the portfolio with the minimum variance, highlight it on your plot (e.g. with a marker with different shape or colour) and report its allocation (i.e. the weights). [15] (b) Discuss the results you have obtained. Compare the weights of the minimum-variance portfolio, with the weights of “riskier” portfolios that may have better or worse returns than the minimum-variance one. How does the above plot guide you in choosing an allocation for your portfolio? [12] CourseNana.COM

  1. Finally, present your Matlab Python (or other) codes as Appendixes to your report or preferably upload them to Datalore. If presenting your codes in an Appendix make sure these are copypasted as text, not as figures, and that they don’t contain the code’s line numbers (see the guidelines in the first page for more detailed instructions).

Get Expert Help On This Assignment

Scan above qrcode with Wechat

UK代写,UCL代写,University College London代写,BENG0091代写,Stochastic Calculus and Uncertainty Analysis代写,Matlab代写,Python代写,Efficient frontier theory代写,UK代编,UCL代编,University College London代编,BENG0091代编,Stochastic Calculus and Uncertainty Analysis代编,Matlab代编,Python代编,Efficient frontier theory代编,UK代考,UCL代考,University College London代考,BENG0091代考,Stochastic Calculus and Uncertainty Analysis代考,Matlab代考,Python代考,Efficient frontier theory代考,UKhelp,UCLhelp,University College Londonhelp,BENG0091help,Stochastic Calculus and Uncertainty Analysishelp,Matlabhelp,Pythonhelp,Efficient frontier theoryhelp,UK作业代写,UCL作业代写,University College London作业代写,BENG0091作业代写,Stochastic Calculus and Uncertainty Analysis作业代写,Matlab作业代写,Python作业代写,Efficient frontier theory作业代写,UK编程代写,UCL编程代写,University College London编程代写,BENG0091编程代写,Stochastic Calculus and Uncertainty Analysis编程代写,Matlab编程代写,Python编程代写,Efficient frontier theory编程代写,UKprogramming help,UCLprogramming help,University College Londonprogramming help,BENG0091programming help,Stochastic Calculus and Uncertainty Analysisprogramming help,Matlabprogramming help,Pythonprogramming help,Efficient frontier theoryprogramming help,UKassignment help,UCLassignment help,University College Londonassignment help,BENG0091assignment help,Stochastic Calculus and Uncertainty Analysisassignment help,Matlabassignment help,Pythonassignment help,Efficient frontier theoryassignment help,UKsolution,UCLsolution,University College Londonsolution,BENG0091solution,Stochastic Calculus and Uncertainty Analysissolution,Matlabsolution,Pythonsolution,Efficient frontier theorysolution,