Random numbers with exacty zero autocorrelation

Started by September 4, 2006
```Hi all,

I'm trying to simulate a small sample, say 15 numbers, of white noise. But
due to chance, the autocorrelation is not exactly 0. Of course the standard
deviation is also not exacty 1 but I can fix that. Is there transformation
to get rid of the unwanted autocorrelation??

Many thanks,

Jeroen

```
```jeroen_trip said the following on 04/09/2006 14:43:
> Hi all,
>
> I'm trying to simulate a small sample, say 15 numbers, of white noise. But
> due to chance, the autocorrelation is not exactly 0. Of course the standard
> deviation is also not exacty 1 but I can fix that. Is there transformation
> to get rid of the unwanted autocorrelation??

Firstly, how are you defining autocorrelation on such a small sequence?
Are you taking edge effects into account?

Secondly, why is it important that the autocorrelation for a given trial
be exactly zero (I assume you actually mean a delta function)?  Usually,
all we care about is that the *expected* autocorrelation is zero, i.e.
the "average" of the autocorrelations of all trials of the experiment.

--
Oli
```
```You may consider using maximum length sequences instead.

Oli Filth wrote:
> jeroen_trip said the following on 04/09/2006 14:43:
>> Hi all,
>>
>> I'm trying to simulate a small sample, say 15 numbers, of white noise.
>> But
>> due to chance, the autocorrelation is not exactly 0. Of course the
>> standard
>> deviation is also not exacty 1 but I can fix that. Is there
>> transformation
>> to get rid of the unwanted autocorrelation??
>
> Firstly, how are you defining autocorrelation on such a small sequence?
>  Are you taking edge effects into account?
>
> Secondly, why is it important that the autocorrelation for a given trial
> be exactly zero (I assume you actually mean a delta function)?  Usually,
> all we care about is that the *expected* autocorrelation is zero, i.e.
> the "average" of the autocorrelations of all trials of the experiment.
>
>

--

For emailing me, please exchange abuse by
a . l o d w i g

```
```
jeroen_trip wrote:
> Hi all,
>
> I'm trying to simulate a small sample, say 15 numbers, of white noise.

Any sequence of random numbers can be considered as a white noise.

> due to chance, the autocorrelation is not exactly 0.

Certainly. It will never be 0.

> Of course the standard
> deviation is also not exacty 1 but I can fix that. Is there transformation
> to get rid of the unwanted autocorrelation??

If you need short sequences with good autocorrelation properties, you
may want to look at Barker codes.

DSP and Mixed Signal Design Consultant

http://www.abvolt.com
```
```Andre said the following on 04/09/2006 15:54:
> Oli Filth wrote:
>> jeroen_trip said the following on 04/09/2006 14:43:
>>> Hi all,
>>>
>>> I'm trying to simulate a small sample, say 15 numbers, of white
>>> noise. But
>>> due to chance, the autocorrelation is not exactly 0. Of course the
>>> standard
>>> deviation is also not exacty 1 but I can fix that. Is there
>>> transformation
>>> to get rid of the unwanted autocorrelation??
>>
>> Firstly, how are you defining autocorrelation on such a small
>> sequence?  Are you taking edge effects into account?
>>
>> Secondly, why is it important that the autocorrelation for a given
>> trial be exactly zero (I assume you actually mean a delta function)?
>> Usually, all we care about is that the *expected* autocorrelation is
>> zero, i.e. the "average" of the autocorrelations of all trials of the
>> experiment.
>>
> You may consider using maximum length sequences instead.

Maximum length sequences don't have zero autocorrelation anywhere.

--
Oli
```
```>Firstly, how are you defining autocorrelation on such a small sequence?
>  Are you taking edge effects into account?
>
>Secondly, why is it important that the autocorrelation for a given trial

>be exactly zero (I assume you actually mean a delta function)?  Usually,

>all we care about is that the *expected* autocorrelation is zero, i.e.
>the "average" of the autocorrelations of all trials of the experiment.
>
>
>--
>Oli
>

Hi Oli,

I'm defining autocorrelation simply as average (xt-mu)*(xt-1-mu).

I'm using it for simulation purposes. If I can get the autocorrelation to
be exactly 0 I can use fewer simulations.

Jeroen
```
```Yes, but knowing it is exactly -1 everywhere except at t=0 might help as
well. The OP just wants to "get rid" of it, which could mean adding 1 is
acceptable for him to do.

Oli Filth wrote:
> Andre said the following on 04/09/2006 15:54:
>> Oli Filth wrote:
>>> jeroen_trip said the following on 04/09/2006 14:43:
>>>> Hi all,
>>>>
>>>> I'm trying to simulate a small sample, say 15 numbers, of white
>>>> noise. But
>>>> due to chance, the autocorrelation is not exactly 0. Of course the
>>>> standard
>>>> deviation is also not exacty 1 but I can fix that. Is there
>>>> transformation
>>>> to get rid of the unwanted autocorrelation??
>>>
>>> Firstly, how are you defining autocorrelation on such a small
>>> sequence?  Are you taking edge effects into account?
>>>
>>> Secondly, why is it important that the autocorrelation for a given
>>> trial be exactly zero (I assume you actually mean a delta function)?
>>> Usually, all we care about is that the *expected* autocorrelation is
>>> zero, i.e. the "average" of the autocorrelations of all trials of the
>>> experiment.
>>>
>> You may consider using maximum length sequences instead.
>
>
> Maximum length sequences don't have zero autocorrelation anywhere.
>
>
```
```jeroen_trip wrote:
> Hi all,
>
> I'm trying to simulate a small sample, say 15 numbers, of white noise. But
> due to chance, the autocorrelation is not exactly 0. Of course the standard
> deviation is also not exacty 1 but I can fix that. Is there transformation
> to get rid of the unwanted autocorrelation??

Randomness is a tricky concept. If you could devised an RNG that always
produces zero autocorrelation instead of random variation, you would
know it was far from random.

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
```
```Oli Filth wrote:
> Andre said the following on 04/09/2006 15:54:
>
> > You may consider using maximum length sequences instead.
>
>
> Maximum length sequences don't have zero autocorrelation anywhere.

they can be biased upward a little so that they are zero everywhere
except the zero lag and lags that are an integer multiple of the
period.

but that's using *circular* autocorrelation (that's how the edge
effects are dealt with, by wrapping it around.

if the OP wants to take a look at the math surrounding the MLS, there's
a little primer (or tutorial, i dunno which), at
http://www.dspguru.com/info/tutor/mls.htm .

>
> Any sequence of random numbers can be considered as a white noise.

so a sequence of random numbers we call "pink noise" can be considered
as a white noise?

> > due to chance, the autocorrelation is not exactly 0.
>
> Certainly. It will never be 0.

a pseudo-random number sequence can conceivably be constructed to do
that.  perhaps there is an old Bell Systems Journal that spells out
how.  i wouldn't be so certain as you, Vladimir.

r b-j

```
```robert bristow-johnson wrote:
> Oli Filth wrote:
> > Andre said the following on 04/09/2006 15:54:
> >
> > > You may consider using maximum length sequences instead.
> >
> >
> > Maximum length sequences don't have zero autocorrelation anywhere.
>
> they can be biased upward a little so that they are zero everywhere
> except the zero lag and lags that are an integer multiple of the
> period.

another thing that i forgot to point out is that the MLS is hardly a
random number since the sequence is all -1 and +1 (plus the small bias
mentioned above).  if you look at the p.d.f. function, it hardly looks
random having two dirac deltas at +/- 1.

```