Correlation section
This commit is contained in:
@@ -9,263 +9,6 @@
|
||||
</p>
|
||||
</introduction>
|
||||
|
||||
<section xml:id="sec-Correlation" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<title>Correlation</title>
|
||||
|
||||
<p>
|
||||
Text of section.
|
||||
</p>
|
||||
|
||||
<exercises xml:id="exercises-Correlation">
|
||||
<exercise>
|
||||
<statement>
|
||||
<p>
|
||||
Calculate the correlation of <m>X</m> and <m>Y</m>:
|
||||
</p>
|
||||
|
||||
<table>
|
||||
<title></title>
|
||||
|
||||
<tabular halign="center">
|
||||
<row header="yes" bottom="minor">
|
||||
<cell right="minor"></cell>
|
||||
<cell right="minor"><m>X = 1</m></cell>
|
||||
<cell><m>X = 2</m></cell>
|
||||
</row>
|
||||
|
||||
<row bottom="minor">
|
||||
<cell right="minor"><m>Y = 0</m></cell>
|
||||
<cell right="minor">0.12</cell>
|
||||
<cell>0.24</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell right="minor"><m>Y = 1</m></cell>
|
||||
<cell right="minor">0.3</cell>
|
||||
<cell>34</cell>
|
||||
</row>
|
||||
</tabular>
|
||||
</table>
|
||||
</statement>
|
||||
</exercise>
|
||||
|
||||
<exercise>
|
||||
<statement>
|
||||
<p>
|
||||
Calculate the correlation of <m>X</m> and <m>Y</m>:
|
||||
</p>
|
||||
|
||||
<table>
|
||||
<title></title>
|
||||
|
||||
<tabular halign="center">
|
||||
<row header="yes" bottom="minor">
|
||||
<cell right="minor"></cell>
|
||||
<cell right="minor"><m>X = 0</m></cell>
|
||||
<cell right="minor"><m>X = 1</m></cell>
|
||||
<cell><m>X = 2</m></cell>
|
||||
</row>
|
||||
|
||||
<row bottom="minor">
|
||||
<cell right="minor"><m>Y = 0</m></cell>
|
||||
<cell right="minor">0.08</cell>
|
||||
<cell right="minor">0.16</cell>
|
||||
<cell>0.1</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell right="minor"><m>Y = 1</m></cell>
|
||||
<cell right="minor">0.14</cell>
|
||||
<cell right="minor">0.2</cell>
|
||||
<cell>0.32</cell>
|
||||
</row>
|
||||
</tabular>
|
||||
</table>
|
||||
</statement>
|
||||
</exercise>
|
||||
|
||||
<exercise>
|
||||
<statement>
|
||||
<p>
|
||||
Suppose we roll a fair, 4-sided die two times.
|
||||
Let <m>X</m> be the sum of the rolls, and let <m>Y</m> be the product of the rolls.
|
||||
Find the correlation of <m>X</m> and <m>Y</m>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
[Note: Somewhat tedious.]
|
||||
</p>
|
||||
</statement>
|
||||
</exercise>
|
||||
</exercises>
|
||||
</section>
|
||||
|
||||
<section xml:id="sec-Linear-Regression" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<title>Linear Regression</title>
|
||||
|
||||
<p>
|
||||
Text of section.
|
||||
</p>
|
||||
|
||||
<exercises xml:id="exercises-Linear-Regression">
|
||||
<exercise>
|
||||
<statement>
|
||||
<p>
|
||||
A survey of local companies collects information about marketing budgets <m>X</m> and revenue <m>Y</m> (each measures in thousands of dollars), shown below.
|
||||
A linear regression gives the best linear fit as <m>Y = 18.28 X + 29.69</m>.
|
||||
What is the coefficient of determination <m>r^2</m>?
|
||||
</p>
|
||||
|
||||
<table>
|
||||
<title></title>
|
||||
|
||||
<tabular>
|
||||
<row header="yes" bottom="minor">
|
||||
<cell halign="right"><m>x_i</m></cell>
|
||||
<cell halign="right"><m>y_i</m></cell>
|
||||
<cell halign="right"><m>(y_i - \text{avg})^2</m></cell>
|
||||
<cell halign="right"><m>\text{pred } y_i</m></cell>
|
||||
<cell halign="right"><m>\text{res}^2</m></cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell halign="right">200</cell>
|
||||
<cell halign="right">4300</cell>
|
||||
<cell halign="right">2073600</cell>
|
||||
<cell halign="right">3686</cell>
|
||||
<cell halign="right">377377</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell halign="right">420</cell>
|
||||
<cell halign="right">7700</cell>
|
||||
<cell halign="right">3841600</cell>
|
||||
<cell halign="right">7707</cell>
|
||||
<cell halign="right">53</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell halign="right">270</cell>
|
||||
<cell halign="right">4500</cell>
|
||||
<cell halign="right">1537600</cell>
|
||||
<cell halign="right">4965</cell>
|
||||
<cell halign="right">216495</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell halign="right">380</cell>
|
||||
<cell halign="right">7000</cell>
|
||||
<cell halign="right">1587600</cell>
|
||||
<cell halign="right">6976</cell>
|
||||
<cell halign="right">572</cell>
|
||||
</row>
|
||||
|
||||
<row bottom="minor">
|
||||
<cell halign="right">300</cell>
|
||||
<cell halign="right">5200</cell>
|
||||
<cell halign="right">291600</cell>
|
||||
<cell halign="right">5514</cell>
|
||||
<cell halign="right">98401</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell halign="right">sum:</cell>
|
||||
<cell halign="right">28700</cell>
|
||||
<cell halign="right">9332000</cell>
|
||||
<cell halign="right">28848</cell>
|
||||
<cell halign="right">692898</cell>
|
||||
</row>
|
||||
</tabular>
|
||||
</table>
|
||||
</statement>
|
||||
</exercise>
|
||||
|
||||
<exercise>
|
||||
<statement>
|
||||
<p>
|
||||
A sample of 100 measurements are taken and a best fit line is calculated, resulting in the data below (the final line shows the sums for each column).
|
||||
Find the coefficient of determination.
|
||||
</p>
|
||||
|
||||
<table>
|
||||
<title></title>
|
||||
|
||||
<tabular>
|
||||
<row header="yes" bottom="minor">
|
||||
<cell halign="center"><m>x_i</m></cell>
|
||||
<cell halign="center"><m>y_i</m></cell>
|
||||
<cell halign="center"><m>\text{pred } y_i</m></cell>
|
||||
<cell halign="center"><m>(y - \text{avg})^2</m></cell>
|
||||
<cell halign="center"><m>\text{res}^2</m></cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell halign="center">38.00</cell>
|
||||
<cell halign="center">121.00</cell>
|
||||
<cell halign="center">93.17</cell>
|
||||
<cell halign="center">11.83</cell>
|
||||
<cell halign="center">774.33</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell halign="center">87.00</cell>
|
||||
<cell halign="center">241.00</cell>
|
||||
<cell halign="center">238.95</cell>
|
||||
<cell halign="center">13586.23</cell>
|
||||
<cell halign="center">4.22</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell halign="center">30.00</cell>
|
||||
<cell halign="center">61.00</cell>
|
||||
<cell halign="center">69.37</cell>
|
||||
<cell halign="center">4024.63</cell>
|
||||
<cell halign="center">70.12</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell halign="center">35.00</cell>
|
||||
<cell halign="center">85.00</cell>
|
||||
<cell halign="center">84.25</cell>
|
||||
<cell halign="center">1555.51</cell>
|
||||
<cell halign="center">0.57</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell halign="center">⋮</cell>
|
||||
<cell halign="center">⋮</cell>
|
||||
<cell halign="center">⋮</cell>
|
||||
<cell halign="center">⋮</cell>
|
||||
<cell halign="center">⋮</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell halign="center">33.00</cell>
|
||||
<cell halign="center">108.00</cell>
|
||||
<cell halign="center">78.30</cell>
|
||||
<cell halign="center">270.27</cell>
|
||||
<cell halign="center">882.19</cell>
|
||||
</row>
|
||||
|
||||
<row bottom="minor">
|
||||
<cell halign="center">26.00</cell>
|
||||
<cell halign="center">32.00</cell>
|
||||
<cell halign="center">57.47</cell>
|
||||
<cell halign="center">8545.15</cell>
|
||||
<cell halign="center">648.91</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell halign="center">sum:</cell>
|
||||
<cell halign="center">12444.00</cell>
|
||||
<cell halign="center">12444.00</cell>
|
||||
<cell halign="center">515206.64</cell>
|
||||
<cell halign="center">29789.80</cell>
|
||||
</row>
|
||||
</tabular>
|
||||
</table>
|
||||
</statement>
|
||||
</exercise>
|
||||
</exercises>
|
||||
</section>
|
||||
<xi:include href="./sec-Correlation.ptx"/>
|
||||
<xi:include href="./sec-Linear-Regression.ptx"/>
|
||||
</chapter>
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<pretext xml:lang="en-US" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<!-- we first include a file which contains the docinfo element: -->
|
||||
|
||||
@@ -0,0 +1,302 @@
|
||||
<section xml:id="sec-Correlation" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<title>Correlation</title>
|
||||
|
||||
<p>
|
||||
Recall <xref ref="def-covariance"/>, and our alternative formula
|
||||
<xref ref="thm-covariance-formula"/>, which says that:
|
||||
<md>
|
||||
<mrow> \Cov(X, Y) = \E\left[(X - \E(X))(Y - \E(Y))\right] \E\left(XY\right) - \E(X)\E(Y). </mrow>
|
||||
</md>
|
||||
One observation we made about the covariance is that, if <m>X</m> and
|
||||
<m>Y</m> tend to get bigger (than their respective averages) and smaller
|
||||
(than their respective averages) together, then <m>\Cov(X, Y)</m> will
|
||||
be positive.
|
||||
If one variable tends to get big while the other gets small,
|
||||
<m>\Cov(X, Y)</m> will be negative.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
However, it's not clear how to interpret the <em>magnitude</em> of
|
||||
<m>\Cov(X, Y)</m>.
|
||||
One thought that we might investigagte is to compare <m>\Cov(X, Y)</m>
|
||||
to <m>\Cov(10X, 10Y)</m> (or some other scaling factor).
|
||||
In principal, if we want to measure the tendency of <m>X</m> and
|
||||
<m>Y</m> to get big or small simultaneously, it would be nice if our
|
||||
measure wasn't simply confused by the scale of the values themselves.
|
||||
</p>
|
||||
|
||||
<example>
|
||||
<p>
|
||||
<md>
|
||||
<mrow> \Cov(10X, 10Y) \amp = \E(10X \cdot 10Y) - \E(10X)\E(10Y) </mrow>
|
||||
<mrow> \amp = 100 \E(XY) - 100 \E(X)\E(Y) </mrow>
|
||||
<mrow> \amp = 100 \left(\E(XY) - \E(X)\E(Y)\right)</mrow>
|
||||
<mrow> \amp = 100 \Cov(X, Y). </mrow>
|
||||
</md>
|
||||
So it seems that the magnitude of covariance is not necessarily
|
||||
meaningful; it can be confused by the scale of the values taken by
|
||||
the random variables.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
While we're at it, we might generalize the calculation above to see
|
||||
exactly how covariance responds to scalar multiplication:
|
||||
<md>
|
||||
<mrow> \Cov(\alpha X, \beta Y) \amp = \E(\alpha X \cdot \beta Y) - \E(\alpha X)\E(\beta Y) </mrow>
|
||||
<mrow> \amp = \alpha \beta \E(XY) - \alpha \beta \E(X)\E(Y) </mrow>
|
||||
<mrow> \amp = \alpha \beta \left(\E(XY) - \E(X)\E(Y)\right)</mrow>
|
||||
<mrow> \amp = \alpha \beta \Cov(X, Y). </mrow>
|
||||
</md>
|
||||
</p>
|
||||
</example>
|
||||
|
||||
<definition xml:id="def-correlation">
|
||||
<statement>
|
||||
<p>
|
||||
Let <m>X, Y</m> be random variables with nonzero standard
|
||||
deviations <m>\sigma_X, \sigma_Y</m>, respectively.
|
||||
The <term>correlation</term> of <m>X</m> and <m>Y</m> is:
|
||||
<md>
|
||||
<mrow> \rho_{X, Y} \amp = \frac{\Cov(X, Y)}{\sigma_X \sigma_Y} = \frac{\Cov(X, Y)}{\sqrt{\sigma_X^2 \sigma_Y^2}} </mrow>
|
||||
</md>
|
||||
</p>
|
||||
</statement>
|
||||
</definition>
|
||||
|
||||
<p>
|
||||
We first observe that standard deviations are never negative, so the
|
||||
sign of the correlation will always match the sign of the covariance.
|
||||
It remains to be seen whether the magnitude of the correlation can be
|
||||
usefully interpreted.
|
||||
</p>
|
||||
|
||||
<example>
|
||||
<p>
|
||||
Let's see how the correlation responds to scaling the random
|
||||
variables.
|
||||
We know <m>\Var(\alpha X) = \alpha^2 \Var(X)</m> and
|
||||
<m>\Var(\beta Y) = \beta^2 \Var(Y)</m>, so:
|
||||
<md>
|
||||
<mrow> \rho_{\alpha X, \beta Y} \amp = \frac{\Cov(\alpha X, \beta Y)}{\sqrt{\Var(\alpha X)\Var(\beta Y)}} </mrow>
|
||||
<mrow> \amp = \frac{\alpha \beta \Cov(X, Y)}{\sqrt{\alpha^2 \beta^2 \Var(X) \Var(Y)}} </mrow>
|
||||
<mrow> \amp = \frac{\alpha \beta \Cov(X, Y)}{|\alpha \beta| \sqrt{\Var(X) \Var(Y)}} </mrow>
|
||||
<mrow> \amp = \pm \rho_{X, Y}. </mrow>
|
||||
</md>
|
||||
Note the minus sign that could show up when you take the square root
|
||||
of the square of a constant.
|
||||
This makes perfect sense, conceptually: the sign information was
|
||||
meant to tell us whether <m>X</m> and <m>Y</m> get bigger together,
|
||||
or whether one gets bigger while the other gets smaller.
|
||||
If we multiply only one of them by a negative constant, we flip its
|
||||
values upside down, so it makes sense for the sign of both the
|
||||
covariance and the correlation to switch in this case.
|
||||
But the interesting thing here is the <em>magnitude</em>, which did
|
||||
not change when the individual random variables were scaled.
|
||||
This gives some hope that the magnitude of the correlation can be
|
||||
meaningfully interpreted.
|
||||
</p>
|
||||
</example>
|
||||
|
||||
<example>
|
||||
<p>
|
||||
Consider the joint and marginal distributions below (from
|
||||
<xref ref="example-joint-distribution"/>):
|
||||
</p>
|
||||
|
||||
<sidebyside>
|
||||
<table>
|
||||
<title/>
|
||||
<tabular halign="center">
|
||||
<row bottom="minor">
|
||||
<cell right="minor"/>
|
||||
<cell right="minor"><m>X = 0</m></cell>
|
||||
<cell><m>X = 1</m></cell>
|
||||
</row>
|
||||
|
||||
<row bottom="minor">
|
||||
<cell right="minor"><m>Y = 0</m></cell>
|
||||
<cell right="minor">0.2</cell>
|
||||
<cell>0.1</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell right="minor"><m>Y = 1</m></cell>
|
||||
<cell right="minor">0.2</cell>
|
||||
<cell>0.5</cell>
|
||||
</row>
|
||||
</tabular>
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<title/>
|
||||
<tabular halign="center">
|
||||
<row bottom="minor">
|
||||
<cell><m>x</m></cell>
|
||||
<cell><m>\Pr(X = x)</m></cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell>0</cell>
|
||||
<cell>0.4</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell>1</cell>
|
||||
<cell>0.6</cell>
|
||||
</row>
|
||||
</tabular>
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<title/>
|
||||
<tabular halign="center">
|
||||
<row bottom="minor">
|
||||
<cell><m>y</m></cell>
|
||||
<cell><m>\Pr(Y = y)</m></cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell>0</cell>
|
||||
<cell>0.3</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell>1</cell>
|
||||
<cell>0.7</cell>
|
||||
</row>
|
||||
</tabular>
|
||||
</table>
|
||||
</sidebyside>
|
||||
|
||||
<p>
|
||||
We previously calculated
|
||||
<m>\E(X) = 0.6, \E(Y) = 0.7, \Cov(X, Y) = 0.08</m>, so
|
||||
<m>\Var(X) = (0.6)(0.4) = 0.24</m> and
|
||||
<m>\Var(Y) = (0.7)(0.3) = 0.21</m>, and:
|
||||
<md>
|
||||
<mrow> \rho_{X, Y} = \frac{\Cov(X, Y)}{\sqrt{\Var(X) \Var(Y)}} = \frac{0.08}{\sqrt{(0.24)(0.21)}} \approx 0.356. </mrow>
|
||||
</md>
|
||||
</p>
|
||||
</example>
|
||||
|
||||
<example>
|
||||
<p>
|
||||
What can we say if <m>X</m> and <m>Y</m> are linearly related?
|
||||
Suppose <m>\E(X) = \mu</m> and <m>\Var(X) = \sigma^2</m>, and let
|
||||
<m>Y = aX + b</m>.
|
||||
Then:
|
||||
<md>
|
||||
<mrow> \E(Y) \amp = \E(aX + b) = a \E(X) + b = a \mu + b </mrow>
|
||||
<mrow> \Var(Y) \amp = \Var(aX + b) = a^2\Var(X) = a^2\sigma^2 </mrow>
|
||||
<mrow> \E(XY) \amp = \E(X(aX + b)) = \E(aX^2 + bX) = a \E(X^2) + b \mu </mrow>
|
||||
</md>
|
||||
Since <m>\Var(X) = \E(X^2) - (\E(X))^2</m>, we have
|
||||
<m>\E(X^2) = \Var(X) + (\E(X))^2</m>.
|
||||
Therefore:
|
||||
<md>
|
||||
<mrow> \E(XY) \amp = a(\sigma^2 + \mu^2) + b \mu = a\sigma^2 + a \mu^2 + b\mu </mrow>
|
||||
</md>
|
||||
Now we can calculate the covariance and correlation:
|
||||
<md>
|
||||
<mrow> \Cov(X, Y) \amp = \E(XY) - \E(X)\E(Y) </mrow>
|
||||
<mrow> \amp = a \sigma^2 + a\mu^2 + b\mu - \mu(a\mu + b) </mrow>
|
||||
<mrow> \amp = a \sigma^2 + a\mu^2 + b\mu - a\mu^2 - b\mu </mrow>
|
||||
<mrow> \amp = a \sigma^2 </mrow>
|
||||
<mrow> \rho_{X, Y} \amp = \frac{a \sigma^2}{\sqrt{\sigma^2 \cdot a^2\sigma^2}} </mrow>
|
||||
<mrow> \amp = \frac{a \sigma^2}{|a| \sigma^2} </mrow>
|
||||
<mrow> \amp = \pm 1. </mrow>
|
||||
</md>
|
||||
It is a fact (not justified here) that
|
||||
<m>-1 \leq \rho_{X, Y} \leq 1</m> always.
|
||||
So, the above calculation shows that random variables in a linear
|
||||
relationship to one another are maximally correlated.
|
||||
</p>
|
||||
</example>
|
||||
|
||||
<p>
|
||||
In the next section, we will investigate the ability of the correlation
|
||||
to capture linear relationships.
|
||||
</p>
|
||||
|
||||
<exercises xml:id="exercises-Correlation">
|
||||
<exercise>
|
||||
<statement>
|
||||
<p>
|
||||
Calculate the correlation of <m>X</m> and <m>Y</m>:
|
||||
</p>
|
||||
|
||||
<table>
|
||||
<title/>
|
||||
<tabular halign="center">
|
||||
<row header="yes" bottom="minor">
|
||||
<cell right="minor"/>
|
||||
<cell right="minor"><m>X = 1</m></cell>
|
||||
<cell><m>X = 2</m></cell>
|
||||
</row>
|
||||
|
||||
<row bottom="minor">
|
||||
<cell right="minor"><m>Y = 0</m></cell>
|
||||
<cell right="minor">0.12</cell>
|
||||
<cell>0.24</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell right="minor"><m>Y = 1</m></cell>
|
||||
<cell right="minor">0.3</cell>
|
||||
<cell>34</cell>
|
||||
</row>
|
||||
</tabular>
|
||||
</table>
|
||||
</statement>
|
||||
</exercise>
|
||||
|
||||
<exercise>
|
||||
<statement>
|
||||
<p>
|
||||
Calculate the correlation of <m>X</m> and <m>Y</m>:
|
||||
</p>
|
||||
|
||||
<table>
|
||||
<title/>
|
||||
<tabular halign="center">
|
||||
<row header="yes" bottom="minor">
|
||||
<cell right="minor"/>
|
||||
<cell right="minor"><m>X = 0</m></cell>
|
||||
<cell right="minor"><m>X = 1</m></cell>
|
||||
<cell><m>X = 2</m></cell>
|
||||
</row>
|
||||
|
||||
<row bottom="minor">
|
||||
<cell right="minor"><m>Y = 0</m></cell>
|
||||
<cell right="minor">0.08</cell>
|
||||
<cell right="minor">0.16</cell>
|
||||
<cell>0.1</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell right="minor"><m>Y = 1</m></cell>
|
||||
<cell right="minor">0.14</cell>
|
||||
<cell right="minor">0.2</cell>
|
||||
<cell>0.32</cell>
|
||||
</row>
|
||||
</tabular>
|
||||
</table>
|
||||
</statement>
|
||||
</exercise>
|
||||
|
||||
<exercise>
|
||||
<statement>
|
||||
<p>
|
||||
Suppose we roll a fair, 4-sided die two times.
|
||||
Let <m>X</m> be the sum of the rolls, and let <m>Y</m> be
|
||||
the product of the rolls.
|
||||
Find the correlation of <m>X</m> and <m>Y</m>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
[Note: Somewhat tedious.]
|
||||
</p>
|
||||
</statement>
|
||||
</exercise>
|
||||
</exercises>
|
||||
</section>
|
||||
@@ -52,7 +52,7 @@
|
||||
The joint distribution lets you find <m>\E(XY)</m>.
|
||||
</p>
|
||||
|
||||
<example>
|
||||
<example xml:id="example-joint-distribution">
|
||||
<statement>
|
||||
<p>
|
||||
Let <m>X</m> and <m>Y</m> be indicator random variables with joint and marginal distributions below.
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
<section xml:id="sec-Linear-Regression" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<title>Linear Regression</title>
|
||||
|
||||
<p>
|
||||
Text of section.
|
||||
</p>
|
||||
|
||||
<exercises xml:id="exercises-Linear-Regression">
|
||||
<exercise>
|
||||
<statement>
|
||||
<p>
|
||||
A survey of local companies collects information about marketing budgets <m>X</m> and revenue <m>Y</m> (each measures in thousands of dollars), shown below.
|
||||
A linear regression gives the best linear fit as <m>Y = 18.28 X + 29.69</m>.
|
||||
What is the coefficient of determination <m>r^2</m>?
|
||||
</p>
|
||||
|
||||
<table>
|
||||
<title></title>
|
||||
|
||||
<tabular>
|
||||
<row header="yes" bottom="minor">
|
||||
<cell halign="right"><m>x_i</m></cell>
|
||||
<cell halign="right"><m>y_i</m></cell>
|
||||
<cell halign="right"><m>(y_i - \text{avg})^2</m></cell>
|
||||
<cell halign="right"><m>\text{pred } y_i</m></cell>
|
||||
<cell halign="right"><m>\text{res}^2</m></cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell halign="right">200</cell>
|
||||
<cell halign="right">4300</cell>
|
||||
<cell halign="right">2073600</cell>
|
||||
<cell halign="right">3686</cell>
|
||||
<cell halign="right">377377</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell halign="right">420</cell>
|
||||
<cell halign="right">7700</cell>
|
||||
<cell halign="right">3841600</cell>
|
||||
<cell halign="right">7707</cell>
|
||||
<cell halign="right">53</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell halign="right">270</cell>
|
||||
<cell halign="right">4500</cell>
|
||||
<cell halign="right">1537600</cell>
|
||||
<cell halign="right">4965</cell>
|
||||
<cell halign="right">216495</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell halign="right">380</cell>
|
||||
<cell halign="right">7000</cell>
|
||||
<cell halign="right">1587600</cell>
|
||||
<cell halign="right">6976</cell>
|
||||
<cell halign="right">572</cell>
|
||||
</row>
|
||||
|
||||
<row bottom="minor">
|
||||
<cell halign="right">300</cell>
|
||||
<cell halign="right">5200</cell>
|
||||
<cell halign="right">291600</cell>
|
||||
<cell halign="right">5514</cell>
|
||||
<cell halign="right">98401</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell halign="right">sum:</cell>
|
||||
<cell halign="right">28700</cell>
|
||||
<cell halign="right">9332000</cell>
|
||||
<cell halign="right">28848</cell>
|
||||
<cell halign="right">692898</cell>
|
||||
</row>
|
||||
</tabular>
|
||||
</table>
|
||||
</statement>
|
||||
</exercise>
|
||||
|
||||
<exercise>
|
||||
<statement>
|
||||
<p>
|
||||
A sample of 100 measurements are taken and a best fit line is calculated, resulting in the data below (the final line shows the sums for each column).
|
||||
Find the coefficient of determination.
|
||||
</p>
|
||||
|
||||
<table>
|
||||
<title></title>
|
||||
|
||||
<tabular>
|
||||
<row header="yes" bottom="minor">
|
||||
<cell halign="center"><m>x_i</m></cell>
|
||||
<cell halign="center"><m>y_i</m></cell>
|
||||
<cell halign="center"><m>\text{pred } y_i</m></cell>
|
||||
<cell halign="center"><m>(y - \text{avg})^2</m></cell>
|
||||
<cell halign="center"><m>\text{res}^2</m></cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell halign="center">38.00</cell>
|
||||
<cell halign="center">121.00</cell>
|
||||
<cell halign="center">93.17</cell>
|
||||
<cell halign="center">11.83</cell>
|
||||
<cell halign="center">774.33</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell halign="center">87.00</cell>
|
||||
<cell halign="center">241.00</cell>
|
||||
<cell halign="center">238.95</cell>
|
||||
<cell halign="center">13586.23</cell>
|
||||
<cell halign="center">4.22</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell halign="center">30.00</cell>
|
||||
<cell halign="center">61.00</cell>
|
||||
<cell halign="center">69.37</cell>
|
||||
<cell halign="center">4024.63</cell>
|
||||
<cell halign="center">70.12</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell halign="center">35.00</cell>
|
||||
<cell halign="center">85.00</cell>
|
||||
<cell halign="center">84.25</cell>
|
||||
<cell halign="center">1555.51</cell>
|
||||
<cell halign="center">0.57</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell halign="center">⋮</cell>
|
||||
<cell halign="center">⋮</cell>
|
||||
<cell halign="center">⋮</cell>
|
||||
<cell halign="center">⋮</cell>
|
||||
<cell halign="center">⋮</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell halign="center">33.00</cell>
|
||||
<cell halign="center">108.00</cell>
|
||||
<cell halign="center">78.30</cell>
|
||||
<cell halign="center">270.27</cell>
|
||||
<cell halign="center">882.19</cell>
|
||||
</row>
|
||||
|
||||
<row bottom="minor">
|
||||
<cell halign="center">26.00</cell>
|
||||
<cell halign="center">32.00</cell>
|
||||
<cell halign="center">57.47</cell>
|
||||
<cell halign="center">8545.15</cell>
|
||||
<cell halign="center">648.91</cell>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<cell halign="center">sum:</cell>
|
||||
<cell halign="center">12444.00</cell>
|
||||
<cell halign="center">12444.00</cell>
|
||||
<cell halign="center">515206.64</cell>
|
||||
<cell halign="center">29789.80</cell>
|
||||
</row>
|
||||
</tabular>
|
||||
</table>
|
||||
</statement>
|
||||
</exercise>
|
||||
</exercises>
|
||||
</section>
|
||||
Reference in New Issue
Block a user