程序代做CS代考 finance CORPFIN 2503 – Business Data Analytics

CORPFIN 2503 – Business Data Analytics

2021 S2, Workshop 8: Monte-Carlo simulation

£ius

1 Daily stock price data

Let’s download daily stock price data from finance.yahoo.com for the 14/09/2020

� 10/09/2021 for :

� Amazon.com, Inc. (AMZN)

� . (AAPL).

Then compute the daily log returns and the following properties:

� mean log return for each stock

� covariance matrix of both log returns.

2 Generation of correlated random variables

Let’s generate 5,000 random values for 2 variables with properties similar to those

for AMZN and AAPL stocks:

data work.stocks(type=COV) ;

input _TYPE_ $ 1-4 _NAME_ $ 5-9 AMZN AAPL;

datalines ;

COV AMZN 0.000305534 0.000213946

COV AAPL 0.000213946 0.000332822

MEAN Mean 0.000446199 0.001048394

;

1

finance.yahoo.com

PROC SIMNORM DATA=work.stocks OUTSIM=work.stocks_sim

NUMREAL = 5000;

VAR AMZN AAPL;

RUN;

For �xed formatted data (i.e., data that has no delimiters such as spaces, com-

mas, or tabs) to separate �xed formatted data, column de�nitions are required for

every variable in the dataset. That is, one needs to provide the beginning and end-

ing column numbers for each variable. This also requires the data to be in the same

columns for each case. For example, _TYPE_ $ 1− 4 means that

� the name of the �rst variable is _TYPE_

� this variable is character (because of $ following the variable name)

� variable name consists of 4 symbols (1− 4): starting with the �rst column and
ending with the fourth column.

Then using SAS procudere SIMNORM we generate 5,000 random values for 2

variables (AMZN AAPL). These two variables will have the same (or at least, very

similar) statistical properties to those in �work.stocks� �le.

3 Monte Carlo simulation

Using random variables generated in Task 2, compute the changes in the value of

the portfolio consisting of:

� US$100 million investment into Amazon.com, Inc. (AMZN)

� US$75 million investment into . (AAPL).

data work.stocks_sim;

set work.stocks_sim;

portf=100*AMZN+75*AAPL;

run;

Then compute:

1. the expected change in the portfolio value

2

2. minimum and maximum values

3. the lowest 1st and 5th percentiles of the change in the portfolio value (value at

risk (VaR)):

� e.g., if 1-day VaR on the portfolio is $100m at 95% con�dence level, it

means that there is a only a 5% chance that the value of the portfolio

will drop more than $100m over any 1 day

4. histogram of the change in the portfolio value

5. the probability that the the change in the portfolio value is non-negative.

4 Monte Carlo simulation II (at home)

Expand Task #2 to include the third stock (e.g., Microsoft Corporation (MSFT)).

Assume that US$50 million has been invested into Microsoft stock and use 100,000

(rather than 5,000) random values. Hint : covariance matrix will become 3× 3.

3

Daily stock price data
Generation of correlated random variables
Monte Carlo simulation
Monte Carlo simulation II (at home)