Code:
program define bugtest
version 13
syntax varlist [if]
marksample touse
gettoken depvar indepvars : varlist
mata: st_view(y = ., ., "`depvar'", "`touse'")
mata: y
quietly xtreg `depvar' `indepvars', fe
mata: y
end
bugtest n w if id <= 2
Code:
1
+---------------+
1 | 1.617604494 |
2 | 1.722766638 |
3 | 1.612433434 |
4 | 1.550748944 |
5 | 1.409278154 |
6 | 1.15246892 |
7 | 1.077048182 |
8 | 4.2671628 |
9 | 4.257638931 |
10 | 4.2615242 |
11 | 4.277096748 |
12 | 4.299853802 |
13 | 4.282468796 |
14 | 4.227096558 |
+---------------+
1
+---------------+
1 | 95.7071991 |
2 | 97.35690308 |
3 | 99.60829926 |
4 | 100.5501022 |
5 | 99.55809784 |
6 | 98.61509705 |
7 | 100.030098 |
8 | 95.7071991 |
9 | 97.35690308 |
10 | 99.60829926 |
11 | 100.5501022 |
12 | 99.55809784 |
13 | 98.61509705 |
14 | 100.030098 |
+---------------+
This problem does not occur if I use the random-effects estimator (i.e. xtreg without option fe) and it also does not occur if I replace version 13 by version 14 (or version 15) in the first line of the program. Interestingly, the problem does not occur either under Stata 14 even if I keep the version 13 statement.
Can anyone replicate this problem?
0 Response to Odd Stata/Mata bug when using xtreg, fe in a program together with Mata views under version control
Post a Comment