Ch6. Covariance Correlation

advertisement
203
Chapter 6. Covariance, Correlation
Problem PP169
To illustrate graphically the meaning of correlation, generate 10 values of a random variable X
uniformly distributed between 1 and 12 in cells A2:A11: = 1 + 𝑅𝐴𝑁𝐷( ) ∗ 11.
Generate 10 values of a random variable Y in cells B2:B11. The conditional pdf of Y given 𝑋 = π‘₯
1
is 𝑓(𝑦|π‘₯) = 12−π‘₯ , 1 < 𝑦 < 13 − π‘₯. Example for cell B2: = 1 + (12 − 𝐴2) ∗ 𝑅𝐴𝑁𝐷( ) and
similarly for cells B3:B11.
To prepare for a scatter plot of the values (𝑋 π‘Œ), input the values 0 and 13 in cells D2:D3, the
values 0 and 12 in cells D5:D6, compute the mean of the ten X values in both cells E2 and E3, the
mean of the 10 Y values in both cells E5 and E6.
1. Use Insert\Scatter\Scatter with only markers to graph the X (on the horizontal axis) and Y
values (on the vertical axis). Select the horizontal axis from 0 to 12, the vertical axis from
0 to 13. Add a vertical line at the mean of the X values (use cells D2:E3, connect the
points by a linear trend line), a horizontal line at the mean of the Y values (use cells
D5:E6). Consider both trend lines as new coordinate axes. Compute the correlation
coefficient between the X and the Y values in cell E8: = 𝐢𝑂𝑅𝑅𝐸𝐿(𝐴2: 𝐴11; 𝐡2: 𝐡11).
Click on one of the data points in the graph and add a linear trend line.
Check the sign of the correlation and the slope of the trend line.
Repeat generating the values of X and Y (key F9), check the correlation coefficient and
the position of the points with respect to the new axes. Also compute the sample
covariance in cell D9: = 𝐢𝑂𝑉𝐴𝑅𝐼𝐴𝑁𝐢𝐸. 𝑆(𝐴2: 𝐴11; 𝐡2: 𝐡11);
2. On a new worksheet generate 10 values of X as in Step 1. Generate 10 values of Y in cells
B2:B11 as follows (example for cell B2): = 16 − 2 ∗ 𝐴2 and likewise for cells B3:B11.
Use a scatter plot to graph the 10 values of X and Y.
Compute the correlation coefficient between the X and the Y values. Notice the perfect
(negative) correlation for points on a straight line (with negative slope);
3. On a new worksheet we generate 50 points on the circumference of a circle with radius 1
as follows: 50 values of X, randomly distributed between -1 and +1, in the range A2:A51:
= −1 + 2 ∗ 𝑅𝐴𝑁𝐷( ), 50 values of Y in cells B2:B51. Example for cell B2:
= 𝐼𝐹(𝑅𝐴𝑁𝐷( ) < .5; 𝑆𝑄𝑅𝑇(1 − 𝐴2 ∗ 𝐴2); −𝑆𝑄𝑅𝑇(1 − 𝐴2 ∗ 𝐴2)) and similarly for cells
B3:B51.
Use a scatter plot to graph the 50 values of (𝑋 π‘Œ).
Compute the correlation coefficient between the X and the Y values. Notice the poor
correlation although the points are ‘perfectly’ related since 𝑋 2 + π‘Œ 2 = 1;
4. On a new worksheet generate the points as in Step 1. Add a point in row 12: the value 12
in cell A12, the value 13 in cell B12.
Compute again the correlation between X and Y. The added point can be considered an
outlier in the data. Notice the strong effect an outlier can have on the correlation.
When repeatedly generating new data the correlation coefficient will be just mildly
204
negative or even positive.
Assignment PA169
Repeat Step 1 but generate the values of Y as (for cell B2): = 1 + 𝐴2 ∗ 𝑅𝐴𝑁𝐷( ).
Repeat Step 2 but generate the values of Y as (for cell B2): = 6 + 2 ∗ 𝐴2.
Repeat Step 3 but generate the values of Y (for cell B2): = π‘ƒπ‘‚π‘ŠπΈπ‘…(𝐴2; 4).
205
Problem PP170
Consider the random variables (X, Y) in Problem PP135.
1. Compute the expected values, the variances and standard deviations of X and Y.
Answer: 𝐸(𝑋) = 0.8, π‘£π‘Žπ‘Ÿ(𝑋) = 0.76, 𝐸(π‘Œ) = 0.4, π‘£π‘Žπ‘Ÿ(π‘Œ) = 0.24;
2. Compute the expected value of X*Y and the covariance and correlation between X and Y.
Answer: 𝐸(𝑋 ∗ π‘Œ) = 0.5, π‘π‘œπ‘£π‘Žπ‘Ÿ(𝑋, π‘Œ) = 0.18, π‘π‘œπ‘Ÿπ‘Ÿπ‘’π‘™(𝑋, π‘Œ) = 0.4215;
3. Derive the conditional pmf of Y given X for all possible values of X.
Answer:
𝑝𝑦|π‘₯ (0|0) = 0.8, 𝑝𝑦|π‘₯ (1|0) = 0.2,
𝑝𝑦|π‘₯ (0|1) = 0.5, 𝑝𝑦|π‘₯ (1|1) = 0.5,
𝑝𝑦|π‘₯ (0|2) = 1⁄3, 𝑝𝑦|π‘₯ (1|2) = 2⁄3;
4. Generate 1000 values of X using the marginal pmf of X as follows: input random numbers
in the range A2:A1001 and generate random values of X in cells B2:B1001. Example for
cell B2:
= 𝐼𝐹(𝐴2 < .5,0; 𝐼𝐹(𝐴2 < .7; 1; 2)) and similarly for cells B3:B1001.
Use the conditional pmf of Y given X to generate 1000 values of Y in cells C2:C1001.
Example for cell C2: = 𝐼𝐹 (𝐡2 = 0; 𝐼𝐹(𝑅𝐴𝑁𝐷( ) < .8; 0; 1); 𝐼𝐹(𝐡2 = 1; 𝐼𝐹(𝑅𝐴𝑁𝐷( ) <
.5; 0; 1); 𝐼𝐹(𝑅𝐴𝑁𝐷( ) < 1⁄3; 0; ,1))) and similarly for cells C3:C1001.
In cell D11, compute the (sample) covariance of the first ten observations:
= 𝐢𝑂𝑉𝐴𝑅𝐼𝐴𝑁𝐢𝐸. 𝑆(𝐡$2: 𝐡11; 𝐢$2: 𝐢11). Similarly for cells D12:D1001 for the first 11,
12, … observations.
In cell E11 compute the correlation coefficient of the first 10 observations:
= 𝐢𝑂𝑅𝑅𝐸𝐿(𝐡$2: 𝐡11; 𝐢$2: 𝐢11) and similarly for cells E12:E1001 for the first 11, 12,
… observations.
Report the values 10, 11, 12, …, 1000 in cells F11:F1001. Use columns F and D to graph
the evolution of the sample covariance as a function of the sample size (use the option
Scatter with Straight Lines and Markers). Add a straight line for the value of π‘π‘œπ‘£π‘Žπ‘Ÿ(𝑋, π‘Œ)
as computed in Step 2.
In a similar way use columns F and E to graph the evolution of the sample correlation.
Assignment PA170
Consider the Assignment in Problem PP135. Compute the expected values, the variances and the
standard deviations of X and Y.
Compute the covariance and the correlation between X and Y.
Generate 1000 values of X and Y.
As in Step 4 compute the sample covariance and correlation of the first 10, 11, 12, …,1000
observations. Graph the evolution of the sample covariance and correlation as in Step 4.
206
Problem PP171
The sides of two coins are numbered 1 and 2. Both coins are tossed. Let X be the sum of the
numbers on both coins and Y the maximum.
1. Derive the joint pmf of X and Y.
Answer:
Y: Maximum
Marginal X
1
2
2
.25
.25
X: Sum
3
.5
.5
Marginal Y
4
.25
.25
.25
.75
2. Derive the marginal pmf of X and Y.
Answer: see Table in Step 1;
3. Compute the expected values, the variances and the standard deviations of X and Y.
Answer: 𝐸(𝑋) = 3, πœŽπ‘‹2 = 0.5, πœŽπ‘‹ = √. 5 , 𝐸(π‘Œ) = 1.75, πœŽπ‘Œ2 = .1875, πœŽπ‘Œ = √. 1875;
4. Compute the covariance and the correlation between X and Y.
Answer: π‘π‘œπ‘£π‘Žπ‘Ÿ(𝑋, π‘Œ) = 1⁄4, π‘π‘œπ‘Ÿπ‘Ÿπ‘’π‘™(𝑋, π‘Œ) = √2⁄3 = 0.8165;
5. Compute 𝑉𝐴𝑅(𝑋 − π‘Œ) from the results in Step 3 and 4.
Answer: 𝑉𝐴𝑅(𝑋 − π‘Œ) = 3⁄16;
6. Generate 1000 values of the two coins in cells A2:B1001, the values of the sum X in cells
C2:C1001, the values of the maximum Y in cells D2:D1001.
Derive the sample estimates of the results in Step 1 to Step 5 and compare with the exact
results.
Assignment PA171
Two sides of a die are colored blue, two sides are colored green and two sides are colored red.
When rolling the die, define the random variables B (𝐡 = 1 when outcome is blue, 0 otherwise)
and R (𝑅 = 1 when the outcome is red, 0 otherwise).
Compute the covariance and the correlation between B and R. Compute the variance of the sum
𝐡 + 𝑅.
Simulate the problem over 1000 lines and compute the sample covariance and sample correlation
between B and R. Compute the sample variance of 𝐡 + 𝑅.
Compare the sample values with the exact results.
207
Problem PP172
Consider Problem PP136.
1. Compute the covariance and the correlation between X and Y. Does the sign of the
correlation make intuitive sense? Why?
Answer: π‘π‘œπ‘£π‘Žπ‘Ÿ(𝑋, π‘Œ) = 0.9452, π‘π‘œπ‘Ÿπ‘Ÿπ‘’π‘™(𝑋, π‘Œ) = 0.4795;
2. Compute 𝐸(1⁄π‘Œ), π‘£π‘Žπ‘Ÿ(1⁄π‘Œ) π‘Žπ‘›π‘‘ 𝑠𝑑𝑑𝑒𝑣(1⁄π‘Œ).
Answer: 𝐸(1⁄π‘Œ) = 0.5514, π‘£π‘Žπ‘Ÿ(1⁄π‘Œ) = .0984, 𝑠𝑑𝑑𝑒𝑣(1⁄π‘Œ) = .3137;
3. Verify that 𝐸(1⁄π‘Œ) = .5514 ≠ 1⁄𝐸(π‘Œ) = .3956;
4. Compute 𝐸(𝑋⁄π‘Œ), π‘£π‘Žπ‘Ÿ(𝑋⁄π‘Œ). Verify that 𝐸(𝑋⁄π‘Œ) = 2.275 ≠ 𝐸(𝑋)⁄𝐸(π‘Œ) = 1.7692
and that 𝐸(𝑋⁄π‘Œ) = 2.275 ≠ 𝐸(𝑋) ∗ 𝐸(1⁄π‘Œ) = 2.4659;
5. Compute π‘π‘œπ‘£π‘Žπ‘Ÿ(𝑋, 1⁄π‘Œ ) and π‘π‘œπ‘Ÿπ‘Ÿπ‘’π‘™(𝑋, 1⁄π‘Œ ) using the results in Steps 2 and 4.
Answer: π‘π‘œπ‘£π‘Žπ‘Ÿ(𝑋, 1⁄π‘Œ) = −.1909, π‘π‘œπ‘Ÿπ‘Ÿπ‘’π‘™(𝑋, 1⁄π‘Œ) = −.4335;
6. Compute 𝐸(π‘Œ⁄𝑋) and π‘£π‘Žπ‘Ÿ(π‘Œ⁄𝑋).
Answer: 𝐸(π‘Œ⁄𝑋) = .5833, π‘£π‘Žπ‘Ÿ(π‘Œ⁄𝑋) = .0713;
7. Compute π‘π‘œπ‘£π‘Žπ‘Ÿ(𝑋⁄π‘Œ , π‘Œ⁄𝑋) en π‘π‘œπ‘Ÿπ‘Ÿπ‘’π‘™(𝑋⁄π‘Œ , π‘Œ⁄𝑋) using the results in Steps 4 and 6.
Answer: π‘π‘œπ‘£π‘Žπ‘Ÿ(𝑋⁄π‘Œ , π‘Œ⁄𝑋) = −.3271, π‘π‘œπ‘Ÿπ‘Ÿπ‘’π‘™(𝑋⁄π‘Œ , π‘Œ⁄𝑋) = −.8766;
8. Generate values of X and Y as in Step 3 of Problem PP136. Compute the values of
𝑋⁄π‘Œ, π‘Œ⁄𝑋 π‘Žπ‘›π‘‘ 1⁄π‘Œ in columns E, F and G.
Compute all sample analogues of the results in Steps 1 to 7.
Compare the sample values with the exact theoretical results.
Assignment PA172
Consider Assignment PA136.
Compute π‘π‘œπ‘£π‘Žπ‘Ÿ(𝑋, π‘Œ), π‘π‘œπ‘Ÿπ‘Ÿπ‘’π‘™(𝑋, π‘Œ), π‘π‘œπ‘£π‘Žπ‘Ÿ(𝑋⁄π‘Œ , π‘Œ⁄𝑋), π‘π‘œπ‘Ÿπ‘Ÿπ‘’π‘™(𝑋⁄π‘Œ , π‘Œ⁄𝑋).
Generate 1000 values of X and Y. Compute 𝑋⁄π‘Œ and π‘Œ⁄𝑋 in columns C and D.
Compute estimates of the four parameters from the sample data.
Repeat the simulation a number of times and compare the sample values with the exact
theoretical values.
208
Problem PP173
Consider the random variables in Problem PP135 and Problem PP170.
1. Compute the variance of the sum 𝑋 + π‘Œ from the pmf as derived in Step 5 of Problem
PP135.
Answer: π‘£π‘Žπ‘Ÿ(𝑋 + π‘Œ) = 1.36;
2. Compute the variances of X and Y and the covariance between X and Y.
Answer: π‘£π‘Žπ‘Ÿ(𝑋) = 0.76, π‘£π‘Žπ‘Ÿ(π‘Œ) = 0.24, π‘π‘œπ‘£π‘Žπ‘Ÿ(𝑋, π‘Œ) = 0.18;
3. Compute the variance of the sum 𝑋 + π‘Œ from the results in Step 2;
4. Generate 1000 values of X and Y as in Step 4 of Problem PP170.
Compute the sum of the values of X and Y in cells D2:D101.
Compute the sample variances of X and Y and the sample covariance between the data in
columns B and C:
= 𝑉𝐴𝑅. 𝑆(𝐡2: 𝐡1001), = 𝑉𝐴𝑅. 𝑆(𝐢2: 𝐢1001), = 𝐢𝑂𝑉𝐴𝑅𝐼𝐴𝑁𝐢𝐸. 𝑆(𝐡2: 𝐡1001; 𝐢2: 𝐢1001).
Compute the sample variance of the sum 𝑋 + π‘Œ in two ways: directly from the data in
column D: = 𝑉𝐴𝑅. 𝑆(𝐷2: 𝐷1001) and indirectly from the sample variances and the
sample covariance:
= 𝑉𝐴𝑅. 𝑆(𝐡2: 𝐡1001) + 𝑉𝐴𝑅. 𝑆(𝐢2: 𝐢1001) + 2 ∗ 𝐢𝑂𝑉𝐴𝑅𝐼𝐴𝑁𝐢𝐸. 𝑆(𝐡2: 𝐡1001; 𝐢2: 𝐢1001).
Compare both results.
Compare the sample variance of the sum with the exact value computed in Step 3.
Assignment PA173
Consider the random variables X and Y in Assignments PA135 and PA170.
In PA170 you have computed π‘£π‘Žπ‘Ÿ(𝑋) = 0.5, π‘£π‘Žπ‘Ÿ(π‘Œ) = 1, π‘π‘œπ‘£π‘Žπ‘Ÿ(𝑋, π‘Œ) = 0.5.
Derive π‘£π‘Žπ‘Ÿ(π‘Œ − 𝑋) from these results. What is the meaning of the random variable π‘Œ − 𝑋 in this
problem? Derive the variance of π‘Œ − 𝑋 from this new interpretation.
Simulate 1000 values of X and Y, compute the differences π‘Œ − 𝑋 and the sample variance of the
differences.
Compute the sample variances of X and Y and the sample covariance between X and Y.
Compute again the sample variance of the differences π‘Œ − 𝑋 from these results.
Compare the results of both approaches.
209
Problem PP174
Consider Problem PP136 and Problem PP172.
1. Compute π‘£π‘Žπ‘Ÿ(𝑋 − π‘Œ) using the pmf of 𝑋 − π‘Œ derived in Step 8 of Problem PP136.
Answer: 2.0525;
2. From the marginal pmf of X and Y derived in Step 2 of Problem PP136, compute π‘£π‘Žπ‘Ÿ(𝑋)
and π‘£π‘Žπ‘Ÿ(π‘Œ).
Answer: π‘£π‘Žπ‘Ÿ(𝑋) = π‘£π‘Žπ‘Ÿ(π‘Œ) = 1.9715;
3. Compute π‘π‘œπ‘£π‘Žπ‘Ÿ(𝑋, π‘Œ) using the joint pmf of X and Y derived in Step 1 of Problem PP136.
Answer: 0.9452;
4. Derive π‘£π‘Žπ‘Ÿ(𝑋 − π‘Œ) from the results in Step 2 and 3.
Answer: see Step 1;
5. Start from the simulated values in Step 3 of Problem 136 or Step 2 in Problem PP172.
Compute the sample variance of the values 𝑋 − π‘Œ generated in column E;
6. Compute the sample variances and the sample covariance of the values of X and Y
generated in columns D and C;
7. Derive the sample variance of the values of 𝑋 − π‘Œ from the results in Step 6;
8. Compute π‘£π‘Žπ‘Ÿ(𝑋 + π‘Œ) using the pmf of 𝑋 + π‘Œ derived in Step 8 of Problem PP136.
Answer: 5.8333;
9. From the results in Step 2 and 3 again compute the variance of 𝑋 + π‘Œ.
Answer: see Step 8;
10. Call the result of rolling a die T. What is the value of 2 ∗ π‘£π‘Žπ‘Ÿ(𝑇)? Compare with the
results in Step 8 and 9. Explain;
11. Start from the simulated values in Step 3 of Problem PP136 or Step 2 in Problem PP172.
Compute the sample variance of the values 𝑋 + π‘Œ generated in column F;
12. Derive the sample variance of the values of 𝑋 + π‘Œ generated in column F from the results
in Step 6;
13. Let 𝑇1 and 𝑇2 be the outcome on the first and the second die in columns A and B.
Compute the sample variances and the sample covariance of the data generated in
columns A and B. From these values derive the sample variance of the values 𝑇1 + 𝑇2 and
compare with the values in Steps 11 and 12. Explain.
210
Assignment PA174
Consider the random variables X and Y defined in PA136 and PA172.
Derive the pmf of 𝑋 − π‘Œ from the joint pmf of X and Y.
Derive π‘£π‘Žπ‘Ÿ(𝑋 − π‘Œ) from the pmf of 𝑋 − π‘Œ.
Compute the expected values and variances of X and Y.
Compute the covariance between X and Y.
Derive π‘£π‘Žπ‘Ÿ(𝑋 − π‘Œ) using π‘£π‘Žπ‘Ÿ(𝑋), π‘£π‘Žπ‘Ÿ(π‘Œ) and π‘π‘œπ‘£π‘Žπ‘Ÿ(𝑋, π‘Œ). Compare both results.
Generate 1000 values of X, Y and 𝑋 − π‘Œ.
Compute the sample variance of 𝑋 − π‘Œ in two ways: firstly, from the 1000 differences and
secondly from the sample variance of X, the sample variance of Y and the sample covariance
between X and Y.
211
Problem PP175
Random variables X and Y have a variance equal to 1 and π‘π‘œπ‘Ÿπ‘Ÿπ‘’π‘™(𝑋, π‘Œ) = 𝜌. For any constant c
let 𝑉 = π‘Œ + 𝑐𝑋 and π‘Š = 𝑋 + π‘π‘Œ.
1. Derive π‘π‘œπ‘£π‘Žπ‘Ÿ(𝑉, π‘Š) and π‘π‘œπ‘Ÿπ‘Ÿπ‘’π‘™(𝑉, π‘Š).
Answer: π‘π‘œπ‘£π‘Žπ‘Ÿ(𝑉, π‘Š) = 𝜌 + πœŒπ‘ 2 + 2𝑐, π‘π‘œπ‘Ÿπ‘Ÿπ‘’π‘™(𝑉, π‘Š) =
𝜌+πœŒπ‘ 2 +2𝑐
1+𝑐 2 +2πœŒπ‘
;
2. Check the correlation when 𝑐 = 1. Explain;
3. Assume X and Y are bivariate normal with
𝐸(𝑋) = 10, 𝐸(π‘Œ) = 20, π‘£π‘Žπ‘Ÿ(𝑋) = π‘£π‘Žπ‘Ÿ(π‘Œ) = 1, 𝜌(𝑋, π‘Œ) = 𝜌.
Generate 1000 values of X in cells A2:A1001: = 𝑁𝑂𝑅𝑀. 𝐼𝑁𝑉(𝑅𝐴𝑁𝐷( ); 10; 1), generate
1000 values of Y in cells B2:B1001 for 𝜌 = 0.5 . Example for cell B2:
= 𝑁𝑂𝑅𝑀. 𝐼𝑁𝑉 (𝑅𝐴𝑁𝐷( ); 20 ∗ .5 ∗ (𝐴2 − 10); 𝑆𝑄𝑅𝑇(1 − π‘ƒπ‘‚π‘ŠπΈπ‘…(. 5; 2))).
In columns C and D report values of Y for 𝜌 = 0 and 𝜌 = −0.5.
Let 𝑐 = 4. In columns E and F report values of V and W for 𝜌 = 0.5, in columns G and H
report values of V and W for 𝜌 = 0, in columns I and J report values of V and W for 𝜌 =
−0.5.
Based on the results in Step 1 compute the covariance and the correlation between V and
W for the three different correlations between X and Y.
Compute the sample covariances and sample correlations and compare with the exact
theoretical values.
Assignment PA175
Two analysts measure a same variable Y. The measurements involve errors. Let π‘‹π‘˜ be the value
measured by analyst π‘˜, π‘˜ = 1, 2 and assume π‘‹π‘˜ = π‘Œ + πœ€π‘˜ , π‘˜ = 1,2. Assume that πœ€1 and πœ€2 are
independent and that both are also independent of Y. Let 𝐸(πœ€1 ) = 𝐸(πœ€2 ) = 0 (both analysts
expect to measure Y correctly), π‘£π‘Žπ‘Ÿ(πœ€1 ) = π‘£π‘Žπ‘Ÿ(πœ€2 ) = 𝜏 2 and π‘£π‘Žπ‘Ÿ(π‘Œ) = 𝜎 2 .
Compute the covariance and the correlation between both measurements as a function of 𝜎 2 and
𝜏 2 . When is the correlation minimal, when maximal?
Generate 1000 values of Y in cells A2:A1001 (assume Y to be normally distributed with expected
value 100 and standard deviation 2), generate 1000 values of πœ€1 (πœ€2 ) in cells B2:B1001
(C2:C1001) (assume both to be standard normally distributed).
Compute the values of 𝑋1 (𝑋2) in column D (E). Compute the sample covariance and the sample
correlation between 𝑋1 and 𝑋2 and compare with the exact values computed in Step 1.
212
Problem PP176
Random variable Z is standard normally distributed. Let 𝑋 = 2 ∗ 𝑍 and π‘Œ = 𝑍 2 .
1. Compute the correlation between Z and X.
Answer: 𝜌(𝑍, 𝑋) = 1. Explain;
2. Compute the correlation between Z and Y. Are Z and Y independent? Explain.
Answer: 𝜌(𝑍, 𝑋) = 0. Z and Y are not independent;
3. Generate 1000 values of Z in A2:A1001: = 𝑁𝑂𝑅𝑀. 𝑆. 𝐼𝑁𝑉(𝑅𝐴𝑁𝐷( )).
Generate the corresponding values of X and Y in columns B and C.
Compute the sample correlation between Z and X and between Z and Y.
Compare the sample correlations with the exact correlations.
Assignment PA176
Random variable Z is uniformly distributed on the interval (-1 1).
Let 𝑋 = 2 ∗ 𝑍 and π‘Œ = 𝑍 2 .
Compute the covariance and the correlation between Z and X. Compute the covariance and the
correlation between Z and Y.
Generate 1000 values of Z, X and Y.
Compute the sample covariances and correlations between Z and X and between Z and Y.
Compare the sample estimates with the exact theoretical values.
213
Problem PP177
For random variables X and Y it holds that 𝐸(𝑋) = 𝐸(π‘Œ) = πœ‡, π‘£π‘Žπ‘Ÿ(𝑋) = πœŽπ‘‹2 , π‘£π‘Žπ‘Ÿ(π‘Œ) = πœŽπ‘Œ2 and
π‘π‘œπ‘£π‘Žπ‘Ÿ(𝑋, π‘Œ) = πœŽπ‘‹π‘Œ . Assume that the expected value πœ‡ is not known but that the variances and
the covariance are known. We estimate the expected value by π‘Š = π‘Žπ‘‹ + (1 − π‘Ž)π‘Œ where a is a
constant to be determined.
1. Show that 𝐸(π‘Š) = πœ‡ for any value of a (the expected value of the estimate is “correct”);
2. Determine the value of a for which π‘£π‘Žπ‘Ÿ(π‘Š) is minimal.
Answer: π‘Ž = (πœŽπ‘Œ2 − πœŽπ‘‹π‘Œ )⁄(πœŽπ‘‹2 + πœŽπ‘Œ2 − 2 ∗ πœŽπ‘‹π‘Œ );
3. Assume the joint density of (𝑋, π‘Œ) is bivariate normal with parameters πœ‡ = 10, πœŽπ‘‹2 = 4,
πœŽπ‘Œ2 = 1, πœŽπ‘‹π‘Œ = −1. It follows that the correlation 𝜌(𝑋, π‘Œ) = −0.5.
Report the value of the correlation in cell A1, the value of the covariance in cell B1.
Generate 1000 values of X in cells A2:A1001: = 𝑁𝑂𝑅𝑀. 𝐼𝑁𝑉(𝑅𝐴𝑁𝐷( ); 10; 2).
Generate 1000 values of Y in cells B2:B1001. Example for cell B2: =
𝑁𝑂𝑅𝑀. 𝐼𝑁𝑉 (𝑅𝐴𝑁𝐷( ); 10 + $𝐴$1 ∗
(𝐴2−10)
2
; 𝑆𝑄𝑅𝑇(1 − $𝐴$1 ∗ $𝐴$1)).
Input different values of a in cells C1:K1: -2, -1.5, -1, -.5, 0, .5, 1, 1.5, 2. In cell L1 input
the value of a derived in Step 2: = (1 − $𝐡$1)⁄(4 + 1 − 2 ∗ $𝐡$1).
Compute the values of W for the different values of a in columns D to M. Example for
cell D2: = 𝐷$1 ∗ $𝐴2 + (1 − 𝐷$1) ∗ $𝐡2 and likewise for cells D3:D1001 and columns
E to M.
Repeat the values of a in cells O1:X1. Compute the averages of the values of W in cells
O2:X2 for the different values of a. Compare the averages with the result in Step 1.
Compute the sample variances of the values of W in cells O3:X3 for the different values
of a. For which value of a is the sample variance minimal?
Compare this result to the conclusion drawn in Step 2;
4. Change the value of the correlation (and the covariance) in cell A1 (B1) to different
values and always check the results in O2:X2 and O3:X3.
Assignment PA177
Random variables S and V are derived from random variables X and Y: 𝑆 = 𝑋 + π‘Œ, 𝑉 = 𝑋 − π‘Œ.
Show that π‘π‘œπ‘£π‘Žπ‘Ÿ(𝑆, 𝑉) = π‘£π‘Žπ‘Ÿ(𝑋) − π‘£π‘Žπ‘Ÿ(π‘Œ).
Generate 1000 values of X, Y, S and V. Assume that (𝑋, π‘Œ) are bivariate normal with parameters
𝐸(𝑋) = 10, π‘£π‘Žπ‘Ÿ(𝑋) = 1, 𝐸(π‘Œ) = 20, π‘£π‘Žπ‘Ÿ(π‘Œ) = 4, 𝜌(𝑋, π‘Œ) = 0.5 and compute the sample
covariance between S and V. Compare with π‘π‘œπ‘£π‘Žπ‘Ÿ(𝑆, 𝑉).
214
Problem PP178
Random variable X is uniformly distributed over the interval (0 1).
1. Compute π‘π‘œπ‘£π‘Žπ‘Ÿ(𝑋, 𝑋 π‘˜ ) for any constant π‘˜ > 0.
Answer: π‘π‘œπ‘£π‘Žπ‘Ÿ(𝑋, 𝑋 π‘˜ ) = π‘˜⁄(2 ∗ (π‘˜ + 1) ∗ (π‘˜ + 2));
2. Derive the value of k for which the covariance is maximal.
Answer: π‘˜ = √2;
3. Graph the covariance as a function of k for k in the interval (0 12);
4. Compute π‘π‘œπ‘Ÿπ‘Ÿπ‘’π‘™(𝑋, 𝑋 π‘˜ ) for any π‘˜ > 0.
Answer: π‘π‘œπ‘Ÿπ‘Ÿπ‘’π‘™(𝑋, 𝑋 π‘˜ ) = √3 ∗ (2π‘˜ + 1)⁄(π‘˜ + 2);
5. Derive the value of k for which the correlation is maximal.
Answer: π‘˜ = 1;
6. Graph the correlation as a function of k for k in the interval (0 12);
7. Generate values of X in the range A2:A1001. Compute the values of 𝑋 π‘˜ for
π‘˜ = 0.5, 2, 3, 4, 5 in columns B, C, D, E, F.
Compute the sample covariances and correlations between X and 𝑋 π‘˜ and compare with
the exact values derived in Steps 1 and 4.
Assignment PA178
A random variable X is uniformly distributed over the interval (1 2). A square has a side of
length X.
Compute the covariance and the correlation between the circumference and the area of the
square.
Generate 1000 values of X. Compute the circumference and the area of the 1000 squares.
Compute the sample covariance and the sample correlation and compare to the exact values.
215
Problem PP179
For any constant a, −1 < π‘Ž < 1, and 𝑍1 and 𝑍2 independent standard normal random variables,
1+π‘Ž
consider random variables X and Y: 𝑋 = √
2
1−π‘Ž
∗ 𝑍1 + √
2
1+π‘Ž
∗ 𝑍2 , π‘Œ = √
2
1−π‘Ž
∗ 𝑍1 − √
2
∗ 𝑍2 .
1. Compute the covariance and the correlation between X and Y.
Answer: π‘π‘œπ‘£π‘Žπ‘Ÿ(𝑋, π‘Œ) = π‘Ž, π‘π‘œπ‘Ÿπ‘Ÿπ‘’π‘™(𝑋, π‘Œ) = π‘Ž;
2. Derive the joint pdf of X and Y.
Answer: bivariate normal with 𝐸(𝑋) = 𝐸(π‘Œ) = 0, π‘£π‘Žπ‘Ÿ(𝑋) = π‘£π‘Žπ‘Ÿ(π‘Œ) = 1, 𝜌(𝑋, π‘Œ) = π‘Ž;
3. Report a value of a in cell A1, e.g. π‘Ž = 0.8.
Generate 1000 values of 𝑍1 and 𝑍2 in cells A3:A1002 and B3:B1002. Example for cell
A3: = 𝑁𝑂𝑅𝑀. 𝑆. 𝐼𝑁𝑉(𝑅𝐴𝑁𝐷( )) and likewise for cells A4:A1002 and column B.
Compute the values of X and Y in columns C and D for the value of a in cell A1. Example
for cell C3: = 𝑆𝑄𝑅𝑇((1 + $𝐴$1)⁄2) ∗ 𝐴3 + 𝑆𝑄𝑅𝑇((1 − $𝐴$1)⁄2) ∗ 𝐡3 and likewise
for cells C4:C1002 and column D.
Compute the sample covariance between X and Y and compare with the value in cell A1.
Change the value in cell A1 to .2, to 0, to -.5.
Assignment PA179
Let 𝑍1 and 𝑍2 be independent standard normal random variables.
For constants π‘š1 , π‘š2 , 𝑐1 , 𝑐2 π‘Žπ‘›π‘‘ 0 < 𝜌 < 1, let
𝑋 = π‘š1 + 𝑐1 ∗ 𝑍1 and π‘Œ = π‘š2 + 𝑐2 ∗ (𝜌 ∗ 𝑍1 + √1 − 𝜌2 ∗ 𝑍2 ).
Compute the covariance and the correlation between X and Y.
Derive the joint pdf of X and Y.
Generate 1000 values of 𝑍1 , 𝑍2 , X and Y for π‘š1 = 2, π‘š2 = 4, 𝑐1 = −3, 𝑐2 = 2, 𝜌 = 0.5.
Compute the sample covariance and the sample correlation between X and Y.
Compare to the exact theoretical values.
216
Problem PP180
Consider the random variables X and Y in Problem PP167.
1. Compute the covariance between X and Y.
Answer: π‘π‘œπ‘£π‘Žπ‘Ÿ(𝑋, π‘Œ) = 1⁄πœ†2;
2. Compute the correlation between X and Y.
Answer: π‘π‘œπ‘Ÿπ‘Ÿπ‘’π‘™(𝑋, π‘Œ) = √2⁄2;
3. Compute 𝐸(πœ†π‘‹ − π‘Œ) and π‘£π‘Žπ‘Ÿ(πœ†π‘‹ − π‘Œ).
Answer: 𝐸(πœ†π‘‹ − π‘Œ) = (πœ† − 2)⁄πœ†, π‘£π‘Žπ‘Ÿ(πœ†π‘‹ − π‘Œ) = 1 + 2⁄πœ†2 − 2⁄πœ† ;
4. To simulate the above results, report a value of λ in cell A1, say πœ† = 2.
Generate 1000 values of X (Y) in cells A3:A1002 (B3:B1002).
Example for cell A3: = 𝐺𝐴𝑀𝑀𝐴. 𝐼𝑁𝑉(𝑅𝐴𝑁𝐷( ); 1; 1⁄$𝐴$1).
Example for cell B3:= 𝐴3 − (1⁄$𝐴$1) ∗ 𝑙𝑛(𝑅𝐴𝑁𝐷( )).
Compute the values of πœ†π‘‹ − π‘Œ in cells C3:C1002.
Compute the sample covariance and sample correlation between X and Y. Compare with
the values in Step 1 and 2.
Compute the sample mean and the sample variance of πœ†π‘‹ − π‘Œ in column C and compare
with the values derived in Step 3.
Assignment PA180
Consider the random variables in Problem PA167.
Compute the covariance and the correlation between X and Y.
Generate 1000 values of Y and X, compute the sample covariance and sample correlation and
compare with the exact theoretical values.
217
Problem PP181
A machine produces parts which can be one of four different kinds: the part satisfies all
requirements (probability is 0.8), it can be reworked and then satisfies the requirements
(probability is 0.05), it has insufficient length and is total loss (probability is 0.1) or it has
insufficient width and is total loss (probability is 0.05).
The selling price of the part is €18, the unit production cost is €10, the cost of reworking a part is
€5.
A lot of 1000 parts will be produced today. Let S be the number of parts that satisfy all
requirements, R the number of parts to be reworked, L the number of parts of insufficient length
and W the number of parts of insufficient width.
1. Compute the expected value and the variance of S and R.
Answer: 𝐸(𝑆) = 800, 𝐸(𝑅) = 50, π‘£π‘Žπ‘Ÿ(𝑆) = 160, π‘£π‘Žπ‘Ÿ(𝑅) = 47.5;
2. Compute the covariance and correlation between S and R.
Answer: π‘π‘œπ‘£π‘Žπ‘Ÿ(𝑆, 𝑅) = −40, π‘π‘œπ‘Ÿπ‘Ÿπ‘’π‘™(𝑆, 𝑅) = −.4588;
3. Express the total profit of the lot P as a function of S and R.
Answer: 𝑃 = 18 ∗ 𝑆 + 13 ∗ 𝑅 − 10000;
4. Compute the expected value of P.
Answer: 𝐸(𝑃) = 5050;
5. Compute the standard deviation of P.
Answer: πœŽπ‘ƒ = 202.8485;
6. To simulate the problem, generate 1000 random numbers in the range A2:A1001.
Generate the quality of 1000 parts in cells B2:B1001. Example for cell B2:
= 𝐼𝐹 (𝐴2 < .8; "𝑆";𝐼𝐹(𝐴2 < .85; "𝑅";𝐼𝐹(𝐴2 < .95; "𝐿";"π‘Š"))) and similarly for cells
B3:B1001.
Compute the profit made on the parts in cells C2:C1001. Example for cell C2:
= 𝐼𝐹(𝐡2 = "𝑆";8; 𝐼𝐹(𝐡2 = "𝑅";3; −10)) and similarly for cells C3:C1001.
Compute the total number of S-parts in cell E2, the total number of R-parts in cell F2, the
total number of L-parts in cell G2, the total number of W-parts in cell H2 and the total
profit of the 1000 parts in cell I2.
Use the TABLE-option of Excel to generate these values 1000 times.
Compute the sample averages and sample variances of S and R and compare with the
values computed in Step 1.
Compute the sample covariance and correlation between S and R and compare with the
values in Step 2.
Compute the sample mean of profits and compare with the expected value computed in
Step 4.
Compute the sample standard deviation of profit and compare with the standard deviation
computed in Step 5.
218
Assignment PA181
A die is rolled 60 times. Let X be the number of times an even number is rolled and Y the number
of times the outcome 1 is obtained.
Compute the expected values and variances of X and Y, compute the covariance and the
correlation between X and Y.
Compute the expected value and the variance of 𝑋 + π‘Œ using the previous results.
Compute again the expected value and the variance of 𝑋 + π‘Œ using results from a binomial
process.
Generate 60 rolls of a die.
Compute the value of X, Y and 𝑋 + π‘Œ and use the TABLE-option to repeat this process 1000
times.
Compute sample estimates of the expected values, variances, covariance and correlation
computed above and compare the sample estimates to the exact values.
219
Problem PP182
Two risky assets have random returns 𝑅1 and 𝑅2 over the next period.
Let πœ‡1 = 𝐸(𝑅1 ), πœ‡2 = 𝐸(𝑅2 ) be the expected returns, 𝜎1 = 𝑠𝑑𝑑𝑒𝑣(𝑅1 ), 𝜎2 = 𝑠𝑑𝑑𝑒𝑣(𝑅2 ) be the
standard deviations of the returns and 𝜌12 = π‘π‘œπ‘Ÿπ‘Ÿπ‘’π‘™(𝑅1 , 𝑅2 ), the correlation between both
returns.
A portfolio P is built by investing a capital of 1 for a proportion π‘Ž1 in asset 1 and a proportion
π‘Ž2 = 1 − π‘Ž1 in asset 2 (no short selling, so 0 ≤ π‘Ž1 ≤ 1).
1. Derive the expected return and the variance of the portfolio.
Answer:
πœ‡(𝑃) = π‘Ž1 ∗ πœ‡1 + (1 − π‘Ž1 ) ∗ πœ‡2 ,
𝜎 2 (𝑃) = π‘Ž12 ∗ 𝜎12 + (1 − π‘Ž1 )2 ∗ 𝜎22 + 2 ∗ π‘Ž1 ∗ (1 − π‘Ž1 ) ∗ 𝜌12 ∗ 𝜎1 ∗ 𝜎2 ;
2. Derive the proportions π‘Ž1π‘š and π‘Ž2π‘š to be invested in both assets when minimizing the risk
(risk being measured by the variance of the portfolio).
𝜎2 −𝜌
∗𝜎1 ∗𝜎2
12
Answer: π‘Ž1π‘š = 𝜎2 +𝜎2 2 −2∗𝜌
1
2
12 ∗𝜎1 ∗𝜎2
, possibly corrected to 0 when the ratio is negative and to
1 when the ratio is larger than 1 (this correction is not required when short selling is
allowed), π‘Ž2π‘š = 1 − π‘Ž1π‘š ;
3. Assume πœ‡1 = 0.14, πœ‡2 = 0.08, 𝜎1 = 0.2, 𝜎2 = 0.15, 𝜌12 = 0. Report these values in
cells A3:E3. For all values of π‘Ž1 between 0 and 1 in steps of 0.05 (cells A5:A25),
compute the expected return of the portfolio in cells B5:B25, the standard deviation of the
portfolio in cells C5:C25 using the results in Step 1 (use the values in cells A3:E3).
Use a scatter plot to graph the expected value (on the vertical axis) versus the standard
deviation (on the horizontal axis);
4. For the parameter values in Step 3, compute the portfolio π‘ƒπ‘š with minimal variance (also
minimal standard deviation) using the result in Step 2.
Answer: π‘Ž1π‘š = 0.36, π‘Ž2π‘š = 0.64, 𝐸(π‘ƒπ‘š ) = 0.1016, 𝜎 2 (π‘ƒπ‘š ) = 0.0144, 𝜎(π‘ƒπ‘š ) = 0.12.
5. Assume a risk averse investor (preferring less risk for the same expected return and more
expected return for the same risk), indicate in the graph in Step 3 the portfolios that are
not dominated by other possible portfolios (the so called efficient frontier);
6. Use the Solver to compute the minimal variance portfolio as already derived in Step 4;
7. Compute the portfolio with minimal risk when requiring an expected profit of at least
0.11.
Answer: π‘Ž1 = .5, π‘Ž2 = .5, 𝐸(𝑃) = 0.11, 𝜎 2 (𝑃) = 0.125, 𝜎(𝑃) = 0.3535;
8. Compute the portfolio with minimal risk when requiring an expected profit of at least
0.10.
Answer: π‘Ž1 = .36, π‘Ž2 = .64, 𝐸(𝑃) = 0.1016, 𝜎 2 (𝑃) = 0.0144, 𝜎(𝑃) = 0.12;
220
9. Use the Solver to derive the portfolios computed in Steps 7 and 8;
10. Change the value of the correlation in cell E3 to .25, .5, 1, -.25, -.5, -1 and check how the
graph derived in Step 3 changes;
11. For values of the correlation between -1 and +1, steps of 0.1 (cells A32:A52), use Excel
to compute the value of π‘Ž1 and the standard deviation of the minimal variance portfolio.
Graph the standard deviation as a function of the correlation. Justify intuitively the shape
of this graph;
12. Assume both returns are normally distributed. Compute the portfolio of maximal expected
return but for which the probability of a loss of at least 0.08 is limited to 0.1. Use both
hand computation and the Solver.
Answer (rounded): π‘Ž1 = .796, 𝐸(𝑃) = .1278, 𝑠𝑑𝑑𝑒𝑣(𝑃) = 0.1621.
Assignment PA182
Perform Steps 1, 2, 3, 5, 7 and 8 for the case of one risky asset (πœ‡1 = .15, 𝜎1 = .25) and one riskfree asset (πœ‡2 = .06, 𝜎2 = 0). In Step 12 assume a loss of at least .15 limited to a probability of
0.01.
221
Problem PP183
Three assets have random returns 𝑅1 , 𝑅2 and 𝑅3 over the next period. Expected returns are 0.1,
0.2 and -0.02. Variances are 0.015, 0.02 and 0.005. Correlations are: 𝜌12 = 0.5, 𝜌13 = −0.4 and
𝜌23 = −0.2.
Report the expected values in cells B2:D2, the variances in cells B3:D3, the correlation matrix in
the range B7:D9.
1. Compute the covariance matrix in the range G7:I9.
Answer:
.015
.00866
-.00346
.02
-.002
.005
2. Consider all possible portfolios of the three assets (steps of .05) in cells A13:C242 (no
short selling). For example start with 0, 0, 1 in cells A13:C13 (all funds invested in asset
3), 0, 0.05, 0.95 in cells A14:C14 (5% invested in asset 2, 95% in asset 3), etc. Compute
the expected returns of all portfolios in column D. Example for cell D13:
= 𝐴13 ∗ $𝐡$2 + 𝐡13 ∗ $𝐢$2 + 𝐢13 ∗ $𝐷$2.
Compute the standard deviation of all portfolios in column E. Example for cell E13:
= 𝑆𝑄𝑅𝑇(𝐴13 ∗ 𝐴13 ∗ $𝐡$3 + 𝐡13 ∗ 𝐡13 ∗ $𝐢$3 + 𝐢13 ∗ 𝐢13 ∗ $𝐷$3 + 2 ∗ 𝐴13 ∗
𝐡13 ∗ $𝐺$8 + 2 ∗ 𝐴13 ∗ 𝐢13 ∗ $𝐺$9 + 2 ∗ 𝐡13 ∗ 𝐢13 ∗ $𝐻$9);
3. Graph a Scatter Plot (Scatter with only markers) of the standard deviation (horizontal
axis) versus the expected value (vertical axis). The efficient portfolios can be clearly seen
on the graph;
4. Underneath the graph put three fractions adding up to 1 in cells H38:J38, e.g. .7, .1, .2.
Compute the expected value and the standard deviation of the portfolio in cells K38:L38
by copying any of the cells in column D in cell K38 and any of the cells in column E in
cell L38. Compute the sum of the fractions in cell M38: = π‘†π‘ˆπ‘€(𝐻38: 𝐽38).
Construct a horizontal line segment from the point (0 =K38) to the point (=L38 =K38) as
follows: 0 in cell H40, =K38 in cell I40, =L38 in cell H41, =K38 in cell I41.
Add the two series in cells H40:I41 to the graph (as Scatter with straight lines).
Construct a vertical line segment from the point (=L38 0) to the point (=L38 K38)
similar to the construction of the horizontal segment.
Notice that the line segments join in the point that represents the standard deviation and
expected value of the portfolio with fractions in H38:J38.
Change the fractions and check how the graph changes;
5. Use the Solver to compute the portfolio with minimal standard deviation (minimal risk) in
cell L38. Allow cells H38:J38 to change. Check the graph.
Answer: 𝜎(𝑃) = 0.0477 (cell L38); πœ‡(𝑃) = 0.0264 (cell K38); fractions to be invested
(cells H38:J38): 0.2688, 0.0641, 0.6671;
222
6. Use the Solver to minimize the standard deviation of the portfolio (cell L38) under the
restriction that the expected return (cell K38) be at least 0.12. Check the graph.
Answer: : 𝜎(𝑃) = 0.086; πœ‡(𝑃) = 0.12, fractions to be invested (cells H38:J38): 0.173,
0.542, 0.285;
7. Change the expected return required in Step 6 to different values. Notice that when an
expected return smaller than 0.02636 (expected return corresponding to the portfolio with
minimal risk) is required, then the solution is the minimal risk portfolio.
Assignment PA183
Keep the data above with the following changes: the variance of asset 1 is 0 (asset with no risk),
the correlations between the return of asset 1 with both other returns are 0.
Repeat Steps 1 to 7 above. What does the efficient set of non-dominated portfolios look like?
223
Problem PP184
N assets have random returns 𝑅1 , 𝑅2 , … , 𝑅𝑁 over the next period. Expected returns are
𝝁𝑇 = [πœ‡1 πœ‡2 … πœ‡π‘ ]. Standard deviations are 𝜎1 , 𝜎2 , … , πœŽπ‘ . Denote the covariance matrix by 𝛀.
A capital of 1 is available to invest in the assets. Let the proportions invested in the assets be
denoted as 𝒂𝑇 = [π‘Ž1 π‘Ž2 … π‘Žπ‘ ] with ∑𝑁
1 π‘Žπ‘– = 1.
1. Compute the expected return and the variance of the portfolio (use matrix notation).
Answer: 𝐸(𝑃) = 𝒂𝑇 𝝁, 𝜎 2 (𝑃) = 𝒂𝑇 𝛀𝒂;
2. Use the data and the set-up of the Excel sheet in Problem PP183, first 9 lines. Assume
fractions π‘Žπ‘‡ = [. 1 .6 .3] in cells H12:J12. Compute the expected value of the portfolio in
cell G14 using the array instruction: = π‘€π‘€π‘ˆπΏπ‘‡(𝐻12: 𝐽12; 𝑇𝑅𝐴𝑁𝑆𝑃𝑂𝑆𝐸(𝐡2: 𝐷2)).
Compute the variance in cell G15 using the array instruction:
= π‘€π‘€π‘ˆπΏπ‘‡(π‘€π‘€π‘ˆπΏπ‘‡(𝐻12: 𝐽12; 𝐺7: 𝐼9); 𝑇𝑅𝐴𝑁𝑆𝑃𝑂𝑆𝐸(𝐻12: 𝐽12)).
Compare expected value and variance with the values computed in Step 2 of Problem
PP183 (note: the standard deviation was computed there, not the variance);
3. Derive the weights a for the portfolio with minimal variance (short selling allowed).
Compute its expected value and variance.
Answer: 𝒂 = 𝛀−1 𝟏⁄1𝑇 𝛀−1 𝟏
(1 is a N dimensional vector of ones),
𝐸(𝑃) = πŸπ‘‡ 𝛀−1 𝝁⁄πŸπ‘‡ 𝛀−1 𝟏, 𝜎 2 (𝑃) = 1⁄πŸπ‘‡ 𝛀−1 𝟏 ;
4. To compute the minimal variance portfolio, its expected value and variance, use the
results of Step 3 as follows: first compute the inverse covariance matrix in the range
L7:N9. To do so, select cells L7:N9 and use the array instruction: = 𝑀𝐼𝑁𝑉𝐸𝑅𝑆𝐸(𝐺7: 𝐼9).
Report the values 1, 1 and 1 in cells H17:J17. Select cells G18:G20 and compute the
weights of the minimal variance portfolio using the array instruction: =
π‘€π‘€π‘ˆπΏπ‘‡(𝐿7: 𝑁9; 𝑇𝑅𝐴𝑁𝑆𝑃𝑂𝑆𝐸(𝐻17: 𝐽17))⁄π‘€π‘€π‘ˆπΏπ‘‡(π‘€π‘€π‘ˆπΏπ‘‡(𝐻17: 𝐽17; 𝐿7: 𝑁9); 𝑇𝑅𝐴𝑁𝑆𝑃𝑂𝑆𝐸(𝐻17: 𝐽17))
Compute the expected value of the minimal variance portfolio in cell G22 (array
instruction):
= π‘€π‘€π‘ˆπΏπ‘‡(π‘€π‘€π‘ˆπΏπ‘‡(𝐻17: 𝐽17; 𝐿7: 𝑁9); 𝑇𝑅𝐴𝑁𝑆𝑃𝑂𝑆𝐸(𝐡2: 𝐷2))⁄π‘€π‘€π‘ˆπΏπ‘‡(π‘€π‘€π‘ˆπΏπ‘‡(𝐻17: 𝐽17; 𝐿7: 𝑁9); 𝑇𝑅𝐴𝑁𝑆𝑃𝑂𝑆𝐸(𝐻17: 𝐽17))
Use a similar instruction to compute the variance in cell G23:
= 1⁄π‘€π‘€π‘ˆπΏπ‘‡(π‘€π‘€π‘ˆπΏπ‘‡(𝐻17: 𝐽17; 𝐿7: 𝑁9); 𝑇𝑅𝐴𝑁𝑆𝑃𝑂𝑆𝐸(𝐻17: 𝐽17));
5. Use the Solver to compute the minimal variance portfolio. Work as follows: any weights
in H25:J25. Cell K25: = π‘†π‘ˆπ‘€(𝐻25: 𝐽25).
Cell G27: = π‘€π‘€π‘ˆπΏπ‘‡(π‘€π‘€π‘ˆπΏπ‘‡(𝐻25: 𝐽25; 𝐺7: 𝐼9); 𝑇𝑅𝐴𝑁𝑆𝑃𝑂𝑆𝐸(𝐻25: 𝐽25)), the
variance of the portfolio. Use the Solver to minimize cell G27, restriction that cell K25
equals 1. Compute the expected return of the minimal variance portfolio in cell G28.
Compare expected value and variance with the same values computed in Step 4;
6. Derive the weights a for the portfolio with minimal variance among all portfolio’s with an
expected return of at least πœ‡π‘šπ‘–π‘› (short selling allowed).
Answer: Let 𝜢 = 𝛀−1 𝝁, 𝜷 = 𝛀−1 𝟏, 𝑇1 = 𝝁𝑇 𝜢, 𝑇2 = πŸπ‘‡ 𝜷, 𝑇3 = 𝝁𝑇 𝜷.
224
Then,
1
𝒂 = 𝑇 𝑇 −𝑇 2 [𝑇1 𝜷 − 𝑇3 𝜢 + πœ‡π‘šπ‘–π‘› (𝑇2 𝜢 − 𝑇3 𝜷)];
1 2
3
7. On the Excel sheet compute the vector values of 𝜢 and 𝜷 in cells G31:G33 and H31:H33,
the values of the constants 𝑇1 , 𝑇2 π‘Žπ‘›π‘‘ 𝑇3 in cells G36:I36. In cells G40:G58 input values
of πœ‡π‘šπ‘–π‘› : -.02, -.01, 0, .0125, .025, .0375, …, 0.2. Select cells H40:J40 and compute the
value of the vector 𝒂𝑇 for πœ‡π‘šπ‘–π‘› = −.02 (array instruction):
= (1⁄($𝐺$36 ∗ $𝐻$36 − $𝐼$36 ∗ $𝐼$36)) ∗ ($𝐺$36 ∗ 𝑇𝑅𝐴𝑁𝑆𝑃𝑂𝑆𝐸($𝐻$31: $𝐻$33) − $𝐼$36 ∗
𝑇𝑅𝐴𝑁𝑆𝑃𝑂𝑆𝐸($𝐺$31: $𝐺$33) + 𝐺40 ∗ ($𝐻$36 ∗ 𝑇𝑅𝐴𝑁𝑆𝑃𝑂𝑆𝐸($𝐺$31: $𝐺$33) − $𝐼$36 ∗
value of 𝒂𝑇 compute the expected value of the
portfolio in cell K40 (should be -.02), its variance in cell L40 (.003531) and its standard
deviation in cell M40. Drag cells H40:M40 to line 58. For minimal expected values as
given in cells G40:G58 we have available the efficient portfolios (with minimal standard
deviation). Make a scatter plot (with full lines) of the expected value (vertical axis) versus
the standard deviation (horizontal axis);
𝑇𝑅𝐴𝑁𝑆𝑃𝑂𝑆𝐸($𝐻$31: $𝐻$33))). Using this
8. Use the Solver to compute the efficient portfolio for a minimal expected return of 0.125.
Report fractions adding up to 1 in cells G61:G63. In cell G64: = π‘†π‘ˆπ‘€(𝐺61: 𝐺64).
Compute the expected return in cell I61: = π‘€π‘€π‘ˆπΏπ‘‡(𝐡2: 𝐷2; 𝐺61: 𝐺63), the variance in
cell I62: = π‘€π‘€π‘ˆπΏπ‘‡(π‘€π‘€π‘ˆπΏπ‘‡(𝑇𝑅𝐴𝑁𝑆𝑃𝑂𝑆𝐸(𝐺61: 𝐺63; 𝐺7: 𝐼9); 𝐺61: 𝐺63)). Minimize
cell I62, requiring cell G64 to be 1 and cell I61 at least 0.125. Change the value of the
minimal expected return to 0.02 and solve the problem again (notice some short selling).
Using the Solver you can forbid short selling by requiring all fractions to be nonnegative.
Assignment PA184
Consider 4 assets with expected returns 𝝁 = [. 1 .3 .4 .2] and standard deviations
𝝈 = [0 .05 .1 .07] (asset 1 is a non-risk asset). Correlations are: 𝜌23 = .5, 𝜌24 = −.4, 𝜌34 =
−.2. Compute the covariance matrix of the returns of assets 2, 3 and 4. Compute the expected
return, the variance and the standard deviation of a portfolio with fractions .2, .3, .4 and .1.
Use the Solver to compute the optimal portfolio (minimal variance) for expected values of at least
.1, .125, .15, …, .4 (short selling allowed). Compute the expected value, the variance and the
standard deviation for each portfolio.
Next compute optimal portfolio’s using only the risky assets 2, 3 and 4 for the same expected
returns .1, .125, …, .4. For these portfolios assume it is required that the restriction on the
expected value is exactly equal to (rather than at least equal to). Construct in the same graph
(Scatter plot with full lines) the expected values (vertical axis) as a function of the standard
deviations (horizontal axis) for both types of portfolios (with and without the no-risk asset).
Notice how the efficient set of the four asset model is a straight line tangent to the efficient set of
the three asset model). Denote the vector of expected returns of the risky assets by 𝝁𝑅 and the
return of the non-risky asset by πœ‡π‘π‘… . Then it can be shown that the weights of the tangency
portfolio are given by 𝛀−1 (𝝁𝑅 − πœ‡π‘π‘… 𝟏)⁄1𝑇 𝛀−1 (𝝁𝑅 − πœ‡π‘π‘… 𝟏). Compute these weights and derive
the expected return, the variance and the standard deviation of the tangent portfolio.
Download