Anda di halaman 1dari 13

Optimal Scenarios

Konstantinos Fragiadakis
kfragiad@econ.uoa.gr
University of Athens Doctoral Program in Economics
www.UADPhilEcon.gr
Suppose an investor has to select a number of stocks that optimise the
expected returns of her portfolio under the portfolio risk. A common solution is
to optimize using as data all the stock values of the current Market and use
Markowitz' portfolio theory. This is the typical mean variance problem of
maximizing the expected return of the portfolio under a particular portfolio risk
or minimizing the portfolio risk under a particular expected return.
The aforementioned theory is a static approach to the problem. It is commonly
known that the volatility of the stocks is not constant. That risk is the variance
in variance. A second additional risk for investors holding a portfolio smaller
than the market is that the actual return may deviate not only from the
expected return of the portfolio but from the expected return of the market as
well.
The Capital Asset Pricing Model (CAPM), using the coefficient beta, conveys
an alternative notion of volatility. This model divides the risk of the portfolio into
systematic risk and unsystematic risk. It assumes that each increase of the
price of the Market Index would lead to an increase or decrease of each stock
value in the Market depends on the coefficient beta.
The sample data have been collected from the Athens Stocks Exchange for the
period 1/1/2002 to 30/6/2003. Fifty stocks were selected randomly.
Stock Price Matrix
Stocks
0 1 2 3
0
1
12.76 8 4.08 2.2
13 14 7 96 4 1 2 22
:=
1
2
3
4
5
6
7
8
9
13.14 7.96 4.1 2.22
13.28 7.96 4.1 2.21
13.22 7.96 4.02 2.19
13.04 7.96 3.96 2.07
13.04 7.96 3.96 2.07
13.18 7.96 3.96 2.07
13.38 7.96 3.92 2.04
13.08 7.96 3.86 1.96
13.16 7.96 3.9 ...
General Stock Index Matrix
Index
0
0
1
2
3
4
5
6
7
8
9
2627.28
2635.75
2646.38
2638.19
2582.26
2582.26
2587.41
2574.68
2523.85
...
:=
Let T be the number of Observations and V be the number of Variables
T rows Stocks ( ) := V cols Stocks ( ) :=
The following formula is used for the calculation of the daily returns for each stock
RStocks n k , ( )
0 i 0 = if
N
i j ,
Stocks
i j ,
Stocks
i 1 j ,

Stocks
i 1 j ,
i 0 > if
j 0 1 , k .. e for
i 0 1 , n .. e for
N
:=
The stock return matrix is
StocksReturns RStocks T 1 V 1 , ( ) :=
The following formula is used for the calculation of the daily returns of General Index
RIndex
0 i 0 = if
K
i
Index
i
Index
i 1

Index
i 1
i 0 > if
i 0 T 1 .. e for
K
:=
The index return matrix is
IndexReturns RIndex :=
Using the formula above, we separate the stock returns in 50 vectors. Each vector has the daily
returns of the corresponding stock
Therefore, we have A(i) for stocks i, where i =1,2...50 Therefore, we have A(i) for stocks i, where i =1,2...50
A V ( )
N
i
StocksReturns
i j ,

