| Author |
the mean of weighted value
|
|
| BioTob 2005-04-26, 4:04 pm |
| hi community,
can you give me an advise how to calculate the mean of different
weighted values!
here is an example!
value weight
1. 160 0.8
2. 140 0.5
3. 200 0.2
So therefore the first value is 4 time more weighted than the last
value.
any suggestions?
| |
| Steve Amphlett 2005-04-26, 4:04 pm |
| BioTob wrote:
>
>
<snip, tasty LHF (low-hanging fruit)...
One of many solutions:
value=[160; 140; 200]
weight=[0.8; 0.5; 0.2]
sum(value.*weight)/sum(weight)
ans =
158.6667
| |
| belaid 2005-04-26, 4:04 pm |
| Another of many solutions:
value=[160; 140; 200]
weight=[0.8; 0.5; 0.2]
(value'*weight)/sum(weight)
ans =
158.6667
belaid
| |
|
| On Tue, 26 Apr 2005 08:15:50 -0400 in message
<news:ef040c0.0@webx.raydaftYaTP>, Steve Amphlett wrote:
> BioTob wrote:
> <snip, tasty LHF (low-hanging fruit)...
>
> One of many solutions:
>
> value=[160; 140; 200]
> weight=[0.8; 0.5; 0.2]
>
> sum(value.*weight)/sum(weight)
>
> ans =
>
> 158.6667
Can I have a bite Steve?
[color=darkred]
ans = 158.67
/PB
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
|
|
|
|