Le mer. 20 janv. 2021 à 14:35, Riccardo (Jack) Lucchetti <
p002264(a)staff.univpm.it> a écrit :
Could you post a short example script showing the differences?
Thanks.
Dear Riccardo,
Not quite sure if this is what you asked for but here I am.
<hansl>
open greene12_1.gdt
list lx = const income ownrent selfemp
# some arbitrary weights
set seed 100
w = abs(normal(0,1))
wls w expend lx
# some arbitrary 0 weights
w0=w
w0[5]=0
w0[10]=0
w0[20]=0
wls w0 expend lx
series uhat=$uhat
series yhat=$yhat
smpl w0==0 --restrict
print expend w0 yhat uhat --byobs
</hansl>
Then, I exported the same data file to stata and executed the respective
Stata commands which provides the output below (to compare bay analogy,
with gretl's.
Hope it helps,
Best,
Artur
. use "/Users/user/Desktop/greene12_1.dta", clear
(Written by gretl 2021a)
. reg expend income ownrent selfemp [aw=w]
(sum of wgt is 8.2284e+01)
Source | SS df MS Number of obs =
100
-------------+------------------------------ F( 3, 96) =
5.65
Model | 949877.544 3 316625.848 Prob > F =
0.0013
Residual | 5382083.03 96 56063.3649 R-squared =
0.1500
-------------+------------------------------ Adj R-squared =
0.1235
Total | 6331960.58 99 63959.1977 Root MSE =
236.78
------------------------------------------------------------------------------
expend | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+----------------------------------------------------------------
income | 35.13955 14.01452 2.51 0.014 7.320954
62.95814
ownrent | 114.1856 52.52346 2.17 0.032 9.927328
218.4438
selfemp | 11.53469 110.0354 0.10 0.917 -206.8838
229.9532
_cons | 8.651678 52.43104 0.17 0.869 -95.42311
112.7265
------------------------------------------------------------------------------
. reg expend income ownrent selfemp [aw=w0]
(sum of wgt is 7.9537e+01)
Source | SS df MS Number of obs =
97
-------------+------------------------------ F( 3, 93) =
4.25
Model | 734603.026 3 244867.675 Prob > F =
0.0074
Residual | 5361805.11 93 57653.8184 R-squared =
0.1205
-------------+------------------------------ Adj R-squared =
0.0921
Total | 6096408.14 96 63504.2515 Root MSE =
240.11
------------------------------------------------------------------------------
expend | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+----------------------------------------------------------------
income | 32.59137 15.52483 2.10 0.038 1.762137
63.42059
ownrent | 109.6996 53.48384 2.05 0.043 3.491276
215.9079
selfemp | 16.04231 112.8278 0.14 0.887 -208.0113
240.0959
_cons | 20.00571 56.5598 0.35 0.724 -92.31083
132.3223
------------------------------------------------------------------------------
. quietly predict double yhat
. quietly predict double uhat, resid
. list expend w0 yhat uhat if w0==0
+--------------------------------------+
| expend w0 yhat uhat |
|--------------------------------------|
5. | 546.5 0 448.77476 97.725243 |
10. | 52.58 0 124.29808 -71.71808 |
20. | 0 0 130.81635 -130.81635 |
+--------------------------------------+