|
. do rqq.do
. preserve
. loc s=0
. mat b=J(19,4,.)
. forv i=0.05(0.05)1{
2. loc s=`s'+1
3. sysuse auto
4. qreg price weight, q(`i')
5. predictnl b=_b[weight], ci(lo up)
6. mat b[`s',1]=`i'
7. mat b[`s',2]=b[1]
8. mat b[`s',3]=lo[1]
9. mat b[`s',4]=up[1]
10. drop b l u
11. }
(1978 Automobile Data)
Iteration 1: WLS sum of weighted deviations = 48693.16
Iteration 1: sum of abs. weighted deviations = 50260.544
Iteration 2: sum of abs. weighted deviations = 42543.843
Iteration 3: sum of abs. weighted deviations = 35285.323
Iteration 4: sum of abs. weighted deviations = 19960.36
Iteration 5: sum of abs. weighted deviations = 18702.012
Iteration 6: sum of abs. weighted deviations = 18656.3
.05 Quantile regression Number of obs = 74
Raw sum of deviations 19975.1 (about 3667)
Min sum of deviations 18656.3 Pseudo R2 = 0.0660
------------------------------------------------------------------------------
price | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
weight | .4969697 .0910901 5.46 0.000 .315385 .6785544
_cons | 2250.394 254.9876 8.83 0.000 1742.085 2758.702
------------------------------------------------------------------------------
Warning: prediction constant over observations; perhaps you meant to run nlcom.
note: Confidence intervals calculated using t(72) critical values.
l ambiguous abbreviationr(111);
end of do-file
r(111);
运行结果
|