Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Generating clustered data
From
Stas Kolenikov <[email protected]>
To
[email protected]
Subject
Re: st: Generating clustered data
Date
Mon, 16 May 2011 20:50:13 -0500
On Mon, May 16, 2011 at 11:17 AM, John Antonakis <[email protected]> wrote:
> Would anyone have a code to generate data (panel) that is clustered and
> where the conditional variance depends on a cluster-level shock?
Oh, not again. Wasn't there a query about correlated data last week?
set obs 100
gen int clusterID = _n
gen u = rnormal()
expand 20
bysort clusterID : gen int t = _n
gen e = rnormal()*exp( 0.2*u - 1 )
gen y = u + e
Of course you can add xb to this y. Austin Nichols suggested to
generate xs to be clustered correlated, as well.
--
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/