Dear experts,
Hi, I am trying to generating panel model yit = 0.1yit-1 + x1it + x2it + zi + uit where yi0 ~ N (0,1), uit ~ N(0,1), z ~ N(0,1) t=1,...,20
The problems I am facing are,
(a) how can I write a code for uit~N(0,1)?
(b) how can I estimate of yit-1, x1, x2 by the fixed effect estimator using data t=1,2
(c) same with (b) but this time using data t=1,...,20
Is (b) and (c) is different? and why?
My stata saids insufficient observations for (c).
Please leave a comment for an advise. Thank you in advance.
The following is my code for this model,
code:
**(a)**
set obs 1000
gen i = _n
gen y = rnormal()
gen z = rnormal()
expand 20
sort i
by i: gen t=_n
gen v = rnormal()
gen x = rnormal
by i: replace y = 1 + 0.6*y[_n-1] + 1*x1 + 1*x2 + z + a + v if _n>1
by i: gen ym = y[_n-1]
**(b)**
order i t
xtset i t
sort t i
//t=1,...,20//
xtreg y ym x1 x2, fe
//t=1,2//
drop if t>2
xtreg y ym x1 x2, fe
Hi, I am trying to generating panel model yit = 0.1yit-1 + x1it + x2it + zi + uit where yi0 ~ N (0,1), uit ~ N(0,1), z ~ N(0,1) t=1,...,20
The problems I am facing are,
(a) how can I write a code for uit~N(0,1)?
(b) how can I estimate of yit-1, x1, x2 by the fixed effect estimator using data t=1,2
(c) same with (b) but this time using data t=1,...,20
Is (b) and (c) is different? and why?
My stata saids insufficient observations for (c).
Please leave a comment for an advise. Thank you in advance.
The following is my code for this model,
code:
**(a)**
set obs 1000
gen i = _n
gen y = rnormal()
gen z = rnormal()
expand 20
sort i
by i: gen t=_n
gen v = rnormal()
gen x = rnormal
by i: replace y = 1 + 0.6*y[_n-1] + 1*x1 + 1*x2 + z + a + v if _n>1
by i: gen ym = y[_n-1]
**(b)**
order i t
xtset i t
sort t i
//t=1,...,20//
xtreg y ym x1 x2, fe
//t=1,2//
drop if t>2
xtreg y ym x1 x2, fe