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]
st: how to interprete my monte carlo simulation results for cce estimation?
From
zhiqiang zhang <[email protected]>
To
[email protected]
Subject
st: how to interprete my monte carlo simulation results for cce estimation?
Date
Fri, 29 Apr 2011 17:17:54 +0800 (CST)
Dear statalist:
The following code is my program to probe the cce estimation property of a
panel regression, I try to simulate it with common factor loading. The target
beta is 1, My problems is that why the estimated beta is usually larger than 1,
My problems are as follows:
1. Is there any error in my code? Especially for simulate a panel dataset in
stata?
2. How to change it ?
Thank you very much!
global numsims 1000
global numobs 300
program simcce
version 11.2
tempname simfile
postfile `simfile' b2 se2 t2 bias using simresults, replace
quietly {
forvalues i = 1/$numsims {
drop _all
set obs $numobs
egen int id=seq(), from(1) to ($numobs) block(20)
sort id
by id: gen int time=_n
xtset id time
gen ft=rnormal() /* the factor loading */
gen a1=-0.5+int((2)*runiform()) /* the individual effect */
gen gama=0.5+int((2)*runiform())
gen ceta=0.5+int((2)*runiform())
gen epsilon=0.5+int((2)*runiform())
gen sigmax=0.5+int((2)*runiform())
gen residx=rnormal(0,sigmax)
gen x=gama*ft+ceta*ft+residx
gen u=epsilon*ft+rnormal()
gen y=x+a1+u
xtmg y x ,cce /* the cce estimation */
scalar b2 =_b[x]
scalar se2 = _se[x]
scalar t2 = (_b[x]-2)/_se[x]
scalar bias=_b[x]-1
post `simfile' (b2) (se2) (t2) (bias)
}
}
postclose `simfile'
end
simcce
Best Regards
Zhiqiang Zhang
Nankai University
[email protected]
[email protected]
*
* 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/