From: S Ellison <S.Ellison_at_lgc.co.uk>

Date: Tue, 08 May 2007 18:21:21 +0100

This email and any attachments are confidential. Any use, co...{{dropped}}

R-help_at_stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 08 May 2007 - 17:48:45 GMT

Date: Tue, 08 May 2007 18:21:21 +0100

Hadley,

You asked

> .. what is the usual way to do a linear

*> regression when you have aggregated data?
*

Least squares generally uses inverse variance weighting. For aggregated data fitted as mean values, you just need the variances for the _means_.

So if you have individual means x_i and sd's s_i that arise from aggregated data with n_i observations in group i, the natural weighting is by inverse squared standard error of the mean. The appropriate weight for x_i would then be n_i/(s_i^2). In R, that's n/(s^2), as n and s would be vectors with the same length as x. If all the groups had the same variance, or nearly so, s is a scalar; if they have the same number of observations, n is a scalar.

Of course, if they have the same variance and same number of observations, they all have the same weight and you needn't weight them at all: see previous posting!

Steve E

This email and any attachments are confidential. Any use, co...{{dropped}}

R-help_at_stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 08 May 2007 - 17:48:45 GMT

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Wed 09 May 2007 - 01:31:20 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*