. us auto (1978 Automobile Data) . gen forXmpg=foreign*mpg . save, replace file auto.dta saved . fit price weight mpg forXmpg foreign Source | SS df MS Number of obs = 74 ---------+------------------------------ F( 4, 69) = 21.22 Model | 350319665 4 87579916.3 Prob > F = 0.0000 Residual | 284745731 69 4126749.72 R-square = 0.5516 ---------+------------------------------ Adj R-square = 0.5256 Total | 635065396 73 8699525.97 Root MSE = 2031.4 ------------------------------------------------------------------------------ price | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- weight | 4.613589 .7254961 6.359 0.000 3.166264 6.060914 mpg | 263.1875 110.7961 2.375 0.020 42.15528 484.2197 forXmpg | -307.2166 108.5307 -2.831 0.006 -523.7294 -90.70369 foreign | 11240.33 2751.681 4.085 0.000 5750.878 16729.78 _cons | -14449.58 4425.72 -3.265 0.002 -23278.65 -5620.51 ------------------------------------------------------------------------------ . cwhetero weight Score test (weight) = 15.236; chi-square p-value (df) = 0.000 (1) Score test (pred fit) = 6.502; chi-square p-value (df) = 0.011 (1) . qui fit price weight mpg forXmpg foreign . cwhetero mpg Score test (mpg) = 9.041; chi-square p-value (df) = 0.003 (1) Score test (pred fit) = 6.502; chi-square p-value (df) = 0.011 (1) . qui fit price weight mpg forXmpg foreign . cwhetero forX Score test (forXmpg) = 6.018; chi-square p-value (df) = 0.014 (1) Score test (pred fit) = 6.502; chi-square p-value (df) = 0.011 (1) . qui fit price weight mpg forXmpg foreign . cwhetero foreign Score test (foreign) = 6.152; chi-square p-value (df) = 0.013 (1) Score test (pred fit) = 6.502; chi-square p-value (df) = 0.011 (1) . qreg price weight mpg forXmpg foreign Iteration 1: WLS sum of weighted deviations = 109020.64 Iteration 1: sum of abs. weighted deviations = 135153.42 Iteration 2: sum of abs. weighted deviations = 104292.43 Iteration 3: sum of abs. weighted deviations = 98651.339 Iteration 4: sum of abs. weighted deviations = 98648.201 Iteration 5: sum of abs. weighted deviations = 98642.068 Median Regression Number of obs = 74 Raw sum of deviations 142205 (about 4934) Min sum of deviations 98642.07 Pseudo R2 = 0.3063 ------------------------------------------------------------------------------ price | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- weight | 4.059184 .7255319 5.595 0.000 2.611787 5.50658 mpg | 300.051 111.0571 2.702 0.009 78.49812 521.6039 forXmpg | -341.2507 109.1216 -3.127 0.003 -558.9423 -123.5591 foreign | 11798.8 2777.725 4.248 0.000 6257.387 17340.2 _cons | -13967.36 4434.737 -3.150 0.002 -22814.41 -5120.299 ------------------------------------------------------------------------------ . qreg price weight mpg forXmpg foreign, qu(.25) Iteration 1: WLS sum of weighted deviations = 78720.595 Iteration 1: sum of abs. weighted deviations = 81550.955 Iteration 2: sum of abs. weighted deviations = 75586.833 Iteration 3: sum of abs. weighted deviations = 73918.35 Iteration 4: sum of abs. weighted deviations = 68748.688 Iteration 5: sum of abs. weighted deviations = 66714.043 Iteration 6: sum of abs. weighted deviations = 66692.202 .25 Quantile Regression Number of obs = 74 Raw sum of deviations 83825.5 (about 4187) Min sum of deviations 66692.2 Pseudo R2 = 0.2044 ------------------------------------------------------------------------------ price | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- weight | 2.472779 .568349 4.351 0.000 1.338954 3.606604 mpg | 167.7557 95.13765 1.763 0.082 -22.03869 357.5501 forXmpg | -238.9792 83.00861 -2.879 0.005 -404.5769 -73.3816 foreign | 8058.494 2117.289 3.806 0.000 3834.619 12282.37 _cons | -6836.87 3674.53 -1.861 0.067 -14167.36 493.6174 ------------------------------------------------------------------------------ . qreg price weight mpg forXmpg foreign, qu(.75) nolog .75 Quantile Regression Number of obs = 74 Raw sum of deviations 159721.5 (about 6342) Min sum of deviations 96478.71 Pseudo R2 = 0.3960 ------------------------------------------------------------------------------ price | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- weight | 5.012891 2.257637 2.220 0.030 .5090284 9.516754 mpg | 371.2359 297.7902 1.247 0.217 -222.8393 965.311 forXmpg | -410.1289 236.9777 -1.731 0.088 -882.8864 62.62856 foreign | 13985.54 6179.698 2.263 0.027 1657.38 26313.7 _cons | -17220.22 12837 -1.341 0.184 -42829.34 8388.892 ------------------------------------------------------------------------------ . us weisflok, replace . fit photo observer Source | SS df MS Number of obs = 45 ---------+------------------------------ F( 1, 43) = 129.20 Model | 254769.46 1 254769.46 Prob > F = 0.0000 Residual | 84790.1845 43 1971.86476 R-square = 0.7503 ---------+------------------------------ Adj R-square = 0.7445 Total | 339559.644 44 7717.26465 Root MSE = 44.406 ------------------------------------------------------------------------------ photo | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- observer | .8825569 .0776439 11.367 0.000 .7259729 1.039141 _cons | 26.64957 8.614482 3.094 0.003 9.276814 44.02233 ------------------------------------------------------------------------------ . cwhetero observer Score test (observer) = 81.413; chi-square p-value (df) = 0.000 (1) Score test (pred fit) = 81.413; chi-square p-value (df) = 0.000 (1) . qreg photo observer, qu(.25) nolog .25 Quantile Regression Number of obs = 45 Raw sum of deviations 1530.5 (about 30) Min sum of deviations 843.8389 Pseudo R2 = 0.4487 ------------------------------------------------------------------------------ photo | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- observer | .6568421 .030217 21.737 0.000 .5959036 .7177806 _cons | 13.57895 5.218601 2.602 0.013 3.054636 24.10326 ------------------------------------------------------------------------------ . qreg photo observer, qu(.75) nolog .75 Quantile Regression Number of obs = 45 Raw sum of deviations 2653.5 (about 110) Min sum of deviations 863.6583 Pseudo R2 = 0.6745 ------------------------------------------------------------------------------ photo | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- observer | 1.616667 .0483278 33.452 0.000 1.519204 1.714129 _cons | 1.666667 5.987106 0.278 0.782 -10.40748 13.74082 ------------------------------------------------------------------------------ . us weisgas, replace . fit y x1-x4 Source | SS df MS Number of obs = 32 ---------+------------------------------ F( 4, 27) = 84.54 Model | 2520.27241 4 630.068101 Prob > F = 0.0000 Residual | 201.227595 27 7.45287388 R-square = 0.9261 ---------+------------------------------ Adj R-square = 0.9151 Total | 2721.50 31 87.7903226 Root MSE = 2.73 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- x1 | -.0286089 .0906015 -0.316 0.755 -.2145079 .1572901 x2 | .2158169 .067718 3.187 0.004 .076871 .3547628 x3 | -4.320052 2.850967 -1.515 0.141 -10.16975 1.52965 x4 | 8.97489 2.772632 3.237 0.003 3.28592 14.66386 _cons | 1.015018 1.861308 0.545 0.590 -2.804072 4.834107 ------------------------------------------------------------------------------ . cwhetero x1 Score test (x1) = 1.395; chi-square p-value (df) = 0.238 (1) Score test (pred fit) = 0.000; chi-square p-value (df) = 0.985 (1) . qui fit y x1-x4 . cwhetero x2 Score test (x2) = 0.298; chi-square p-value (df) = 0.585 (1) Score test (pred fit) = 0.000; chi-square p-value (df) = 0.985 (1) . qui fit y x1-x4 . cwhetero x3 Score test (x3) = 0.129; chi-square p-value (df) = 0.720 (1) Score test (pred fit) = 0.000; chi-square p-value (df) = 0.985 (1) . qui fit y x1-x4 . cwhetero x4 Score test (x4) = 0.010; chi-square p-value (df) = 0.922 (1) Score test (pred fit) = 0.000; chi-square p-value (df) = 0.985 (1) . qui fit y x1-x4 . cwhetero x1 x4 Score test (x1 x4) = 9.283; chi-square p-value (df) = 0.010 (2) Score test (pred fit) = 0.000; chi-square p-value (df) = 0.985 (1) . qui fit y x1-x4 . cwhetero x1-x4 Score test (x1 x2 x3 x4) = 10.299; chi-square p-value (df) = 0.036 (4) Score test (pred fit) = 0.000; chi-square p-value (df) = 0.985 (1) . qreg y x1-x4, qu(.25) nolog .25 Quantile Regression Number of obs = 32 Raw sum of deviations 168 (about 23) Min sum of deviations 44.83329 Pseudo R2 = 0.7331 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- x1 | -.1552402 .1298211 -1.196 0.242 -.4216111 .1111308 x2 | .146447 .0999777 1.465 0.155 -.0586904 .3515844 x3 | -4.235117 4.342822 -0.975 0.338 -13.14585 4.675617 x4 | 11.31711 4.460579 2.537 0.017 2.164755 20.46946 _cons | -.2245546 3.589906 -0.063 0.951 -7.590432 7.141323 ------------------------------------------------------------------------------ . qreg y x1-x4, qu(.75) nolog .75 Quantile Regression Number of obs = 32 Raw sum of deviations 198 (about 34) Min sum of deviations 48.25717 Pseudo R2 = 0.7563 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- x1 | .0350587 .2278425 0.154 0.879 -.4324355 .5025529 x2 | .2413283 .0964678 2.502 0.019 .0433927 .4392638 x3 | -2.251565 5.177429 -0.435 0.667 -12.87477 8.371642 x4 | 6.000321 3.439587 1.744 0.092 -1.057128 13.05777 _cons | 1.644168 3.25769 0.505 0.618 -5.040061 8.328396 ------------------------------------------------------------------------------