i 0 T 1 .. e for
j 0 V 1 .. e for
N
:=
The beta coefficient is the slope of the line that has as x =Index Returns and as y =Stock
Returns
BetaStocks
J
i 1
slope IndexReturns A i ( ) , ( )
i 1 V .. e for
J
:=
We create the following matrix X
X
J
i 1
i
i 1 V .. e for
J
:=
In the following table we give the names of Stocks and their corresponding number
1 AVAX
2 ATE
3 AKRIT
4 ANEK
5 ATERM
6 ATTIK
7 ASTIR
8 EGNAK
9 ETE
10 ELAI
Next we give a matrix with the beta of each stock and its corresponding number
Beta augment X BetaStocks , ( ) :=
Sort depending on beta
Sbeta csort Beta 1 , ( ) :=
We make 5 portfolios depending on beta
We choose ten stocks for each portfolio starting with the lowest beta.
i 0 :=
Portfolio
1
augment A Sbeta
i 0 ,
( )
A Sbeta
i 1 + 0 ,
( )
, A Sbeta
i 2 + 0 ,
( )
, A Sbeta
i 3 + 0 ,
( )
, A Sbeta
i 4 + 0 ,
( )
, A Sbeta
i 5 + 0 ,
( )
, A Sbeta
i 6 + 0 ,
( )
, A Sbeta
i 7 + 0 ,
( )
, A Sbeta
i 8 + 0 ,
( )
, A Sbeta
i 9 + 0 ,
( )
,
( )
:=
i 10 :=
Portfolio
2
augment A Sbeta
i 0 ,
( )
A Sbeta
i 1 + 0 ,
( )
, A Sbeta
i 2 + 0 ,
( )
, A Sbeta
i 3 + 0 ,
( )
, A Sbeta
i 4 + 0 ,
( )
, A Sbeta
i 5 + 0 ,
( )
, A Sbeta
i 6 + 0 ,
( )
, A Sbeta
i 7 + 0 ,
( )
, A Sbeta
i 8 + 0 ,
( )
, A Sbeta
i 9 + 0 ,
( )
,
( )
:=
i 20 :=
Portfolio
3
augment A Sbeta
i 0 ,
( )
A Sbeta
i 1 + 0 ,
( )
, A Sbeta
i 2 + 0 ,
( )
, A Sbeta
i 3 + 0 ,
( )
, A Sbeta
i 4 + 0 ,
( )
, A Sbeta
i 5 + 0 ,
( )
, A Sbeta
i 6 + 0 ,
( )
, A Sbeta
i 7 + 0 ,
( )
, A Sbeta
i 8 + 0 ,
( )
, A Sbeta
i 9 + 0 ,
( )
,
( )
:=
i 30 :=
Portfolio
4
augment A Sbeta
i 0 ,
( )
A Sbeta
i 1 + 0 ,
( )
, A Sbeta
i 2 + 0 ,
( )
, A Sbeta
i 3 + 0 ,
( )
, A Sbeta
i 4 + 0 ,
( )
, A Sbeta
i 5 + 0 ,
( )
, A Sbeta
i 6 + 0 ,
( )
, A Sbeta
i 7 + 0 ,
( )
, A Sbeta
i 8 + 0 ,
( )
, A Sbeta
i 9 + 0 ,
( )
,
( )
:=
i 40 :=
Portfolio
5
augment A Sbeta
i 0 ,
( )
A Sbeta
i 1 + 0 ,
( )
, A Sbeta
i 2 + 0 ,
( )
, A Sbeta
i 3 + 0 ,
( )
, A Sbeta
i 4 + 0 ,
( )
, A Sbeta
i 5 + 0 ,
( )
, A Sbeta
i 6 + 0 ,
( )
, A Sbeta
i 7 + 0 ,
( )
, A Sbeta
i 8 + 0 ,
( )
, A Sbeta
i 9 + 0 ,
( )
,
( )
:=
We use the Markowitz mean - variance model to find the proportions that minimise
the risk of each portfolio under a constant return. We accept the hypothesis that
we could reduce the portfolio risk only if we accept lower returns .
Let U be the number of stocks included in each portfolio. U 10 :=
Let Mean be the daily portfolio mean return.
Let Covar be the covariance stock return matrix of the portfolio .
w 1 2 , 5 .. :=
L k w , ( )
M
j
0
T 1
i
Portfolio
w
( )
i j ,

=
T 1

j 0 1 , k .. e for
M
:=
Covar n k , w , ( )
N
i j ,
cvar Portfolio
w
( )
i
( )
Portfolio
w
( )
j
( )
,

j 0 1 , k .. e for
i 0 1 , n .. e for
N
:=
Mean i ( ) L U 1 i , ( ) :=
Covar i ( ) Covar U 1 U 1 , i , ( ) :=
The Objective function is
Risk x i , ( ) x
T
Covar i ( ) x
( )
:=
Guess value
a
0.03
0.05
0.08
0.15
0.25
|

