Skip to main content
Statistics LibreTexts

12.4: Problems on Variance, Covariance, Linear Regression

  • Page ID
    10837
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Exercise \(\PageIndex{1}\)

    (See Exercise 1 from "Problems on Distribution and Density Functions ", and Exercise 1 from "Problems on Mathematical Expectation", m-file npr07_01.m). The class \(\{C_j: 1 \le j \le 10\}\) is a partition. Random variable \(X\) has values {1, 3, 2, 3, 4, 2, 1, 3, 5, 2} on \(C_1\) through \(C_{10}\), respectively, with probabilities 0.08, 0.13, 0.06, 0.09, 0.14, 0.11, 0.12, 0.07, 0.11, 0.09. Determine \(\text{Var} [X]\).

    Answer
    npr07_01
    Data are in T and pc
    EX = T*pc'
    EX =  2.7000
    VX = (T.^2)*pc' - EX^2
    VX =  1.5500
    [X,PX] = csort(T,pc);    % Alternate
    Ex = X*PX'
    Ex =  2.7000
    Vx = (X.^2)*PX' - EX^2
    Vx =  1.5500

    Exercise \(\PageIndex{2}\)

    (See Exercise 2 from "Problems on Distribution and Density Functions ", and Exercise 2 from "Problems on Mathematical Expectation", m-file npr07_02.m). A store has eight items for sale. The prices are $3.50, $5.00, $3.50, $7.50, $5.00, $5.00, $3.50, and $7.50, respectively. A customer comes in. She purchases one of the items with probabilities 0.10, 0.15, 0.15, 0.20, 0.10 0.05, 0.10 0.15. The random variable expressing the amount of her purchase may be written

    \(X = 3.5 I_{C_1} + 5.0 I_{C_2} + 3.5 I_{C_3} + 7.5 I_{C_4} + 5.0 I_{C_5} + 5.0 I_{C_6} + 3.5 I_{C_7} + 7.5 I_{C_8}\)

    Determine \(\text{Var} [X]\).

    Answer
    npr07_02
    Data are in T, pc
    EX = T*pc';
    VX = (T.^2)*pc' - EX^2
    VX =  2.8525

    Exercise \(\PageIndex{3}\)

    (See Exercise 12 from "Problems on Random Variables and Probabilities", Exercise 3 from "Problems on Mathematical Expectation", m-file npr06_12.m). The class \(\{A, B, C, D\}\) has minterm probabilities

    \(pm = \) 0.001 * [5 7 6 8 9 14 22 33 21 32 50 75 86 129 201 302]

    Consider \(X = I_A + I_B + I_C + I_D\), which counts the number of these events which occur on a trial. Determine \(\text{Var} [X]\).

    Answer
    npr06_12
    Minterm probabilities in pm, coefficients in c
    canonic
     Enter row vector of coefficients  c
     Enter row vector of minterm probabilities  pm
    Use row matrices X and PX for calculations
    Call for XDBN to view the distribution
    VX = (X.^2)*PX' - (X*PX')^2
    VX =  0.7309

    Exercise \(\PageIndex{4}\)

    (See Exercise 4 from "Problems on Mathematical Expectation"). In a thunderstorm in a national park there are 127 lightning strikes. Experience shows that the probability of each lightning strike starting a fire is about 0.0083. Determine \(\text{Var} [X]\).

    Answer

    \(X\) ~ binomial (127, 0.0083). \(\text{Var} [X] = 127 \cdot 0.0083 \cdot (1-0.0083) = 1.0454\).

    Exercise \(\PageIndex{5}\)

    (See Exercise 5 from "Problems on Mathematical Expectation"). Two coins are flipped twenty times. Let \(X\) be the number of matches (both heads or both tails). Determine \(\text{Var} [X]\).

    Answer

    \(X\) ~ binomial (20, 1/2). \(\text{Var}[X] = 20 \cdot (1/2)^2 = 5\).

    Exercise \(\PageIndex{6}\)

    (See Exercise 6 from "Problems on Mathematical Expectation"). A residential College plans to raise money by selling “chances” on a board. Fifty chances are sold. A player pays $10 to play; he or she wins $30 with probability \(p = 0.2\). The profit to the College is

    \(X = 50 \cdot 10 - 30 N\), where \(N\) is the number of winners

    Determine \(\text{Var} [X]\).

    Answer

    \(N\) ~ binomial (50, 0.2). \(\text{Var}[N] = 50 \cdot 0.2 \cdot 0.8 = 8\). \(\text{Var} [X] = 30^2\ \text{Var} [N] = 7200\).

    Exercise \(\PageIndex{7}\)

    (See Exercise 7 from "Problems on Mathematical Expectation"). The number of noise pulses arriving on a power circuit in an hour is a random quantity \(X\) having Poisson (7) distribution. Determine \(\text{Var} [X]\).

    Answer

    \(X\) ~ Poisson (7). \(\text{Var} [X] = \mu = 7\).

    Exercise \(\PageIndex{8}\)

    (See Exercise 24 from "Problems on Distribution and Density Functions", and Exercise 8 from "Problems on Mathematical Expectation"). The total operating time for the units in Exercise 24 from "Problems on Distribution and Density Functions" is a random variable \(T\) ~ gamma (20, 0.0002). Determine \(\text{Var} [T]\).

    Answer

    \(T\) ~ gamma (20, 0.0002). \(\text{Var}[T] = 20/0.0002^2 = 500,000,000\).

    Exercise \(\PageIndex{9}\)

    The class \(\{A, B, C, D, E, F\}\) is independent, with respective probabilities

    0.43, 0.53, 0.46, 0.37, 0.45, 0.39. Let

    \(X = 6 I_A + 13 I_B - 8I_C\), \(Y = -3I_D + 4 I_E + I_F - 7\)

    a. Use properties of expectation and variance to obtain \(E[X]\), \(\text{Var} [X]\), \(E[Y]\), and \(\text{Var}[Y]\). Note that it is not necessary to obtain the distributions for \(X\) or \(Y\).

    b. Let \(Z = 3Y - 2X\).

    Determine \(E[Z]\), and \(\text{Var} [Z]\).

    Answer
    cx = [6 13 -8 0];
    cy = [-3 4 1 -7];
    px = 0.01*[43 53 46 100];
    py = 0.01*[37 45 39 100];
    EX = dot(cx,px)
    EX =   5.7900
    EY = dot(cy,py)
    EY =  -5.9200
    VX = sum(cx.^2.*px.*(1-px))
    VX =  66.8191
    VY = sum(cy.^2.*py.*(1-py))
    VY =   6.2958
    EZ = 3*EY - 2*EX
    EZ = -29.3400
    VZ = 9*VY + 4*VX
    VZ = 323.9386

    Exercise \(\PageIndex{10}\)

    Consider \(X = -3.3 I_A - 1.7 I_B + 2.3 I_C + 7.6 I_D - 3.4\). The class \(\{A, B, C, D\}\) has minterm probabilities (data are in m-file npr12_10.m)

    \(\text{pmx} =\) [0.0475 0.0725 0.0120 0.0180 0.1125 0.1675 0.0280 0.0420 \(\cdot\cdot\cdot\)

    0.0480 0.0720 0.0130 0.0170 0.1120 0.1680 0.0270 0.0430]

    a. Calculate \(E[X]\) and \(\text{Var} [X]\).

    b. Let \(W = 2X^2 - 3X + 2\).
    Calculate \(E[W]\) and \(\text{Var} [W]\)

    Answer
    npr12_10
    Data are in cx, cy, pmx and pmy
    canonic
     Enter row vector of coefficients  cx
     Enter row vector of minterm probabilities  pmx
    Use row matrices X and PX for calculations
    Call for XDBN to view the distribution
    EX = dot(X,PX)
    EX =  -1.2200
    VX = dot(X.^2,PX) - EX^2
    VX =  18.0253
    G = 2*X.^2 - 3*X + 2;
    [W,PW] = csort(G,PX);
    EW = dot(W,PW)
    EW =  44.6874
    VW = dot(W.^2,PW) - EW^2
    VW =  2.8659e+03

    Exercise \(\PageIndex{11}\)

    Consider a second random variable \(Y = 10 I_E + 17 I_F + 20 I_G - 10\) in addition to that in Exercise 12.4.10. The class \(\{E, F, G\}\) has minterm probabilities (in mfile npr12_10.m)

    \(\text{pmy} =\) [0.06 0.14 0.09 0.21 0.06 0.14 0.09 0.21]

    The pair \(\{X, Y\}\) is independent.

    a. Calculate \(E[Y]\) and \(\text{Var} [Y]\).

    b. Let \(Z = X^2 + 2XY - Y\).
    Calculate \(E[Z]\) and \(\text{Var} [Z]\).

    Answer

    (Continuation of Exercise 12.4.10)

    [Y,PY] = canonicf(cy,pmy);
    EY = dot(Y,PY)
    EY =  19.2000
    VY = dot(Y.^2,PY) - EY^2
    VY = 178.3600
    icalc
    Enter row matrix of X-values  X
    Enter row matrix of Y-values  Y
    Enter X probabilities  PX
    Enter Y probabilities  PY
     Use array operations on matrices X, Y, PX, PY, t, u, and P
    H = t.^2 + 2*t.*u - u;
    [Z,PZ] = csort(H,P);
    EZ = dot(Z,PZ)
    EZ = -46.5343
    VZ = dot(Z.^2,PZ) - EZ^2
    VZ =  3.7165e+04

    Exercise \(\PageIndex{12}\)

    Suppose the pair \(\{X, Y\}\) is independent, with \(X\) ~ gamma (3, 0.1) and

    \(Y\) ~ Poisson (13). Let \(Z = 2X - 5Y\). Determine \(E[Z]\) and \(\text{Var} [Z]\).

    Answer

    \(X\) ~ gamma (3, 0.1) implies \(E[X] = 30\) and \(\text{Var} [X] = 300.\) \(Y\) ~ Poisson (13) implies \(E[Y] = \text{Var} [Y] = 13\). Then

    \(E[Z] = 2\cdot 30 - 5 \cdot 13 = -5\), \(\text{Var}[Z] = 4 \cdot 300 + 25 \cdot 13 = 1525\).

    Exercise \(\PageIndex{13}\)

    The pair \(\{X, Y\}\) is jointly distributed with the following parameters:

    \(E[X] = 3\), \(E[Y] = 4\), \(E[XY] = 15\), \(E[X^2] = 11\), \(\text{Var} [Y] = 5\)

    Determine \(\text{Var} [3X - 2Y]\).

    Answer
    EX = 3;
    EY = 4;
    EXY = 15;
    EX2 = 11;
    VY = 5;
    VX = EX2 - EX^2
    VX =  2
    CV = EXY - EX*EY
    CV =  3
    VZ = 9*VX + 4*VY - 6*2*CV
    VZ =  2

    Exercise \(\PageIndex{14}\)

    The class \(\{A, B, C, D, E, F\}\) is independent, with respective probabilities

    0.47, 0.33, 0.46, 0.27, 0.41, 0.37

    Let

    \(X = 8I_A + 11 I_B - 7I_C\), \(Y = -3I_D + 5I_E + I_F - 3\), and \(Z = 3Y - 2X\)

    a. Use properties of expectation and variance to obtain \(E[X]\), \(\text{Var} [X]\), \(E[Y]\), and \(\text{Var}[Y]\).

    b. Determine \(E[Z]\), and \(\text{Var} [Z]\).

    c. Use appropriate m-programs to obtain \(E[X]\), \(\text{Var} [X]\), \(E[Y]\), \(\text{Var} [Y]\), \(E[Z]\), and \(\text{Var} [Z]\). Compare with results of parts (a) and (b).

    Answer
    px = 0.01*[47 33 46 100];
    py = 0.01*[27 41 37 100];
    cx = [8 11 -7 0];
    cy = [-3 5 1 -3];
    ex = dot(cx,px)
    ex =   4.1700
    ey = dot(cy,py)
    ey =  -1.3900
    vx = sum(cx.^2.*px.*(1 - px))
    vx =  54.8671
    vy = sum(cy.^2.*py.*(1-py))
    vy =   8.0545
    [X,PX] = canonicf(cx,minprob(px(1:3)));
    [Y,PY] = canonicf(cy,minprob(py(1:3)));
    icalc
    Enter row matrix of X-values  X
    Enter row matrix of Y-values  Y
    Enter X probabilities  PX
    Enter Y probabilities  PY
     Use array operations on matrices X, Y, PX, PY, t, u, and P
    EX = dot(X,PX)
    EX =   4.1700
    EY = dot(Y,PY)
    EY =  -1.3900
    VX = dot(X.^2,PX) - EX^2
    VX =  54.8671
    VY = dot(Y.^2,PY) - EY^2
    VY =   8.0545
    EZ = 3*EY - 2*EX
    EZ = -12.5100
    VZ = 9*VY + 4*VX
    VZ = 291.9589

    Exercise \(\PageIndex{15}\)

    For the Beta (\(r, s\)) distribution.

    a. Determine \(E[X^n]\), where \(n\) is a positive integer.

    b. Use the result of part (a) to determine \(E[X]\) and \(\text{Var} [X]\).

    Answer

    \(E[X^n] = \dfrac{\Gamma (r + s)}{\Gamma (r) \Gamma (s)} \int_0^1 t^{r + n - 1} dt = \dfrac{\Gamma (r + s)}{\Gamma (r) \Gamma (s)} \cdot \dfrac{\Gamma (r + n) \Gamma (s)}{\Gamma (r + s + n)} =\)

    \(\dfrac{\Gamma (r + n) \Gamma (r + s)}{\Gamma (r + s + n) \Gamma (r)}\)

    Using \(\Gamma (x + 1) = x \Gamma (x)\) we have

    \(E[X] = \dfrac{r}{r + s}\), \(E[X^2] = \dfrac{r(r + 1)}{(r + s) (r + s + 1)}\)

    Some algebraic manipulations show that

    \(\text{Var} [X] = E[X^2] - E^2[X] = \dfrac{rs} {(r + s)^2 (r + s + 1)}\)

    Exercise \(\PageIndex{16}\)

    The pair \(\{X, Y\}\) has joint distribution. Suppose

    \(E[X] = 3\), \(E[X^2] = 11\), \(E[Y] = 10\), \(E[Y^2] = 101\), \(E[XY] = 30\)

    Determine \(\text{Var} [15X - 2Y]\).

    Answer
    EX = 3;
    EX2 = 11;
    EY = 10;
    EY2 = 101;
    EXY = 30;
    VX = EX2 - EX^2
    VX =    2
    VY = EY2 - EY^2
    VY =    1
    CV = EXY - EX*EY
    CV =    0
    VZ = 15^2*VX + 2^2*VY
    VZ =  454

    Exercise \(\PageIndex{17}\)

    The pair \(\{X, Y\}\) has joint distribution. Suppose

    \(E[X] = 2\), \(E[X^2] = 5\), \(E[Y] = 1\), \(E[Y^2] = 2\), \(E[XY] = 1\)

    Determine \(\text{Var} [3X + 2Y]\).

    Answer
    EX = 2;
    EX2 = 5;
    EY = 1;
    EY2 = 2;
    EXY = 1;
    VX = EX2 - EX^2
    VX =    1
    VY = EY2 - EY^2
    VY =    1
    CV = EXY - EX*EY
    CV =   -1
    VZ = 9*VX + 4*VY + 2*6*CV
    VZ =    1

    Exercise \(\PageIndex{18}\)

    The pair \(\{X, Y\}\) is independent, with

    \(E[X] = 2\), \(E[Y] = 1\), \(\text{Var} [X] = 6\), \(\text{Var} [Y] = 4\)

    Let \(Z = 2X^2 + XY^2 - 3Y + 4\).

    Determine \(E[Z]\).

    Answer
    EX = 2;
    EY = 1;
    VX = 6;
    VY = 4;
    EX2 = VX + EX^2
    EX2 =  10
    EY2 = VY + EY^2
    EY2 =   5
    EZ = 2*EX2 + EX*EY2 - 3*EY + 4
    EZ =   31

    Exercise \(\PageIndex{19}\)

    (See Exercise 9 from "Problems on Mathematical Expectation"). Random variable X has density function

    \(f_X (t) = \begin{cases} (6/5) t^2 & \text{for } 0 \le t \le 1 \\ (6/5)(2 - t) & \text{for } 1 < t \le 2 \end{cases} = I_{[0, 1]} (t) \dfrac{6}{5} t^2 + I_{(1, 2]} (t) \dfrac{6}{5} (2 - t)\)

    \(E[X] = 11/10\). Determine \(\text{Var} [X]\).

    Answer

    \(E[X^2] = \int t^2 f_X (t)\ dt = \dfrac{6}{5} \int_0^1 t^4\ dt + \dfrac{6}{5} \int_1^2 (2t^2 - t^3)\ dt = \dfrac{67}{50}\)

    \(\text{Var} [X] = E[X^2] - E^2[X] = \dfrac{13}{100}\)

    For the distributions in Exercises 20-22

    Determine \(\text{Var} [X]\), \(\text{Cov} [X, Y]\), and the regression line of \(Y\) on \(X\).

    Exercise \(\PageIndex{20}\)

    (See Exercise 7 from "Problems On Random Vectors and Joint Distributions", and Exercise 17 from "Problems on Mathematical Expectation"). The pair \(\{X, Y\}\) has the joint distribution (in file npr08_07.m):

    \(P(X = t, Y = u)\)

    t = -3.1 -0.5 1.2 2.4 3.7 4.9
    u = 7.5 0.0090 0.0396 0.0594 0.0216 0.0440 0.0203
    4.1 0.0495 0 0.1089 0.0528 0.0363 0.0231
    -2.0 0.0405 0.1320 0.0891 0.0324 0.0297 0.0189
    -3.8 0.0510 0.0484 0.0726 0.0132 0 0.0077
    Answer
    npr08_07
    Data are in X, Y, P
    jcalc
    - - - - - - - - - - -
    EX = dot(X,PX);
    EY = dot(Y,PY);
    VX = dot(X.^2,PX) - EX^2
    VX =   5.1116
    CV = total(t.*u.*P) - EX*EY
    CV =   2.6963
    a = CV/VX
    a =    0.5275
    b = EY - a*EX
    b =    0.6924       % Regression line: u = at + b

    Exercise \(\PageIndex{21}\)

    (See Exercise 8 from "Problems On Random Vectors and Joint Distributions", and Exercise 18 from "Problems on Mathematical Expectation"). The pair \(\{X, Y\}\) has the joint distribution (in file npr08_08.m):

    \(P(X = t, Y = u)\)

    t = 1 3 5 7 9 11 13 15 17 19
    u = 12 0.0156 0.0191 0.0081 0.0035 0.0091 0.0070 0.0098 0.0056 0.0091 0.0049
    10 0.0064 0.0204 0.0108 0.0040 0.0054 0.0080 0.0112 0.0064 0.0104 0.0056
    9 0.0196 0.0256 0.0126 0.0060 0.0156 0.0120 0.0168 0.0096 0.0056 0.0084
    5 0.0112 0.0182 0.0108 0.0070 0.0182 0.0140 0.0196 0.0012 0.0182 0.0038
    3 0.0060 0.0260 0.0162 0.0050 0.0160 0.0200 0.0280 0.0060 0.0160 0.0040
    -1 0.0096 0.0056 0.0072 0.0060 0.0256 0.0120 0.0268 0.0096 0.0256 0.0084
    -3 0.0044 0.0134 0.0180 0.0140 0.0234 0.0180 0.0252 0.0244 0.0234 0.0126
    -5 0.0072 0.0017 0.0063 0.0045 0.0167 0.0090 0.0026 0.0172 0.0217 0.0223
    Answer
    npr08_08
    Data are in X, Y, P
    jcalc
    - - - - - - - - - - - -
    EX = dot(X,PX);
    EY = dot(Y,PY);
    VX = dot(X.^2,PX) - EX^2
    VX =  31.0700
    CV = total(t.*u.*P) - EX*EY
    CV =  -8.0272
    a  = CV/VX
    a  =  -0.2584
    b = EY - a*EX
    b  =   5.6110       % Regression line: u = at + b

    Exercise \(\PageIndex{22}\)

    (See Exercise 9 from "Problems On Random Vectors and Joint Distributions", and Exercise 19 from "Problems on Mathematical Expectation"). Data were kept on the effect of training time on the time to perform a job on a production line. \(X\) is the amount of training, in hours, and \(Y\) is the time to perform the task, in minutes. The data are as follows (in file npr08_09.m):

    \(P(X = t, Y = u)\)

    t = 1 1.5 2 2.5 3
    u = 5 0.039 0.011 0.005 0.001 0.001
    4 0.065 0.070 0.050 0.015 0.010
    3 0.031 0.061 0.137 0.051 0.033
    2 0.012 0.049 0.163 0.058 0.039
    1 0.003 0.009 0.045 0.025 0.017
    Answer
    npr08_09
    Data are in X, Y, P
    jcalc
    - - - - - - - - - - - -
    EX = dot(X,PX);
    EY = dot(Y,PY);
    VX = dot(X.^2,PX) - EX^2
    VX =   0.3319
    CV = total(t.*u.*P) - EX*EY
    CV =  -0.2586
    a  = CV/VX
    a  =  -0.77937/6;
    b = EY - a*EX
    b  =   4.3051       % Regression line: u = at + b

    For the joint densities in Exercises 23-30 below

    1. Determine analytically \(\text{Var} [X]\) \(\text{Cov} [X, Y]\), and the regression line of \(Y\) on \(X\).
    2. Check these with a discrete approximation.

    Exercise \(\PageIndex{23}\)

    (See Exercise 10 from "Problems On Random Vectors and Joint Distributions", and Exercise 20 from "Problems on Mathematical Expectation"). \(f_{XY} (t, u) = 1\) for \(0 \le t \le 1\), \(0 \le u \le 2(1 - t)\).

    \(E[X] = \dfrac{1}{3}\), \(E[X^2] = \dfrac{1}{6}\), \(E[Y] = \dfrac{2}{3}\)

    Answer

    \(E[XY] = \int_{0}^{1} \int_{0}^{2(1-t)} tu\ dudt = 1/6\)

    \(\text{Cov} [X, Y] = \dfrac{1}{6} - \dfrac{1}{3} \cdot \dfrac{2}{3} = -1/18\) \(\text{Var} [X] = 1/6 - (1/3)^2 = 1/18\)

    \(a = \text{Cov} [X, Y] /\text{Var} [X] = -1\) \(b = E[Y] - aE[X] = 1\)

    tuappr: [0 1] [0 2] 200 400  u<=2*(1-t)
    EX = dot(X,PX);
    EY = dot(Y,PY);
    VX = dot(X.^2,PX) - EX^2
    VX =   0.0556
    CV = total(t.*u.*P) - EX*EY
    CV =  -0.0556
    a = CV/VX
    a =   -1.0000
    b = EY - a*EX
    b =    1.0000

    Exercise \(\PageIndex{24}\)

    (See Exercise 13 from "Problems On Random Vectors and Joint Distributions", and Exercise 23 from "Problems on Mathematical Expectation"). \(f_{XY} (t, u) = \dfrac{1}{8} (t + u)\) for \(0 \le t \le 2\), \(0 \le u \le 2\).

    \(E[X] = E[Y] = \dfrac{7}{6}\), \(E[X^2] = \dfrac{5}{3}\)

    Answer

    \(E[XY] = \dfrac{1}{8} \int_{0}^{2} \int_{0}^{2} tu (t + u)\ dudt = 4/3\), \(\text{Cov} [X, Y] = -1/36\), \(\text{Var} [X] = 11/36\)

    \(a = \text{Cov} [X, Y]/\text{Var} [X] = -1/11\), \(b = E[Y] - a E[X] = 14/11\)

    tuappr:  [0 2] [0 2] 200 200 (1/8)*(t+u)
    VX =  0.3055  CV = -0.0278  a = -0.0909  b =  1.2727

    Exercise \(\PageIndex{25}\)

    (See Exercise 15 from "Problems On Random Vectors and Joint Distributions", and Exercise 25 from "Problems on Mathematical Expectation"). \(f_{XY} (t, u) = \dfrac{3}{88} (2t + 3u^2)\) for \(0 \le t \le 2\), \(0 \le u \le 1 + t\).

    \(E[X] = \dfrac{313}{220}\), \(E[Y] = \dfrac{1429}{880}\), \(E[X^2] = \dfrac{49}{22}\)

    Answer

    \(E[XY] = \dfrac{3}{88} \int_{0}^{2} \int_{0}^{1+t} tu (2t + 3u^2)\ dudt = 2153/880\), \(\text{Cov} [X, Y] = 26383/1933600\), \(\text{Var} [X] = 9831/48400\)

    \(a = \text{Cov} [X, Y]/\text{Var} [X] = 26383/39324\), \(b = E[Y] - a E[X] = 26321/39324\)

    tuappr:  [0 2] [0 3] 200 300  (3/88)*(2*t + 3*u.^2).*(u<=1+t)
    VX =  0.2036  CV = 0.1364 a = 0.6700  b = 0.6736
    

    Exercise \(\PageIndex{26}\)

    (See Exercise 16 from "Problems On Random Vectors and Joint Distributions", and Exercise 26 from "Problems on Mathematical Expectation"). \(f_{XY} (t, u) = 12t^2 u\) on the parallelogram with vertices

    (-1, 0), (0, 0), (1, 1), (0, 1)

    \(E[X] = \dfrac{2}{5}\), \(E[Y] = \dfrac{11}{15}\), \(E[X^2] = \dfrac{2}{5}\)

    Answer

    \(E[XY] = 12 \int_{-1}^{0} \int_{0}^{t + 1} t^3 u^2\ dudt + 12 \int_{0}^{1} \int_{t}^{1} t^3 u^2 \ dudt = \dfrac{2}{5}\)

    \(\text{Cov} [X, Y] = \dfrac{8}{75}\), \(\text{Var} [X] = \dfrac{6}{25}\)

    \(a = \text{Cov} [X, Y]/\text{Var} [X] = 4/9\), \(b = E[Y] - a E[X] = 5/9\)

    tuappr: [-1 1] [0 1] 400 200  12*t.^2.*u.*(u>= max(0,t)).*(u<= min(1+t,1))
    VX = 0.2383  CV = 0.1056  a = 0.4432  b = 0.5553

    Exercise \(\PageIndex{27}\)

    (See Exercise 17 from "Problems On Random Vectors and Joint Distributions", and Exercise 27 from "Problems on Mathematical Expectation"). \(f_{XY} (t, u) = \dfrac{24}{11} tu\) for \(0 \le t \le 2\), \(0 \le u \le \text{min } \{1, 2 - t\}\).

    \(E[X] = \dfrac{52}{55}\), \(E[Y] = \dfrac{32}{55}\), \(E[X^2] = \dfrac{627}{605}\)

    Answer

    \(E[XY] = \dfrac{24}{11} \int_{0}^{1} \int_{0}^{1} t^2 u^2\ dudt + \dfrac{24}{11} \int_{1}^{2} \int_{0}^{2-t} t^2 u^2 \ dudt = \dfrac{28}{55}\)

    \(\text{Cov} [X, Y] = -\dfrac{124}{3025}\), \(\text{Var} [X] = \dfrac{431}{3025}\)

    \(a = \text{Cov} [X, Y]/\text{Var} [X] = -\dfrac{124}{431}\), \(b = E[Y] - a E[X] = \dfrac{368}{431}\)

    tuappr: [0 2] [0 1] 400 200 (24/11)*t.*u.*(u<=min(1,2-t))
    VX = 0.1425  CV =-0.0409  a = -0.2867 b = 0.8535

    Exercise \(\PageIndex{28}\)

    (See Exercise 18 from "Problems On Random Vectors and Joint Distributions", and Exercise 28 from "Problems on Mathematical Expectation"). \(f_{XY} (t, u) = \dfrac{3}{23} (t + 2u)\), for \(0 \le t \le 2\), \(0 \le u \le \text{max } \{2 - t, t\}\).

    \(E[X] = \dfrac{53}{46}\), \(E[Y] = \dfrac{22}{23}\), \(E[X^2] = \dfrac{9131}{5290}\)

    Answer

    \(E[XY] = \dfrac{3}{23} \int_{0}^{1} \int_{0}^{2-t} tu (t + 2u)\ dudt + \dfrac{3}{23} \int_{1}^{2} \int_{0}^{t} tu (t + 2u) \ dudt = \dfrac{251}{230}\)

    \(\text{Cov} [X, Y] = -\dfrac{57}{5290}\), \(\text{Var} [X] = \dfrac{4217}{10580}\)

    \(a = \text{Cov} [X, Y]/\text{Var} [X] = -\dfrac{114}{4217}\), \(b = E[Y] - a E[X] = \dfrac{4165}{4217}\)

    tuappr: [0 2] [0 2] 200 200 (3/23)*(t + 2*u).*(u<=max(2-t,t))
    VX = 0.3984 CV = -0.0108  a = -0.0272  b = 0.9909

    Exercise \(\PageIndex{29}\)

    (See Exercise 21 from "Problems On Random Vectors and Joint Distributions", and Exercise 31 from "Problems on Mathematical Expectation"). \(f_{XY} (t, u) = \dfrac{2}{13} (t + 2u)\), for \(0 \le t \le 2\), \(0 \le u \le \text{min } \{2t, 3 - t\}\).

    \(E[X] = \dfrac{16}{13}\), \(E[Y] = \dfrac{11}{12}\), \(E[X^2] = \dfrac{2847}{1690}\)

    Answer

    \(E[XY] = \dfrac{2}{13} \int_{0}^{1} \int_{0}^{3-t} tu (t + 2u)\ dudt + \dfrac{2}{13} \int_{1}^{2} \int_{0}^{2t} tu (t + 2u) \ dudt = \dfrac{431}{390}\)

    \(\text{Cov} [X, Y] = -\dfrac{3}{130}\), \(\text{Var} [X] = \dfrac{287}{1690}\)

    \(a = \text{Cov} [X, Y]/\text{Var} [X] = -\dfrac{39}{297}\), \(b = E[Y] - a E[X] = \dfrac{3733}{3444}\)

    tuappr: [0 2] [0 2] 400 400 (2/13)*(t + 2*u).*(u<=min(2*t,3-t))
    VX = 0.1698  CV = -0.0229  a = -0.1350  b = 1.0839

    Exercise \(\PageIndex{30}\)

    (See Exercise 22 from "Problems On Random Vectors and Joint Distributions", and Exercise 32 from "Problems on Mathematical Expectation"). \(f_{XY} (t, u) = I_{[0, 1]} (t) \dfrac{3}{8} (t^2 + 2u) + I_{(1, 2]} (t) \dfrac{9}{14} t^2u^2\), for \(0 \le u \le 1\).

    \(E[X] = \dfrac{243}{224}\), \(E[Y] = \dfrac{11}{16}\), \(E[X^2] = \dfrac{107}{70}\)

    Answer

    \(E[XY] = \dfrac{3}{8} \int_{0}^{1} \int_{0}^{1} tu (t^2 + 2u)\ dudt + \dfrac{9}{14} \int_{1}^{2} \int_{0}^{1} t^3u^3 \ dudt = \dfrac{347}{448}\)

    \(\text{Cov} [X, Y] = -\dfrac{103}{3584}\), \(\text{Var} [X] = \dfrac{88243}{250880}\)

    \(a = \text{Cov} [X, Y]/\text{Var} [X] = -\dfrac{7210}{88243}\), \(b = E[Y] - a E[X] = \dfrac{105691}{176486}\)

    tuappr: [0 2] [0 1] 400 200 (3/8)*(t.^2 + 2*u).*(t<=1) + (9/14)*t.^2.*u.^2.*(t>1)
    VX = 0.3517  CV = 0.0287 a = 0.0817  b = 0.5989

    Exercise \(\PageIndex{31}\)

    The class \(\{X, Y, Z\}\) of random variables is iid (independent, identically distributed) with common distribution

    \(X =\) [-5 -1 3 4 7] \(PX =\) 0.01 * [15 20 30 25 10]

    Let \(W = 3X - 4Y + 2Z\). Determine \(E[W]\) and \(\text{Var} [W]\). Do this using icalc, then repeat with icalc3 and compare results.

    Answer
    x = [-5 -1 3 4 7];
    px = 0.01*[15 20 30 25 10];
    EX = dot(x,px)                % Use of properties
    EX =   1.6500
    VX = dot(x.^2,px) - EX^2
    VX =  12.8275
    EW = (3 - 4+ 2)*EX
    EW =   1.6500
    VW = (3^2 + 4^2 + 2^2)*VX
    VW = 371.9975
    icalc                         % Iterated use of icalc
    Enter row matrix of X-values  x
    Enter row matrix of Y-values  x
    Enter X probabilities  px
    Enter Y probabilities  px
     Use array operations on matrices X, Y, PX, PY, t, u, and P
    G = 3*t - 4*u;
    [R,PR] = csort(G,P);
    icalc
    Enter row matrix of X-values  R
    Enter row matrix of Y-values  x
    Enter X probabilities  PR
    Enter Y probabilities  px
     Use array operations on matrices X, Y, PX, PY, t, u, and P
    H = t + 2*u;
    [W,PW] = csort(H,P);
    EW = dot(W,PW)
    EW =   1.6500
    VW = dot(W.^2,PW) - EW^2
    VW = 371.9975
    icalc3                        % Use of icalc3
    Enter row matrix of X-values  x
    Enter row matrix of Y-values  x
    Enter row matrix of Z-values  x
    Enter X probabilities  px
    Enter Y probabilities  px
    Enter Z probabilities  px
    Use array operations on matrices X, Y, Z,
    PX, PY, PZ, t, u, v, and P
    S = 3*t - 4*u + 2*v;
    [w,pw] = csort(S,P);
    Ew = dot(w,pw)
    Ew =   1.6500
    Vw = dot(w.^2,pw) - Ew^2
    Vw = 371.9975

    Exercise \(\PageIndex{32}\)

    \(f_{XY} (t, u) = \dfrac{3}{88} (2t + 3u^2)\) for \(0 \le t \le 2\), \(0 \le u \le 1 + t\) (see Exercise 25 and Exercise 37 from "Problems on Mathematical Expectation").

    \(Z = I_{[0, 1]} (X) 4X + I_{(1, 2]} (X) (X+ Y)\)

    \(E[X] = \dfrac{313}{220}\), \(E[Z] = \dfrac{5649}{1760}\), \(E[Z^2] = \dfrac{4881}{440}\)

    Determine \(\text{Var} [Z]\) and \(\text{Cov} [X, Z]\). Check with discrete approximation.

    Answer

    \(E[XZ] = \dfrac{3}{88} \int_0^1 \int_{0}^{1+t} 4t^2 (2t + 2u^2)\ dudt + \dfrac{3}{88} \int_{1}^{2} \int_{0}^{1 + t} t (t + u) (2t + 3u^2)\ dudt = \dfrac{16931}{3520}\)

    \(\text{Var} [Z] = E[Z^2] - E^2[Z] = \dfrac{2451039}{3097600}\) \(\text{Cov} [X,Z] = E[XZ] - E[X] E[Z] = \dfrac{94273}{387200}\)

    tuappr: [0 2] [0 3] 200 300 (3/88)*(2*t+3*u.^2).*(u<=1+t)
    G = 4*t.*(t<=1) + (t+u).*(t>1);
    EZ = total(G.*P)
    EZ = 3.2110
    EX = dot(X,PX)
    EX = 1.4220
    CV = total(G.*t.*P) - EX*EZ
    CV = 0.2445                       % Theoretical 0.2435
    VZ = total(G.^2.*P) - EZ^2
    VZ = 0.7934                       % Theoretical 0.7913

    Exercise \(\PageIndex{33}\)

    \(f_{XY} (t, u) = \dfrac{24}{11} tu\) for \(0 \le t \le 2\), \(0 \le u \le \text{min } \{1, 2 - t\}\) (see Exercise 27 and Exercise 38 from "Problems on Mathematical Expectation").

    \(Z = I_M (X,Y) (X + Y) + I_{M^c} (X, Y) 2Y\), \(M = \{(t, u): \text{max } (t, u) \le 1\}\)

    \(E[X] = \dfrac{52}{55}\), \(E[Z] = \dfrac{16}{55}\), \(E[Z^2] = \dfrac{39}{308}\)

    Determine \(\text{Var} [Z]\) and \(\text{Cov} [X, Z]\). Check with discrete approximation.

    Answer

    \(E[XZ] = \dfrac{24}{11} \int_0^1 \int_{t}^{1} t (t/2) tu \ dudt + \dfrac{24}{11} \int_{0}^{1} \int_{0}^{t} tu^2tu \ dudt \dfrac{24}{11} \int_1^2 \int_{0}^{2 - t} t tu^2 tu\ dudt= \dfrac{211}{770}\)

    \(\text{Var} [Z] = E[Z^2] - E^2[Z] = \dfrac{3557}{84700}\) \(\text{Cov} [Z,X] = E[XZ] - E[X] E[Z] = -\dfrac{43}{42350}\)

    tuappr:  [0 2] [0 1] 400 200 (24/11)*t.*u.*(u<=min(1,2-t))
    G = (t/2).*(u>t) + u.^2.*(u<=t);
    VZ = total(G.^2.*P) - EZ^2
    VZ =   0.0425
    CV = total(t.*G.*P) - EZ*dot(X,PX)
    CV = -9.2940e-04

    Exercise \(\PageIndex{34}\)

    \(f_{XY} (t, u) = \dfrac{3}{23} (t + 2u)\) for \(0 \le t \le 2\), \(0 \le u \le \text{max } \{2 - t, t\}\) (see Exercise 28 and Exercise 39 from "Problems on Mathematical Expectation").

    \(Z = I_M (X, Y) (X+Y) + I_{M^c} (X, Y) 2Y\), \(M = \{(t, u): \text{max } (t, u) \le 1\}\)

    \(E[X] = \dfrac{53}{46}\), \(E[Z] = \dfrac{175}{92}\), \(E[Z^2] = \dfrac{2063}{460}\)

    Determine \(\text{Var} [Z]\) and \(\text{Cov} [Z]\). Check with discrete approximation.

    Answer

    \(E[ZX] = \dfrac{3}{23} \int_{0}^{1} \int_{0}^{1} t (t + u) (t + 2u) \ dudt + \dfrac{3}{23} \int_{0}^{1} \int_{1}^{2 - t} 2tu(t + 2u) \ dudt +\)

    \(\dfrac{3}{23} \int_{1}^{2} \int_{1}^{t} 2tu(t + 2u)\ dudt = \dfrac{1009}{460}\)

    \(\text{Var} [Z] = E[Z^2] - E^2[Z] = \dfrac{36671}{42320}\) \(\text{Cov} [Z, X] = E[ZX] - E[Z] E[X] = \dfrac{39}{21160}\)

    tuappr:  [0 2] [0 2] 400 400 (3/23)*(t+2*u).*(u<=max(2-t,t))
    M = max(t,u)<=1;
    G = (t+u).*M + 2*u.*(1-M);
    EZ = total(G.*P);
    EX = dot(X,PX);
    CV = total(t.*G.*P) - EX*EZ
    CV =  0.0017

    Exercise \(\PageIndex{35}\)

    \(f_{XY} (t, u) = \dfrac{12}{179} (3t^2 + u)\), for \(0 \le t \le 2\), \(0 \le u \le \text{min } \{2, 3 - t\}\) (see Exercise 29 and Exercise 40 from "Problems on Mathematical Expectation").

    \(Z = I_M (X, Y) (X+Y) + I_{M^c} (X, Y) 2Y^2\), \(M = \{(t, u): t \le 1, u \ge 1\}\)

    \(E[X] = \dfrac{2313}{1790}\), \(E[Z] = \dfrac{1422}{895}\), \(E[Z^2] = \dfrac{28296}{6265}\)

    Determine \(\text{Var} [Z]\) and \(\text{Cov} [X, Z]\). Check with discrete approximation.

    Answer

    \(E[ZX] = \dfrac{12}{179} \int_{0}^{1} \int_{1}^{2} t (t + u) (3t^2 + u) \ dudt + \dfrac{12}{179} \int_{0}^{1} \int_{0}^{1} 2tu^2 (3t^2 + u) \ dudt +\)

    \(\dfrac{12}{179} \int_{1}^{2} \int_{0}^{3 - t} 2tu^2(3t^2 + u)\ dudt = \dfrac{24029}{12530}\)

    \(\text{Var} [Z] = E[Z^2] - E^2[Z] = \dfrac{11170332}{5607175}\) \(\text{Cov} [Z, X] = E[ZX] - E[Z] E[X] = -\dfrac{1517647}{11214350}\)

    tuappr:  [0 2] [0 2] 400 400 (12/179)*(3*t.^2 + u).*(u <= min(2,3-t))
    M = (t<=1)&(u>=1);
    G = (t + u).*M + 2*u.^2.*(1 - M);
    EZ = total(G.*P);
    EX = dot(X,PX);
    CV = total(t.*G.*P) - EZ*EX
    CV = -0.1347

    Exercise \(\PageIndex{36}\)

    \(f_{XY} (t, u) = \dfrac{12}{227} (3t + 2tu)\), for \(0 \le t \le 2\), \(0 \le u \le \text{min } \{1 + t, 2\}\) (see Exercise 30 and Exercise 41 from "Problems on Mathematical Expectation").

    \(Z = I_M (X, Y) X + I_{M^c} (X, Y) XY\), \(M = \{(t, u): u \le \text{min } (1, 2 - t)\}\)

    \(E[X] = \dfrac{1567}{1135}\), \(E[Z] = \dfrac{5774}{3405}\), \(E[Z^2] = \dfrac{56673}{15890}\)

    Determine \(\text{Var} [Z]\) and \(\text{Cov} [X, Z]\). Check with discrete approximation.

    Answer

    \(E[ZX] = \dfrac{12}{227} \int_{0}^{1} \int_{0}^{1} t^2 (3t + 2tu) \ dudt + \dfrac{12}{227} \int_{1}^{2} \int_{0}^{2-t} t^2(3t + 2tu) \ dudt +\)

    \(\dfrac{12}{227} \int_{0}^{1} \int_{1}^{1 + t} t^2 u(3t + 2tu)\ dudt + \dfrac{12}{227} \int_{1}^{2} \int_{2 - t}^{2} t^2 u(3t + 2tu)\ dudt = \dfrac{20338}{7945}\)

    \(\text{Var} [Z] = E[Z^2] - E^2[Z] = \dfrac{112167631}{162316350}\) \(\text{Cov} [Z, X] = E[ZX] - E[Z] E[X] = \dfrac{5915884}{27052725}\)

    tuappr: [0 2] [0 2] 400 400 (12/227)*(3*t + 2*t.*u).*(u <= min(1+t,2))
    EX = dot(X,PX);
    M = u <= min(1,2-t);
    G = t.*M + t.*u.*(1 - M);
    EZ = total(G.*P);
    EZX = total(t.*G.*P)
    EZX =  2.5597
    CV = EZX - EX*EZ
    CV =   0.2188
    VZ = total(G.^2.*P) - EZ^2
    VZ =   0.6907

    Exercise \(\PageIndex{37}\)

    (See Exercise 12.4.20, and Exercises 9 and 10 from "Problems on Functions of Random Variables"). For the pair \(\{X, Y\}\) in Exercise 12.4.20, let

    \(Z = g(X, Y) = 3X^2 + 2XY - Y^2\)

    \(W = h(X, Y) = \begin{cases} X & \text{for } X + Y \le 4 \\ 2Y & \text{for } X + Y > 4 \end{cases} = I_M (X, Y) X + I_{M^c} (X, Y) 2Y\)

    Determine the joint distribution for the pair \(\{Z, W\}\) and determine the regression line of \(W\) on \(Z\).

    Answer
    npr08_07
    Data are in X, Y, P
    jointzw
    Enter joint prob for (X,Y) P
    Enter values for X X
    Enter values for Y Y
    Enter expression for g(t,u) 3*t.^2 + 2*t.*u - u.^2
    Enter expression for h(t,u) t.*(t+u<=4) + 2*u.*(t+u>4)
    Use array operations on Z, W, PZ, PW, v, w, PZW
    EZ = dot(Z,PZ)
    EZ =    5.2975
    EW = dot(W,PW)
    EW =    4.7379
    VZ = dot(Z.^2,PZ) - EZ^2
    VZ =    1.0588e+03
    CZW = total(v.*w.*PZW) - EZ*EW
    CZW = -12.1697
    a = CZW/VZ
    a =   -0.0115
    b = EW - a*EZ
    b =    4.7988                 % Regression line: w = av + b
    

    This page titled 12.4: Problems on Variance, Covariance, Linear Regression is shared under a CC BY 3.0 license and was authored, remixed, and/or curated by Paul Pfeiffer via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.