maandag 21 september 2015

Strongly balanced sample (Stata simulation)

clear
local base = 4      /* Set nr. of observations per units */
local size = 200    /* Set nr. of units */

*****
local tot = `size' + `base' - 1
di `tot'
set obs `tot'
gene id = floor(_n / `base')
gene time = `base'*(_n/`base' - id) + 1
drop if _n < `base'

*****
xtset id time