Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

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


From   David Airey <david.airey@Vanderbilt.Edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: re: how do I generate fake time series data?
Date   Fri, 21 Feb 2003 11:12:37 -0600

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/




© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index