**Appendix B -- Outlier and Influential Observation Detection**

This section provides equations for determining outliers and influential
observations when using regression to predict a total from a sample. In
particular, assume that the operators in population are arranged in
descending order of natural gas production, labeling them from
$i = 1,\text{.}\text{.}\text{.},N$. The first "n" operators are selected
to be in the (cut-off) sample. $x_{i}$is the volume of gas produced by
company i during a previous time period. $x_{i}$is assumed to be known
for all operators in the population. $y_{i}$ is the volume of natural
gas produced by company *i* during the current time period. It is
assumed that these data follow the model:
$y_{i} = {\beta x}_{i} + e_{i}$. Then $\hat{\beta}$is estimated either
with ordinary least squares ($V(y_{i}) = \sigma^{2}$), or weighted least
squares ($V(y_{i}) = \sigma^{2}x_{i}$), providing an estimate for
production in the current time period for operators not in the sample,
${\hat{y}}_{i} = \hat{\beta}x_{i}$
($i = n + 1,\text{.}\text{.}\text{.},N$).

Hence the total gas production in the current time period is estimated
as

$$T = \sum_{i = 1}^{n}{y_{i} + \hat{\beta}\sum_{i = n + 1}^{N}x_{i}}$$

The first section below describes the procedures of using ordinary least
squares. The second section below describes the procedures for using a
specific version of weighted least squares. It is this second section
that leads to the ratio estimator we have been discussing. Hence, we
recommend that RPD test the equations provided in the second section.

**1. Ordinary Least Squares** ($V(y_{i}) = \sigma^{2}$).

**a. Detection of outliers.**

The residual for company *i* is given by
$e_{i} = y_{i} - \hat{\beta}x_{i}$ .

Where
$\hat{\beta} = \frac{\sum_{i = 1}^{n}{x_{i}y_{i}}}{\sum_{i = 1}^{n}x_{i^{2}}}$

The influence for company *i* is
$p_{\text{ii}} = \frac{x_{i^{2}}}{\sum_{i = 1}^{n}x_{i^{2}}}$.

The internally studentized residual (pg. 74) is
$r_{i} = \frac{e_{i}}{{\hat{\sigma}}_{1}\sqrt{1 - p_{\text{ii}}}}$. The
studentized residuals follow a standard normal distribution (if the
individual data follow a normal distribution). This fact is used to
determine suitable cut-off values for classifying an observation as an
outlier. We have been using 3.5 to define outliers. If the data actually
follow a normal distribution this will only classify about 0.05 percent
of the observations as outliers. However, in our experience, many more
observations than this are actually classified outliers using the EIA-23
data. The data reported by company *i* is an outlier if

$$\left| r_{i} \right| > 3\text{.}5$$

**b. Detection of influential observations.**

The externally studentized residual is defined to
be$r_{i^{}} = \frac{r_{i}\sqrt{n - 2}}{\sqrt{n - 1 - r_{i^{2}}}}$. This
version of the studentized residual can also be used to determine
outliers. However, it is most important as an intermediate value in
computing DFFITS, a measure of influence. An observation is influential
if it has a large impact on the estimated value of $\beta$.

$$\text{DFFITS} = \left| r_{i^{}} \right|\sqrt{\frac{p_{\text{ii}}}{1 - p_{\text{ii}}}}$$

A rule of thumb for classifying observations as influential is
$\text{DFFITS} > \frac{2}{\sqrt{n}}$.

Observations that are classified as outliers or influential are excluded
from the sample for purposes of computing $\beta$. Their data are still
used in estimating the total production (after verification by survey
staff that the data are accurate.)

**2. Weighted least squares** ($V(y_{i}) = \sigma^{2}x_{i}$)

With the equations below the estimated total can be rewritten as
follows:

$$T = \sum_{i = 1}^{n}{y_{i} + \hat{\beta}\sum_{i = n + 1}^{N}x_{i}} = n\overline{y} + \frac{n\overline{y}}{n\overline{x}}(X - n\overline{x}) = \frac{n\overline{y}}{n\overline{x}}X = \hat{\beta}X$$

or

$T = \frac{X}{n\overline{x}}n\overline{y}$.

**a. Detection of outliers.**

For outlier and influential detection redefine the following terms.

$e_{i} = \frac{y_{i} - \hat{\beta}x_{i}}{\sqrt{x_{i}}}$ ,

$\hat{\beta} = \frac{\sum_{i = 1}^{n}y_{i}}{\sum_{i = 1}^{n}x_{i}}$ ,

$p_{\text{ii}} = \frac{x_{i}}{\sum_{i = 1}^{n}x_{i}}$,

$r_{i} = \frac{e_{i}}{{\hat{\sigma}}_{2}\sqrt{1 - p_{\text{ii}}}}$,

and
$\sigma_{2^{2}} = \frac{1}{n - 1}\sum_{i = 1}^{n}\frac{(y_{i} - \hat{\beta}x_{i})^{2}}{x_{i}}$.

As noted above, we have been classifying the data reported by company
*i* as an outlier if

$$\left| r_{i} \right| > 3\text{.}5$$

For computing the influence statistic, compute the same equations as for
ordinary least squares but use the new definitions of $r_{i}$and
$p_{\text{ii}}$ from this section.

$r_{i^{}} = \frac{r_{i}\sqrt{n - 2}}{\sqrt{n - 1 - r_{i^{2}}}}$ and
$\text{DFFITS} = \left| r_{i^{}} \right|\sqrt{\frac{p_{\text{ii}}}{1 - p_{\text{ii}}}}$.

**b. Detection of influential observations**

A rule of thumb for classifying observations as influential is
$\text{DFFITS} > \frac{2}{\sqrt{n}}$.

Observations that are classified as outliers or influential are excluded
from the sample for purposes of computing $\beta$. Their data are still
used in estimating the total production (after verification by survey
staff that the data are accurate.) Hence the estimate for the total
would be written as follows:

$$T = \sum_{i = 1}^{n}{y_{i} + \hat{\beta}\sum_{i = n + 1}^{N}x_{i}} = n\overline{y} + \frac{\sum_{i \in s}^{}y_{i}}{\sum_{i \in s}^{}x_{i}}(X - n\overline{x})$$

Note that with outliers and influential observations removed, the
equation does not simplify quite as nicely. $i \in s$denotes sampled
data that are not outliers or influential observations. $n\overline{x}$
and $n\overline{y}$denote the total from the sampled operators in the
previous time period and the present time period respectively -- these
totals include influential observations and outliers.