CS代考程序代写 University of California, Los Angeles Department of Statistics

University of California, Los Angeles Department of Statistics
Statistics 100B Instructor: Nicolas Christou
Covariance and correlation
Let random variables X, Y with means μX,μY respectively. The covariance, denoted with cov(X, Y ), is a measure of the association between X and Y .
Definition:
σXY =cov(X,Y)=E(X−μX)(Y −μY)
Note: If X, Y are independent then E(XY ) = (EX)E(Y ) Therefore cov(X, Y ) = 0.
Let W, X, Y, Z be random variables, and a, b, c, d be constants, • Find cov(a+X,Y)
1

• Find cov(aX, bY )
• Findcov(X,Y +Z)
• Find cov(aW +bX,cY +dZ)
• Important:
var(X + Y ) = var(X) + var(Y ) + 2cov(X, Y )
Proof:
2

• Find var(aX + bY )
• In general: Let X1,X2,···,Xn be random variables, and a1,a2,···,an be constants. Find the variance of the linear combination Y = a1X1 + a2X2 + · · · + anXn.
• Example: Let X1, X2, X3 be random variables with EX1 = 1, EX2 = 2, EX3 = −1,var(X1) = 1,var(X2) = 3,var(X3) = 5,cov(X1,X2) = −0.4,cov(X1,X3) = 0.5, cov(X2, X3) = 2. Let U = X1 − 2X2 + X3. Find (a) E(U), and (b) var(U).
3

However, the covariance depends on the scale of measurement and so it is not easy to say whether a particular covariance is small or large. The problem is solved by standardize the value of covariance (divide it by σXσY ), to get the so called coefficient of correlation ρXY .
ρ=cov(X,Y), Always,−1≤ρ≤1,(seeproofbelow). σX σY
cov(X, Y ) = ρσX σY
If X, Y are independent then · · ·
Show that −1 ≤ ρ ≤ 1:
Let X, Y be random variables with variances σX2 ,σY2 respectively. Examine the following random expressions:
X+Y X−Y
σX σY
σX σY
4

Example:
X and Y are random variables with joint probability density function fXY(x,y)=x+y,0≤x≤1,0≤y≤1. FindμX,μY,σX2 ,σY2,cov(X,Y),ρXY.
5

Example:
Let X1, X2, · · · , Xn be independent and identically distributed random variables having vari- anceσ2. Showthatcov(Xi −X ̄,X ̄)=0.
6

Portfolio risk and return
An investor has a certain amount of dollars to invest into two stocks (IBM and TEXACO). A portion of the available funds will be invested into IBM (denote this portion of the funds with a) and the remaining funds into TEXACO (denote it with b) – so a + b = 1. The resulting portfolio will be aX + bY where X is the monthly return of IBM and Y is the monthly return of T EXACO. The goal here is to find the most efficient portfolios given a certain amount of risk. Using market data from January 1980 to February 2001 we compute that E(X) = 0.010, E(Y ) = 0.013, V ar(X) = 0.0061, V ar(Y ) = 0.0046, and Cov(X, Y ) = 0.00062.
We first want to minimize the variance of the portfolio. This will be: Minimize Var(aX + bY )
Or
subjectto a+b=1
Minimize a2V ar(X) + b2V ar(Y ) + 2abCov(X, Y ) subjectto a+b=1
Therefore our goal is to find a and b, the percentage of the available funds that will be invested in each stock. Substituting b = 1 − a into the equation of the variance we get
a2V ar(X) + (1 − a)2V ar(Y ) + 2a(1 − a)Cov(X, Y )
To minimize the above exression we take the derivative with respect to a, set it equal to zero and solve for a. The result is:
V ar(Y ) − Cov(X, Y )
V ar(X) + V ar(Y ) − 2Cov(X, Y )
V ar(X) − Cov(X, Y )
V ar(X) + V ar(Y ) − 2Cov(X, Y )
a=
and therefore b=
The values of a and b are:
the variance of the portfolio will be minimum and equal to:
V ar(0.42X + 0.58Y ) = 0.422(0.0061) + 0.582(0.0046) + 2(0.42)(0.58)(0.00062) = 0.002926.
The corresponding expected return of this porfolio will be: E(0.42X + 0.58Y ) = 0.42(0.010) + 0.58(0.013) = 0.01174.
We can try many other combinations of a and b (but always a + b = 1) and compute the risk and return for each resulting portfolio. This is shown in the table below and the graph of return against risk on the next page.
0.0046 − 0.0062 0.0061 + 0.0046 − 2(0.00062)
⇒ a = 0.42.
and b = 1 − a = 1 − 0.42 ⇒ b = 0.58. Therefore if the investor invests 42% of the available funds into IBM and the remaining 58% into T EXACO
a =
a b
1.00 0.00 0.95 0.05 0.90 0.10 0.85 0.15 0.80 0.20 0.75 0.25 0.70 0.30 0.65 0.35 0.60 0.40 0.55 0.45 0.50 0.50 0.42 0.58 0.40 0.60 0.35 0.65 0.30 0.70 0.25 0.75 0.20 0.80 0.15 0.85 0.10 0.90 0.05 0.95 0.00 1.00
Risk 0.006100 0.005576 0.005099 0.004669 0.004286 0.003951 0.003663 0.003423 0.003230 0.003084 0.002985 0.002926 0.002930 0.002973 0.003063 0.003201 0.003386 0.003619 0.003899 0.004226 0.004600
Return 0.01000 0.01015 0.01030 0.01045 0.01060 0.01075 0.01090 0.01105 0.01120 0.01135 0.01150 0.01174 0.01180 0.01195 0.01210 0.01225 0.01240 0.01255 0.01270 0.01285 0.01300
7

Portfolio possibilities curve


