This locked question "exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed."
Now, the question has +55,000 views, so it is understandable why it's not deleted. However, the answers are misleading, and thus dangerous for the audience.
Both answers stress that the R function lm
does accept weights. However, they fail to mention that what lm
understands by weights is a very precise, narrow definition of weights. As the help page states:
... the values in weights being inversely proportional to the variances.
This is quite different from the two more common type of weights, namely frequency weights and sampling weights. This blog entry makes this difference too.
Thus, as it stands, the locked post is potentially misleading. Sure, users should always read functions' help file, but still, I think this should be clarified in the locked question. I cannot add an edit or comment, but maybe someone else can.
UPDATE:
What would I change to the post? I would add a comment to the question, or to the first answer, with something like this:
"Notice that, whereas lm
(and related commands like plm
) do accept weights, the definition of this weights in the documentation is very precise: weights must be "inversely proportional to the variances". These weights are not necessarily equivalent to that of frequency weights or sampling weights. For the latter, R has a dedicated package called survey
.