Following Carlo's track, I wonder whether a survey design - svy + weights - would'nt fit with your needs.
-
Login or Register
- Log in with
. sysuse auto.dta
(1978 Automobile Data)
. tab foreign
Car type | Freq. Percent Cum.
------------+-----------------------------------
Domestic | 52 70.27 70.27
Foreign | 22 29.73 100.00
------------+-----------------------------------
Total | 74 100.00
. g prob=0.50 if foreign==0
(22 missing values generated)
. replace prob=0.50 if foreign==1
(22 real changes made)
. regress price mpg i.rep78 [pw=1/prob]
(sum of wgt is 1.3800e+02)
Linear regression Number of obs = 69
F(5, 63) = 5.77
Prob > F = 0.0002
R-squared = 0.2584
Root MSE = 2605.8
------------------------------------------------------------------------------
| Robust
price | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
mpg | -280.2615 61.23892 -4.58 0.000 -402.6377 -157.8853
|
rep78 |
2 | 877.6347 1061.865 0.83 0.412 -1244.334 2999.603
3 | 1425.657 649.6622 2.19 0.032 127.4107 2723.903
4 | 1693.841 583.9808 2.90 0.005 526.8484 2860.834
5 | 3131.982 840.6517 3.73 0.000 1452.074 4811.891
|
_cons | 10449.99 1332.468 7.84 0.000 7787.266 13112.72
------------------------------------------------------------------------------
Comment