# st: RE: re: how do I generate fake time series data?

 From "Nick Winter" To Subject st: RE: re: how do I generate fake time series data? Date Fri, 21 Feb 2003 12:29:48 -0500

```How about something like:

. set obs 100000
. gen t1=invnorm(uniform())
. gen t2=.4*t1+invnorm(uniform())
. gen t3=.4*t2+invnorm(uniform())
. gen t4=.4*t3+invnorm(uniform())
. ...

You would have to play with the multiplier, but that will give you a lag
structure with diminishing correlation, I think.

--Nick Winter

-----------------------------------------------------------
Nicholas Winter, Ph.D.                     P 202.939.5343
Policy Studies Associates                  F 202.939.5732
1718 Connecticut Avenue, NW     nwinter@policystudies.com
Washington, DC 20009-1148           www.policystudies.com
-----------------------------------------------------------

> -----Original Message-----
> From: David Airey [mailto:david.airey@Vanderbilt.Edu]
> Sent: Friday, February 21, 2003 12:13 PM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: re: how do I generate fake time series data?
>
>
> I did not get a response to my question of how one generates
> fake time
> series data with a particular lag correlation in it.
>
> In Stata, to generate a matrix with a particular correlation
> structure,
> I can type:
>
>      . mat C = (1, .5 \ .5, 1)
>      . corr2data x y, n(2000) corr(C)
>      . correlate x y
> (obs=2000)
>
>               |        x        y
> -------------+------------------
>             x |   1.0000
>             y |   0.5000   1.0000
>
> I thought time series data with a particular lag meant the
> correlation
> was essentially diminished or not present beyond that lag, such that:
>
>
>      t1  t2  t3  t4  t5
> t1   1  .7  .2  .1  .0
> t2  .7   1  .7  .2  .1
> t3  .2  .7   1  .7  .2
> t4  .1  .2  .7   1  .7
> t5  .0  .1  .2  .7   1
>
> might represent a lag 1 correlation in 5 time points? So I
> guess I have
> to enter a large matrix statement (100 x 100), if I want, say
> 100 time
> points, just like above?
>
> Before that, I tried the above matrix by:
>
> . clear
>
> . mat C = (1,  .7,  .2,  .1,  .0 \ ///
>  >  .7,   1,  .7,  .2,  .1 \ ///
>  >   .2,  .7,   1,  .7,  .2 \ ///
>  >   .1,  .2,  .7,   1,  .7  \ ///
>  >   .0,  .1,  .2,  .7,   1)
>
> . mat list C
>
> symmetric C[5,5]
>      c1  c2  c3  c4  c5
> r1   1
> r2  .7   1
> r3  .2  .7   1
> r4  .1  .2  .7   1
> r5   0  .1  .2  .7   1
>
> . corr2data t1 t2 t3 t4 t5, n(1000) corr(C)
> matrix not positive definite
> r(506);
>
> What does this mean?
>
> -Dave
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```