Skip to main content
3 of 4
added 288 characters in body
user avatar
user avatar

As @Richard Hardy says, Ordinary Least Squares (OLS) can be used when you can reasonably assume that your data is homoscedastic. Weighted Least Squares (WLS) can be used when your data is heteroscedastic (but uncorrelated) and Generalised Least Squares (GLS) accounts for correlation and heterscedasticity.

When you compute gls(price ~. , data=art, weights = varFixed(~size.square)) you are assuming heteroscedasticity without correlation. Moreover, you assume that the variance of each osbservation is proportional to size.square.

The residual variance (the square of the residual standard error) obtained in the output of gls is only the proportionality constant, it does not contain the part that is proportional with size.square.

I don't know your data but you could try the following (i.e. WLS) and I think you will find the result of gls (see e.g. D.N. Gujarati, ''Basic econometrics''):

  1. The intercept is to be replaced by a column vector $x_0$ with elements all equal to 1
  2. replace all your independent variables $x_i$ by $v_i = x_i/\sqrt{size.square}$, also the $x_0$ that replaces the intercept;
  3. Do the same for your dependent variable, i.e. $y=price/\sqrt{size.square}$;
  4. regress this 'new' dependent variable $y$ on all the ''new'' independent variables $v_i$ using a model without an intercept, i.e. lm ( y ~ v0 + v1 ... + vn - 1)

Note: you weight each observation by $1/\sqrt{size.square}$ and then perform least squares (lm), hence the name ''weighted least squares''.

The residual standard error of the regression lm ( y ~ v0 + v1 ... + vn - 1) will be 0.01437 (see your example outcome for gls), so it is the resudual error after dividing each observation by $\sqrt{size.square}$ (and thus also after dividing the standard deviation by that value).

user83346