Professional Documents
Culture Documents
Performing T-Tests To Compare Autocorrelated Time Series Data Collected From Direct-Reading Instruments
Performing T-Tests To Compare Autocorrelated Time Series Data Collected From Direct-Reading Instruments
Performing T-Tests To Compare Autocorrelated Time Series Data Collected From Direct-Reading Instruments
To cite this article: Patrick O’Shaughnessy & Joseph E. Cavanaugh (2015) Performing
T-tests to Compare Autocorrelated Time Series Data Collected from Direct-Reading
Instruments, Journal of Occupational and Environmental Hygiene, 12:11, 743-752, DOI:
10.1080/15459624.2015.1044603
Industrial hygienists now commonly use direct-reading in- measurement to a previous measurement, or multiple previous
struments to evaluate hazards in the workplace. The stored measurements, results in a sample containing measurements
values over time from these instruments constitute a time that are no longer independent, which therefore violates a
series of measurements that are often autocorrelated. Given
the need to statistically compare two occupational scenarios fundamental assumption required for proper use of a t-test or
using values from a direct-reading instrument, a t-test must an ANOVA.
consider measurement autocorrelation or the resulting test will The issue of autocorrelation, or “serial correlation,” in suc-
have a largely inflated type-1 error probability (false rejection cessive measurements made in occupational settings has been
of the null hypothesis). A method is described for both the discussed in the literature. For the situation in which a contam-
one-sample and two-sample cases which properly adjusts for
autocorrelation. This method involves the computation of an inant is generated in a perfectly-mixed ventilated room, Roach
“equivalent sample size” that effectively decreases the actual (1977) explained that serial correlation will decrease exponen-
sample size when determining the standard error of the mean tially from perfect correlation between successive measure-
for the time series. An example is provided for the one-sample ments, r = 1, as the sample interval, t, increases relative to
case, and an example is given where a two-sample t-test is the room air changes per hour, N .(1) Or, to state the relationship
conducted for two autocorrelated time series comprised of
lognormally distributed measurements. in terms of the room residence time, τ = 1/N :
r = e−t/τ . (1)
Keywords autocorrelation, direct-reading, t test, time series
In this case, contaminant concentrations between succes-
sive samples become less randomly varied as the time between
Address correspondence to Patrick O’Shaughnessy, Occupational samples decreases and therefore become more serially corre-
and Environmental Health, College of Public Health, 100 CPHB, lated. Roach also mentioned that the instrument itself may have
S320, Iowa City, IA 52242; e-mail: patrick-oshaughnessy@uiowa.edu a “time constant” which does not allow it to instantaneously
react to an actual change in concentration and therefore adds
to the serial correlation between measurements.
INTRODUCTION Serial correlation in measurements made by industrial hy-
gienists has been described over the ensuing decades, but pri-
marily in the context of successive grab samples(2,3) or day-to-
W ith a wide variety of direct-reading instruments avail-
able to the industrial hygienist, they are now commonly
used to provide measurements as part of a study to compare
day samples(4-6) rather than those obtained from direct-reading
instruments. A review of recent literature on this subject re-
two or more conditions. In such cases, a t-test or an analysis of sulted in only one article by Klein-Entink et al. who described
variance (ANOVA) might be applied to determine the statis- the use of statistical techniques for the analysis of time series
tical significance of the difference(s) in mean levels of those to achieve valid comparisons between the means of contiguous
conditions. Proper application of those statistical techniques measurements made at the same location with a direct-reading
relies on the premise that the samples for each condition instrument separated by some change, or intervention, in a pro-
contain observations that have been randomly obtained from cess producing airborne contaminants.(7) That article provides
a population and are independent and normally distributed. methods, and realistic examples, associated with the develop-
However, as the sampling rate increases, the time between ment of autoregressive-integrated-moving average (ARIMA)
successive measurements decreases, and the likelihood of a models, which are then used to compensate for autocorrela-
subsequent measurement being related in magnitude to a pre- tion when performing a comparison of the means of adja-
vious measurement increases. This “autocorrelation” of one cent time series. ARIMA models were principally developed
measuring engineered nano-sized objects, Brouwer et al. em- measurements are similar to each other (φ → 1) as versus
phasized the need to account for autocorrelation in time- very dissimilar to each other (φ → −1); therefore, the methods
series data obtained from direct-reading instruments.(11) They described here are restricted to φ in the range, 0 < φ < 1.(4,13)
also recognized that many in the field of occupational health Rappaport suggested the use of the AR(1) process for
research do not have experience with the development of modeling the autocorrelation of a time series of contaminant
ARIMA models. In that regard, the purpose of this paper is to measurements when means to obtain a more definitive model
provide an alternative method for comparing the mean levels are not available.(5) No additional guidance could be found
of data sets comprised of autocorrelated time series that fit in the literature to verify this claim. However, a simplified
within the structure of commonly applied statistical methods. statistical method is described here to verify the application
To that end, this article will first present a general method and of the AR(1) model to a measurement time series. Given the
then provide an example of its use from data obtained in an estimate of r provided by Eq. (1), a general rule to enhance the
occupational setting. prospect that the resulting time series will constitute an AR(1)
process would be to limit the sample interval so that t/τ >
0.1 which corresponds to r < 0.9. This rule will not eliminate
Analysis of an Ideal AR(1) Time Series
autocorrelation, as r may still be high, but will aid in choosing
A brief introduction to time series analysis is necessary for a sample rate that is not so fast as to overly complicate the
understanding the methods to be described. An overview of resulting time series beyond that which can be modeled as
this subject in the context of occupational health is also given an AR(1) process. For example, given air changes per hour
by George et al.(4) A time series of measurements,y, from (N) between 2 - 12, the minimum sample interval would be
a direct-reading instrument will undoubtedly be affected by 3–0.5 min, respectively.
random perturbations in the level of the contaminant measured.
A simple model of such a series is:
Checking for Autocorrelation
yt = μ + εt , (2) Before proceeding with the methods described here, the
measurements obtained over time with a real-time instrument
where yt represents the value of the measurement time series should first be checked to determine whether they constitute a
y taken at a discrete point in time, t, which is acquired over a time series consisting of first-order autocorrelated data. When
uniformly spaced sample interval, t; μ is the mean level of performing linear regression analysis, it is assumed that the set
the measurements; and εt represents the random component of differences, e, between the predicted value of y for a given x,
of the measurement and, over all sample episodes, is a series ŷ, and the measured value of y, will be normally distributed and
of normally-distributed values with a mean of 0 and constant independent of each other, i.e., not autocorrelated. The Durbin-
variance, σ 2. If expressing the measurements as deviations Watson (D-W) test was designed to test the null hypothesis that
from the mean, as is common in time series analysis, this the set of differences, e = y − ŷ, are not autocorrelated. This
equation results in yt − μ = εt . Conventional testing and test can also be used to test for autocorrelation in a time series
estimation procedures for μ are based on the assumption that of n measurements by first regressing the measurements,yt , on
the εt values are serially uncorrelated. their corresponding time index, t. In the absence of a linear
If autocorrelation is present in the time series, the simplest, trend in the series, the autocorrelation in successive measured
and most intuitive, adjustment to that model is to include a term values,yt , is approximately the same as the autocorrelation
in which a previous measurement, yt−1 , influences the present in successive differences, et = yt − ŷt . The test involves
FIGURE 1. A randomly varying time series (A) and a series with autocorrelation (B). The bars represent the average of every five data values.
FIGURE 2. Relationship between the normally distributed series, ln(ξt ) (A), the normally distributed, autocorrelated series, ln(zt ) (B), and the
lognormally distributed, autocorrelated series, zt (C), when μg = 5 and φ = 0.7 applied to Eq. (14).
Incorporating Lognormally Distributed Data where μg is the geometric mean of all zt . Note that exponenti-
That measurements of airborne contaminants in occupa- ating both sides of Eq. (12) does not result in an equation with
tional settings are often lognormally distributed has been the same form as Eq. (3). Rather, the solution is:
recognized for decades.(18,19) Prior to performing a t-test on φ
zt = μ(1−φ)
g zt−1 ξt . (16)
randomly sampled data that are lognormally distributed, the
common practice is to first log-transform the values to achieve However, as was the case for a normally distributed, au-
normally distributed data sets that therefore meet the normality tocorrelated data series, the form of the mathematical model
assumption of the t-test. If the data are also autocorrelated, that best describes the data is not important when applying
the transformation will not remove the autocorrelation. As the methods described here to compensate for autocorrelation
shown in Figure 2, the log-transform (plot B) of a lognormally when performing a t-test. Here, the lag-1 autocorrelation coef-
distributed, autocorrelated series (plot C) still retains autocor- ficient, ρ̂1 , is computed for the normally distributed, autocor-
relation because the noise series, ξ t , analogous to εt in Eq. (3), related series, ln(zt ), using Eq. (5) for k = 1 for the one-sample
is lognormally distributed. When ξ t is log-transformed, ln(ξ t ), case, or Eq. (10) for the two-sample case, in order to adjust
a normally distributed series results (Figure 2, plot A). sample size using Eq. (7).
A lognormally distributed, autocorrelated data series, zt ,
must be modeled in a way analogous to that for normally
distributed, autocorrelated data by directly applying the log- ONE-SAMPLE T-TEST EXAMPLE
transformed values to Eq. (3):(20)
ln (zt ) = (1 − φ) ln μg + φ ln (zt−1 ) + ln (ξt ) , (15)
A set of measurements was created to demonstrate the
application of the one-sample t-test adjustment for au-
tocorrelated data described above. Using the model for an
FIGURE 4. Autocorrelation function (ACF) for the first seven lags. The “expected” curve indicates the magnitude of the ACF if it decayed in an
ideal manner from its value at lag-1 for an AR(1) process.
AR(1) process given in Eq. (3), a series of 200 normally- coefficients in the regression model (given as “k” in the tables,
distributed random numbers were generated (μ = 0, σ = 1), but not to be confused with the k used here to indicate the
and applied to the model given μ = 9.9 and φ = 0.7 (Figure 3). number of lags). Given the simple linear regression performed,
In this hypothetical case, the measurements represent aerosol there were 2 coefficients (intercept and slope). Therefore, the
concentrations in units of mg/m3 for which the occupational α = 0.05 table was consulted for n = 200, k = 2, which resulted
exposure limit (OEL) is 10 mg/m3. A one-side, single-sample in a lower critical value of 1.758. Given that the test statistic is
t-test is therefore applied to test whether the concentrations are less than the lower critical value, the null hypothesis that the
significantly less than 10 mg/m3 at the 5% significance level data are not autocorrelated was rejected.
(α = 0.05). A spreadsheet was also developed to calculate the auto-
Initial steps involved procedures to determine whether the correlation function (ACF) for the first 7 lags (ρ̂1 , . . . , ρ̂7 )
data values were autocorrelated. First a spreadsheet was de- with the use of Eq. (5). The resulting bar graph is given
veloped to perform a calculation of the D-W statistic. The in Figure 4. A curve is also applied to the graph to indi-
spreadsheet (Excel, Microsoft Corp., Redmond, WA) was used cate the expected decrease in the ACF given the relationship
to perform a linear regression of the data values on time. The between the ACF value for the first lag and all other lags,
resulting slope and intercept were used to develop a column ρ̂k ≈ ρ̂1k . The relatively close association between the bar
of predicted measurements, ŷ, and from which a column chart and the curve provides reasonable assurance that the
of residuals, et = yt − ŷt was created. Calculation of the measurements constitute an AR(1) process. Furthermore, if
D-W statistic was performed with a function that utilized the the ACF does not decay appreciably the time series may
SUMXMY2() function to compute the numerator of Eq. (4), be nonstationary and the methods described here cannot be
and the SUMSQ() function to compute the denominator and applied.
obtaining a result of 0.658. The table of critical values for the Given assurance that the time series contains first-order
D-W statistic is segregated by sample size and the number of autocorrelated values, the methods described here, which were
FIGURE 6. Calculated autocorrelation function (bars) and theoretical decay in the function (solid line) for the data series obtained at Station
1 and Station 3.