Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: replacing values in panel data


From   billy mairs <mairs8@hotmail.com>
To   statalist <statalist@hsphsun2.harvard.edu>
Subject   st: replacing values in panel data
Date   Wed, 27 Jul 2011 12:53:28 +0000

Dear reader, 

I have a panel data set and wish to replace multiple values over the different cross sections.
 
Say the panel data is N=20 and T=5. I have 5 values for a standard normal error term ‘u’ (for every t) for my first panel, say i = 1. I want to copy these 5 values into the other cross section units, so that u is the same in the other 19 panels as it is in my first panel. Here is what I have come up with so far
 
clear all
set obs 20
gen i = _n
expand 5
sort i
by i: gen t=_n
tsset i t
gen x = rnormal()
gen u = rnormal() in 1/5
br
 
How would I then copy the values for u into the missing values so that at each t, u is the same across the panels?
I hope to then use the command
 
replace u = (0.5)*u + ((1-0.25)^0.5)*rnormal() if i>1
 
in order to create dependence in error terms across the panels. Thanks for your time 		 	   		  
*
*   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/


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