🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: bit.listserv.stat-l
Article #3603

still more on autocorrelated vars

#3603
From: Evan Cooch
Date: Fri, 03 Jan 1992 16:44
155 lines
7400 bytes
I have had a number of people send me notes to the effect that  the
correct expression for the variance of autocorrelated variates is

Var(e(t))=(1+rho^2)*Var(e(t))

In a recent note, I stated that it was

Var(e(t))=(1+rho)*Var(e(t))

I unfairly attributed this to John Wiorkowski. In fact, the first
expression is the one that he sent in a note to me. I "decided" that his
expression must be in error since it "did not seem to work as written
(rho^2), but did seem to work with rho alone"...

 I am readily willing to accept that the first expression John  sent me
(using rho^2) is correct. However, I would like someone to explain the
following results.

To restate the problem, I want to generate "random" deviates that have
a given degree of autocorrelation and a predetermined variance of the
final distribution.

To create simple autocorrelated vaiables, I create autocorrelated
errors as
            e(t)=e(t)+rho*e(t-1)

Given that Var(E(t))=(1+rho^2)*Var(e(t)), I can rearrange to solve for
the variance of e(t) necessary to give me a final distribution of
deviates that has some desired variance. A simple numerical example...
Suppose I want to generate a set of deviates that have a first-order
autocorrelation of 0.6, and a variance of 0.8.

           0.8=(1+0.6^2)*var(e(t))

           var(e(t))=0.8/1.36
                    =0.588

Therefore, to create a data set with a variance of 0.8, the variance of
e(t) must be 0.588. To do this, I simply take a random normal deviate
and multiply by the standard deviation (0.767)..i.e x=normal(0)*0.767
gives me a normal distribution with mean 0, variance 0.588.

I then proceeded to test both equations (using rho or rho^2). I ran
simulations of 5000 iterations to generate sets of deviates for various
desired levels of rho (autocorrelation) and variance. I did this in SAS,
with the following code:

*;
*;
data test;
 do rho=0.6,0.7,0.8;
  do variance=0.9,1.1,1.3;
   lagerr=normal(0);
     do i=1 to 5000;
       err=lagerr*rho+(normal(0)*sqrt(variance/(1+rho**2)));
       output;
       lagerr=err;
      end;
     end;
end;
run;

Here are the results using rho, and rho^2

First, the autocorrelations. CORR = desired autocorrelation, and ESTCORR
is the correlation actually observed.


    using 1+rho                            using 1+rho**2

 RHO    VARIANCE     ESTRHO         RHO    VARIANCE     ESTRHO

 0.6       0.9      0.59917         0.6       0.9      0.59858
 0.6       1.1      0.59251         0.6       1.1      0.59353
 0.6       1.3      0.61582         0.6       1.3      0.59312
 0.7       0.9      0.69211         0.7       0.9      0.70187
 0.7       1.1      0.70551         0.7       1.1      0.68323
 0.7       1.3      0.68196         0.7       1.3      0.69621
 0.8       0.9      0.81103         0.8       0.9      0.79585
 0.8       1.1      0.78979         0.8       1.1      0.80356
 0.8       1.3      0.79724         0.8       1.3      0.79343

 As expected, using either rho or rho^2 gave equivalent reslts: the
resulting distributions were autocorrelated to the degree intended.

However, the results are different when considering variances of the
distributions:

 (a)  using 1+rho                           (b) using rho^2

----------------------------------   ----------------------------------
|     |           RHO            |   |     |           RHO            |
|     |--------------------------|   |     |--------------------------|
|     |  0.6   |  0.7   |  0.8   |   |     |  0.6   |  0.7   |  0.8   |
|     |--------+--------+--------|   |     |--------+--------+--------|
|     |  ERR   |  ERR   |  ERR   |   |     |  ERR   |  ERR   |  ERR   |
|     |--------+--------+--------|   |     |--------+--------+--------|
|     |  VAR   |  VAR   |  VAR   |   |     |  VAR   |  VAR   |  VAR   |
|-----+--------+--------+--------|   ------+--------+--------+--------|
|VAR  |        |        |        |   |VAR  |        |        |
-----------------------------------------------------------------------
|0.9  |0.891242|1.019925|1.503463|   |0.9  |1.026208|1.165960|1.461800|
|-----+--------+--------+--------|   |-----+--------+--------+--------|
|1.1  |1.059190|1.291327|1.629161|   |1.1  |1.206557|1.414280|1.953003|
|-----+--------+--------+--------|   |-----+--------+--------+--------|
|1.3  |1.328277|1.427954|1.964073|   |1.3  |1.486998|1.700098|2.129698|
----------------------------------   ----------------------------------

Two things are apparent: (1) using rho instead of rho^2 causes a
systematic bias in the estimated variance -> as rho increases, the
estimated variance increases. The results for using rho^2 are not clear.
(2) estimated variances using rho are closer to the desired variances
than were those obtained using rho^2. It was this latter result which
led me to assume that John Wiorkowski's original equation must have been
incorrect.

Although 5000 is a large sample, I also checked the distribution of
calculated variances. I ran 500 samples of 500 iterations, calculated
the estimated variance for each sample, and looked at its distribution.
I used rho=0.6 and desired variance of 0.9


                                using (1+rho^2)                              84

      Analysis Variable : ESTVAR


      N Obs    N       Minimum       Maximum          Mean       Std Dev
      ------------------------------------------------------------------
        100  100     0.8060762     1.2426885     1.0024917     0.0855134
      ------------------------------------------------------------------

                                 using (1+rho)                               85


      N Obs    N       Minimum       Maximum          Mean       Std Dev
      ------------------------------------------------------------------
        100  100     0.6858467     1.1149852     0.8782815     0.0731419
      ------------------------------------------------------------------

Again, the mean using rho is closer to the desired value than the mean
using rho^2.

Either I am missing something obvious (probably), or something else is
awry. Further illumination greatly appreciated.

           _///_
           -. .-
           ( L )    \////     +----------------------------+
         --(\=/)--  (   )     |       Evan G. Cooch        |
        /         \ /  /      |   Department of Biology    |
        I          V  /       | University of Pennsylvania |
        I            /        | Philadelphia, Pennsylvania |
        I           /         |       (215-898-7129)       |
                              +----------------------------+
Technical Details
Message-ID: <STAT-L%92010311481725@VM1.MCGILL.CA>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!swrinde!news.dell.com!paladin.american.edu!auvm!PENNSAS.UPENN.EDU!ECOOCH

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5efb,39cb33ae844367a7,start
X-Google-Attributes: gidf5efb,public
X-Google-ArrivalTime: 1992-01-03 09:01:55 PST
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!swrinde!news.dell.com!paladin.american.edu!auvm!PENNSAS.UPENN.EDU!ECOOCH
From: ECOOCH@PENNSAS.UPENN.EDU (Evan Cooch)
Newsgroups: bit.listserv.stat-l
Subject: still more on autocorrelated vars
Message-ID: <STAT-L%92010311481725@VM1.MCGILL.CA>
Date: 3 Jan 92 16:44:21 GMT
Sender: "STATISTICAL CONSULTING" <STAT-L@MCGILL1.BITNET>
Lines: 155
Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
X-To:         STAT-L@MCGILL1.BITNET, SAS-L@OHSTVMA.BITNET