On 11-01-28 10:46 PM, Fernando Lima wrote:> Dear all,
>
> I have a problem that has been driving me nuts. I have searched everywhere
> but could not find a comprehensive answer. I only get (sometimes
> contradictory) bits of information.
>
> I have a series of measurements with associated standard deviations, e.g:
>
> means +/- sd
> 10 +/- 0.2
> 13 +/- 0.4
> 09 +/- 0.3
>
> The number of observations used to estimate any of these means was the
same.
> Let's say that each one resulted from 10 measurements.
>
> Also, I have another vector of weights. So, the first value should weight
> 0.2, the second 0.1 and the third 0.7. The sum of weights is 1.
>
> weights
> 0.2
> 0.1
> 0.7
>
> The weighted mean is easy:
>
> (10*0.2) + (13*0.1) + (9*0.7) = 9.6
>
> Now, for the weighted addition of SDs, I have no idea how to do it.
I think you need to give more details. There are lots of ways to
combine things using weights, but they don't all make sense in all
contexts. The "weighted addition of SDs" is not something that I
recognize.
If you give the formula for what it is you're trying to calculate, that
would be easiest; if you don't know it, then a statement of what
properties you'd like your solution to have might be enough.
Duncan Murdoch
>
> I've found functions such as wtd.var() from the package Hmisc for
> calculating variances from values with different weights, but it does not
> sum variances, it just calculates the overall variance of a set of
> measurements with different weights.
>
> I also found combinevar() from the package fishmethods that can be used
to
> add variances, but this one does not allow to associate a weight to those
> variances.
>
> So, I do not know how to do both things at the same time.
>
> Any idea? Any package? Or any suggestion so I can make my own function?
>
> Thank you very much
>
> Fernando Lima
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org 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.