● ●

















0.055 0.060 0.065 0.070 0.075
Risk (portfolio standard deviation)
8
Expected return
0.0100 0.0105 0.0110 0.0115 0.0120 0.0125 0.0130

Efficient frontier with three stocks
> summary(returns)
ribm
Min. :-0.2264526
1st Qu.:-0.0515524
Median :-0.0089916
Mean : 0.0003073
3rd Qu.: 0.0462550
Max. : 0.3537987
> cov(returns)
ribm
ribm 9.930174e-03 0.001798962 3.020685e-05
rxom 1.798962e-03 0.006743820 1.781462e-03
rboeing 3.020685e-05 0.001781462 8.282167e-03
Portfolio possibilities curve with 3 stocks
rxom
Min. :-0.5219233
1st Qu.:-0.0172273
Median : 0.0007013
Mean :-0.0011666
3rd Qu.: 0.0337488
Max. : 0.2269380
rboeing
Min. :-0.34570
1st Qu.:-0.04308
Median : 0.01843
Mean : 0.01079
3rd Qu.: 0.07357
Max. : 0.17483
rxom rboeing

●●● ●●●●●●●● ●●●●●●●●●● ●●●●● ●●
●●●●●●●●● ●●●●●●●●●●●●●● ●●●●●●●●●●●
●●●●● ●●●●● ●●●●●●●●●●●●●● ●●●●●●●●●●●● ●●●●●
●●●●●●●●●●●●
● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ●● ●● ●● ●● ●● ●● ● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ●● ●● ●● ●● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●●●●●●●●●●● ●●●●●●● ●●
● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ●● ● ● ● ● ●● ●● ●● ●● ●● ●● ●● ●● ● ● ● ● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ●● ●● ●● ●● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ●● ●● ●● ●● ●● ●● ●● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ●● ●● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ●● ●● ●●●● ●● ●● ●● ●● ●● ●●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●●●●●●●●●●●●●●●●●●●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ●● ● ●● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ●● ● ● ● ● ● ● ● ● ●● ●● ●● ●●● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ●● ● ● ● ● ● ● ●● ●● ●● ●● ●● ●● ●● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ●●● ●● ●● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●●● ●●● ●●●● ● ● ● ● ●
●● ●● ●●●● ●●●● ●●●● ●●●● ● ● ●●●●● ●●●●● ●●●● ● ● ● ●
●● ●●●● ●●●●●● ●●●● ●●●● ●●●●
● ●
● ● ●
● ● ● ●
● ● ● ● ● ● ● ● ● ● ● ● ● ●● ●●● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●
●● ●●● ●●●●●● ●●●● ●●●● ● ● ● ●
●●● ●●●●● ●●●●● ●●●● ● ● ● ●
●●●●●●●●●●●●●●●●●● ●● ●● ●●● ●●●●
●●●●●● ●●●● ● ● ●
● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ●● ●● ● ● ● ● ● ● ●● ●●●● ●●●● ●
● ● ● ● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ●
● ●● ●●●● ●●●●
● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ●● ●● ●● ● ● ●
● ● ●
●●● ● ● ● ●
● ● ● ●
● ● ● ● ● ●●●●●
●● ●
● ●●● ●●● ●
●●● ●●●●● ●●●●● ●●●● ●●●● ●●●● ●●●●●●●●●● ●●●● ●●●● ●●●● ●●
● ● ● ● ● ●
●● ● ● ● ●
●● ● ●● ●
●●●● ●●●● ● ● ● ● ●
●●● ●●●●●●● ●●●●●● ●●●● ●●●● ●●●● ●●●●●●●●●●●● ●●●● ●●●● ●●●● ●●●
●●●● ●●●●●●●●●●●●● ●●●● ●●●● ●●●● ●●●●●●●●●●●● ●●●● ●●●● ● ● ● ● ● ● ● ●
● ●● ●●●● ●●●●
● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●●● ● ● ●● ●● ● ● ●
● ● ● ● ● ● ● ●● ●●●●

● ●●●● ●●●● ●●●
● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●●● ● ● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ●●●●
● ●
● ● ●
● ● ● ●
● ● ● ●
● ● ● ● ● ●
● ● ● ● ● ● ● ●
●●●● ● ● ● ● ● ● ● ●
●●●● ●●●● ●●●● ● ●●●●●●●●●●●●●●●●●●●●● ●●●●●●●● ●●●●●●●●● ●●●●●●●
● ●●● ●●●● ●●●● ●
●● ●●● ●●●● ●●●●
● ● ●●●●● ●●●
● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●
●●●●●●●●●●●●●●●●●●● ●●●●●●●● ●●●●●●●●● ●●●●●●●● ●●●●●●●●●●●●●●●●● ●●●●●●●● ●●●●●●●●●
●●●●●●●●●●●●●●●●●● ●●●●●●●● ●●●●●●●● ●●●●●●● ●●●●
● ●●●●●●●●● ●●●●●●● ●●●●●●● ● ●●●●●
●●●●●●●●●● ●●●●
● ●●●●● ●● ●●●● ●●●● ●●●●
● ●●●● ●●●●
●●●●●● ●●●● ● ●●●● ●●●●
● ●●●●● ●●●● ●● ●●●● ●●●●
● ●●●● ●●●●
● ●●●● ●●●●
●●●● ●●●● ●●●● ●●●●
●●●● ●●●●
●●●● ●●●●
●●●● ●●●●
●●●● ● ●●●●●
● ● ● ●
● ●
●●●●● ●●●● ●●●●●
● ●

● ● ● ●
0.06 0.07 0.08 0.09
Risk (standard deviation)
9
Expected return
0.000 0.002 0.004 0.006 0.008 0.010

Leave a Reply

Your email address will not be published. Required fields are marked *