As Weisberg formulates the problem, the. infile p x y esd using alr085 (10 observations read)

. generate wt = 1/esd^2

Note that these frequency weights must, by definition, be positive integers.]regress y x [fweight=freq]

When we compare this output to Table 4.2 in ALR, we see that the parameter estimates for b. regress y x [aweight = wt] (sum of wgt is 2.3230e-01) Source | SS df MS Number of obs = 10 ---------+------------------------------ F( 1, 8) = 124.63 Model | 14721.8925 1 14721.8925 Prob > F = 0.0000 Residual | 945.00803 8 118.126004 R-squared = 0.9397 ---------+------------------------------ Adj R-squared = 0.9321 Total | 15666.9006 9 1740.76673 Root MSE = 10.869 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- x | 530.8354 47.55003 11.164 0.000 421.1849 640.486 _cons | 148.4732 8.078651 18.378 0.000 129.8438 167.1026 ------------------------------------------------------------------------------

While this is cumbersome, it can certainly be done. This emphasizes, however, that(118.12) x [(2.3230e-01) / 10] = 2.744

. gen w = sqrt(wt)

. gen yw = y*w

. gen xw = x*w

At first glance, this output looks better in terms of reproducing Table 4.2. Not only are the regression coefficients and their standard errors correct, the residual variance estimate is now correct as well. Unfortunately, the F statistic is now enormous, and somehow R. regress yw xw w, noconstant Source | SS df MS Number of obs = 10 ---------+------------------------------ F( 2, 8) = 2303.24 Model | 12640.58 2 6320.28999 Prob > F = 0.0000 Residual | 21.9526539 8 2.74408174 R-squared = 0.9983 ---------+------------------------------ Adj R-squared = 0.9978 Total | 12662.5326 10 1266.25326 Root MSE = 1.6565 ------------------------------------------------------------------------------ yw | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- xw | 530.8354 47.55003 11.164 0.000 421.1849 640.486 w | 148.4732 8.078651 18.378 0.000 129.8438 167.1026 ------------------------------------------------------------------------------

Once you have determined that this .ado file is present, you can use the. dir wls.ado :wls.ado wls.ado 11/01/98 15:32 3207 wls.ado

. wls y x [aweight = wt] WLS anova table uses renormalized weights (weight var is wt) Source | SS df MS Number of obs = 10 ---------+------------------------------ F( 1, 8) = 124.63 Model | 341.99136 1 341.99136 Prob > F = 0.0000 Residual | 21.952652 8 2.7440815 R-squared = 0.9397 ---------+------------------------------ Adj R-squared = 0.9321 Total | 363.94401 9 40.438224 Root MSE = 1.657 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+-------------------------------------------------------------------- x | 530.8354 47.55003 11.164 0.000 421.1849 640.486 _cons | 148.4732 8.078651 18.378 0.000 129.8438 167.1026 ------------------------------------------------------------------------------

A few things have changed from the. vwls y x, sd(esd) Variance-weighted least-squares regression Number of obs = 10 Goodness-of-fit chi2(8) = 21.95 Model chi2(1) = 341.99 Prob > chi2 = 0.0050 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ y | Coef. Std. Err. z P>|z| [95% Conf. Interval] ---------+-------------------------------------------------------------------- x | 530.8354 28.70466 18.493 0.000 474.5753 587.0955 _cons | 148.4732 4.87686 30.444 0.000 138.9148 158.0317 ------------------------------------------------------------------------------