# Statistical Inference for Everyone: Technical Supplement

This document is the technical supplement, for instructors, for Statistical Inference for Everyone, the introductory statistical inference textbook from the perspective of "probability theory as logic".

## Estimating the Ratio of Two Variances $\kappa\equiv \sigma_x^2/\sigma_y^2$

$\newcommand{\bvec}[1]{\mathbf{#1}}$

From Estimating the Deviation we have \begin{eqnarray} p(\sigma_x|\bvec{x},I)&\propto& \frac{1}{\sigma_x^{n}}e^{-V_x/2\sigma_x^2} \end{eqnarray} For independent $\bvec{x}$ and $\bvec{y}$ we have \begin{eqnarray} p(\sigma_x,\sigma_y|\bvec{x},\bvec{y},I)&\propto& \frac{1}{\sigma_x^{n}}\frac{1}{\sigma_y^{m}} e^{-V_x/2\sigma_x^2}e^{-V_y/2\sigma_y^2} \end{eqnarray} Changing variables to $\kappa\equiv \sigma_x^2/\sigma_y^2$, we have the following definitions \begin{eqnarray} \kappa&\equiv& \sigma_x^2/\sigma_y^2 \\\\ \sigma_x&=&\sigma_y \kappa^{1/2} \\\\ \sigma_y&=&\sigma_x \kappa^{-1/2} \end{eqnarray} and then transform the posterior \begin{eqnarray} p(\kappa,\sigma_x|\bvec{x},\bvec{y},I)&=& p(\sigma_x,\sigma_y|\bvec{x},\bvec{y},I)\times \left|\frac{\partial(\sigma_x,\sigma_y)}{\partial(\kappa,\sigma_x)}\right| \\\\ &=& p(\sigma_x,\sigma_y|\bvec{x},\bvec{y},I)\times \left| \begin{array}{cc} \frac{\partial\sigma_x}{\partial \kappa} & \frac{\partial \sigma_x}{\partial \sigma_x}\\\\ \frac{\partial\sigma_y}{\partial \kappa} & \frac{\partial \sigma_y}{\partial \sigma_x} \\\\ \end{array} \right|\\\\ &=& p(\sigma_x,\sigma_y|\bvec{x},\bvec{y},I)\times \left| \begin{array}{cc} \frac{1}{2}\sigma_y \kappa^{-1/2} & 1 \\\\ -\frac{1}{2}\sigma_x \kappa^{-3/2} & 0 \end{array} \right|\\\\ &\propto&\frac{1}{\sigma_x^{n}}\frac{\kappa^{m/2}}{\sigma_x^{m}} e^{-V_x/2\sigma_x^2}e^{-V_y\kappa/2\sigma_x^2} \sigma_x \kappa^{-3/2} \end{eqnarray} Now we integrate out the nuisance parameter, $\sigma_x$, to get

\begin{eqnarray} p(\kappa|\bvec{x},\bvec{y},I)&=&\int d\sigma_x p(\kappa,\sigma_x|\bvec{x},\bvec{y},I) \\\\ &\propto& \kappa^{(m-3)/2} \int d\sigma_x \frac{1}{\sigma_x^{n+m-1}} e^{-(V_x+V_y\kappa)/2\sigma_x^2} \end{eqnarray}

from the gaussian integral trick we get

\begin{eqnarray} p(\kappa|\bvec{x},\bvec{y},I)&\propto&\kappa^{(m-3)/2} (V_x+V_y\kappa)^{(n+m-2)/2} \end{eqnarray}

A more common form is found with the substitutions \begin{eqnarray} \eta &\equiv&\kappa\times \frac{(V_y/f_y)}{(V_x/f_x)} \\\\ f_x&\equiv&n-1 \\\\ f_y&\equiv&m-1 \end{eqnarray}

from which it follows \begin{eqnarray} p(\eta|\bvec{x},\bvec{y},I)&\propto& \eta^{\frac{f_y}{2}-1} (f_x+f_y\eta)^{(f_x+f_y)/2} \end{eqnarray} which is the commonly used F distribution.



In [8]:

from IPython.core.display import HTML

def css_styling():
return HTML(styles)
css_styling()




Out[8]:

@font-face {
font-family: "Computer Modern";
src: url('http://mirrors.ctan.org/fonts/cm-unicode/fonts/otf/cmunss.otf');
}
@font-face {
font-family: "Computer Modern";
src: url('http://mirrors.ctan.org/fonts/cm-unicode/fonts/otf/cmunsx.otf');
font-weight: bold;
}
@font-face {
font-family: "Computer Modern";
src: url('http://mirrors.ctan.org/fonts/cm-unicode/fonts/otf/cmunsi.otf');
font-style: italic, oblique;
}
@font-face {
font-family: "Computer Modern";
src: url('http://mirrors.ctan.org/fonts/cm-unicode/fonts/otf/cmunbxo.otf');
font-weight: bold;
font-style: italic, oblique;
}

div.cell{
width:800px;
margin-left:16% !important;
margin-right:auto;
}
h1 {
font-family: Garamond, Times, serif;
}
h4{
margin-top:12px;
margin-bottom: 3px;
}
div.text_cell_render{
font-family: Garamond, Times, serif;
line-height: 145%;
font-size: 130%;
width:800px;
margin-left:auto;
margin-right:auto;
}
.CodeMirror{
font-family: "Source Code Pro", source-code-pro,Consolas, monospace;
}
.prompt{
display: None;
}
.text_cell_render h5 {
font-weight: 300;
font-size: 22pt;
color: #4057A1;
font-style: italic;
margin-bottom: .5em;
margin-top: 0.5em;
display: block;
}

.warning{
color: rgb( 240, 20, 20 )
}

MathJax.Hub.Config({
TeX: {
extensions: ["AMSmath.js"]
},
tex2jax: {
inlineMath: [ ['$','$'], ["\$","\$"] ],
displayMath: [ ['$$','$$'], ["\$","\$"] ]
},
displayAlign: 'center', // Change this to 'center' to center equations.
"HTML-CSS": {
styles: {'.MathJax_Display': {"margin": 4}}
}
});