# How do you calculate r squared by hand?

May 31, 2015

Assuming this is a general question and not a reference to some undeclared statistical equation,

and assuming you know how to multiply two numbers together by hand,

then $r$ squared (often written ${r}^{2}$) is simply
$\textcolor{w h i t e}{\text{XXXXX}}$$r \times r$ for whatever the value of $r$ is

For example if $r = 16$
then $r$ squared (or ${r}^{2}$) $= 16 \times 16 = 256$

However I suspect you had some specific statistical relationship in mind; please resubmit with explicit references if this is the case.

${r}^{2} = 1 - \frac{S {S}_{E r r}}{S {S}_{T o t}}$

#### Explanation:

The $S {S}_{E r r}$ or the sum of squares residuals is:
$\setminus \sum {y}_{i}^{2} - {B}_{0} \setminus \sum {y}_{i} - {B}_{1} \setminus \sum {x}_{i} {y}_{i}$
or
simply the square of the value of the residuals. The residual value is difference between the obtained y-value and the expected y-value. The expected y-value is the calculated value from the equation of line/plane.

For example, for a system with 1 unknown parameter/variable x, the calculated y-value would be the sum of ${B}_{0} \mathmr{and} {B}_{1} x$ (i.e. $Y = {B}_{0} + {B}_{1} x$).

For a system with 2 unknown parameters/variables, ${x}_{1}$ and ${x}_{2}$, the calculated y-value would be the sum of ${B}_{0}$, ${B}_{1} x$, and ${B}_{2} {x}_{2}$ (i.e. $Y = {B}_{0} + {B}_{1} {x}_{1} + {B}_{2} {x}_{2}$).

And in general, $Y = {B}_{0} + {B}_{1} {x}_{1} + {B}_{2} {x}_{2} + {B}_{3} {x}_{3} + {B}_{4} {x}_{4} + \ldots + {B}_{n} {x}_{n}$

Furthermore, the $S {S}_{T o t} = \setminus \sum {y}_{i}^{2} - \frac{{\left(\sum {y}_{i}\right)}^{2}}{n}$ where $n$ is the number of observations or trials.