Hello, listers:
I am not sure whether it is a bug in Stata?
Before going on, I will like to post my code first, then that would be
easier to explain:
----Stata code begins here---
clear
set obs 10
set seed 1204
gen x1=uniform()
gen emusq1=uniform()
gen emu1=uniform()
gen x2=x1^2
local b01=0.02
local b11=0.3
local b21=-0.25
gen tmptau1=emusq1+`b01'^2+(`b11'^2)*(x1^2)+(`b21'^2)*(x1^4)-2*`b01'*emu1-2*
/*
*/
`b11'*emu1*x1-2*emu1*`b21'*x1^2+2*`b01'*`b11'*x1+2*`b01'*`b21'*x1^2+2*`b11'*
`b21'*x1^3
gen
tmptau1_alt=emusq1-2*emu1*(`b01'+`b11'*x1+`b21'*x2)+(`b01'+`b11'*x1+`b21'*x2
)^2
list tmptau1 tmptau1_alt
tab tmptau1
tab tmptau1_alt
---- Stata code ends here-----
Basically, what I am doing is to use two formula to generate variable.
The first variable, tmptau1, use the extended formula to generate variable
The second one, tmptau1_alt, use a non-extended formula to generate variable
Hypothetically, because these two formula are exactly the same, Stata should
return two equal variables. (i.e. tmptau1== tmptau1_alt)
However, when I list and tabulate these two variables.....(as list)
We can find that tmptau1 is not "EXACTLY" the same with tmptau1_alt.
Does anyone know the reason why?
Thanks
Jitian
. list tmptau1*
+---------------------+
tmptau1 tmptau~t
---------------------
1. .8692592 .8692592
2. .199401 .2181771
3. .0975708 .2075188
4. .1246213 .1309747
5. .6214758 .6345458
---------------------
6. .4019333 .4080512
7. .2606208 .2966675
8. .2964657 .3682937
9. .0604077 .0604092
10. .9241236 .9241688
+---------------------+
. tab tmptau1
tmptau1 Freq. Percent Cum.
.0604077 1 10.00 10.00
.0975708 1 10.00 20.00
.1246213 1 10.00 30.00
.199401 1 10.00 40.00
.2606208 1 10.00 50.00
.2964657 1 10.00 60.00
.4019333 1 10.00 70.00
.6214758 1 10.00 80.00
.8692592 1 10.00 90.00
.9241236 1 10.00 100.00
Total 10 100.00
. tab tmptau1_alt
tmptau1_alt Freq. Percent Cum.
.0604092 1 10.00 10.00
.1309747 1 10.00 20.00
.2075188 1 10.00 30.00
.2181771 1 10.00 40.00
.2966675 1 10.00 50.00
.3682937 1 10.00 60.00
.4080512 1 10.00 70.00
.6345458 1 10.00 80.00
.8692592 1 10.00 90.00
.9241688 1 10.00 100.00
Total 10 100.00
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/