\
|
|
|
|
|
|
.
:= x
9
0 :=
Mean 1 ( )
0
0
1
2
3
4
5
6
7
8
9
-0.00017
-0.00036
0.00088
-0.00137
0.00009
0.00054
-0.00056
-0.0004
0.00016
-0.00211
=
Constraints are
Given
0
U 1
i
x
i
=
1 = x 0 > Mean i ( ) x
a
i 1
T 1
>
FR i ( ) MinimizeRisk x , ( ) := FR is the optimal proportion of each stock
Note: this solver is set to the
Quadratic method available only
with the Sol vi ng and
Opti mi zati on Extensi on Pack.
We define the portfolio mean and variance as
MeanP i ( ) Mean i ( ) FR i ( ) T 1 ( ) :=
VarP i ( ) Risk FR i ( ) i , ( ) :=
We define the following matrices in order to have better presentation
P j ( )
N
k
Sbeta
k 10 j 1 ( ) + 0 ,

k 0 1 , U 1 .. e for
N
:=
B j ( )
N
k
Sbeta
k 10 j 1 ( ) + 1 ,

k 0 1 , U 1 .. e for
N
:=
These are the optimal proportion of each portfolio, the corresponding number of stock and the
corresponding beta
OptimalPortfolio i ( ) augment P i ( ) FR i ( ) , B i ( ) , ( ) :=
We calculate the portfolio beta for each portfolio
BetaP m ( )
0
U 1
i
OptimalPortfolio m ( )
i 1 ,
OptimalPortfolio m ( )
i 2 ,

( )

=
:=
We give the results
i 1 2 , 5 .. :=
MeanP i ( ) = VarP i ( ) = BetaP i ( ) =
In order to find the proportion that we should invest in each portfolio, we calculate the return of
the optimal portfolio for each day
ReturnsP m ( )
0
U 1
i
FR m ( )
i
A P m ( )
i
( )

( )

=
:=
Last but not least we use the Markowitz mean - variance model in order to find the optimal
proportions that should be invested at each portfolio
Portfolio
Return
Matrix
PRM augment ReturnsP 1 ( ) ReturnsP 2 ( ) , ReturnsP 3 ( ) , ReturnsP 4 ( ) , ReturnsP 5 ( ) , ( ) :=
L k ( )
M
j
0
T 1
i
PRM
i j ,
=
T 1

j 0 1 , k .. e for
M
:=
PRM
Covar n k , ( )
N
i j ,
cvar PRM
i
( )
PRM
j
( )
,
( )

j 0 1 , k .. e for
i 0 1 , n .. e for
N
:=
PRM
MeanPA L 4 ( ) := L CovarPA Covar 4 4 , ( ) := Covar
RiskPA y i , ( ) y
T
CovarPA y
( )
:= CovarPA
y
4
0 := a
0
0.10 :=
Given
0
4
i
y
i
=
1 = MeanPA y
a
0
T 1
> y 0 >
Note: this solver is st to the
Quadratic method available only
with the Sol vi ng and
Opti mi zati n Extensi on Pack.
PA i ( ) MinimizeRiskPA y , ( ) := PA
J
N
i
PA 1 ( )
i

i 0 1 , 4 .. e for
N
:=
PA
The matrix J gives the optimal proportions
Finally, plot a comparison plot
ReturnsPA
0
4
i
J
i
PRM
i
( )

|
\
|
.

=
:= J
PricesPA
N
i
Index
0
0
i
i
1 ReturnsPA
i
+
( )
[
=

i 0 1 , T 1 .. e for
N
:=
ReturnsPA
i 0 1 , T 1 .. :=
0 100 200 300 400
1 10
3

1.5 10
3

2 10
3

2.5 10
3

3 10
3

Index
i
PricesPA
i
i
We have calculated the optimal portfolio under our preferences. We could see that
our optimal portfolio has better returns against the General index at any period.
That was expected because we did optimisation under a significant period. The
addition here is that we include our preferences when we used the beta.

Anda mungkin juga menyukai