# How do I calculate weighted mean with negative weights?

This might be very trivial for you guys.
If :
I buy 2 oranges for 5 dollars each then
I buy 3 oranges for 6 dollars each and then
I sell 3 oranges for 4 dollars each

How do I calculate the average price of an orange ? thanks.

Edit 1

I will elaborate :
I need to show in software the amount of the product and the avg price.
So , if lets say I bought 4 ranges for 100 usd each. and I sold 2 oranges for 110 usd each.

I now present in my systems 2 oranges - and in what price?

Option A: (4 * 110 + 2 * 100)/6 = 106.667 or Option B: (4 * 110 - 2 * 100)/2 = 120 (doesnt think so )

If I do go with option A then if I sold 2 more for 110 I would get 0 amount but average (4*100+2*110+2*110)/8 - 105 . 0 stocks for 105 doesn't make any sense.

(I beleive I want to be able to say amount*price - this is what I have, cause I want to show "How Much Do I Worth") Thanks A lot

-
For the average price of an orange: $(2\times 5+3\times 6+3\times 4)/(2+3+3)$ – Raskolnikov Apr 13 '11 at 10:28
just like the regular average just with absolute values of the weights? – user9537 Apr 13 '11 at 10:36
You're a bit vague about what you mean by "average" price. Do you mean the average price you paid for oranges or the average price oranges were transacted on the market. If the first, you account for the ones you sold as an income instead of a loss, so you should give it the opposite sign. But if you just are interested in the average price at which transactions occurred, not accounting for whether they were sold or bought, then the simple formula with absolute values is OK. What do you want? – Raskolnikov Apr 13 '11 at 11:05
If you're interested in your net worth, you don't need averages. Just a good double-entry bookkeeping system that keeps track of your amount of oranges and your capital. – Raskolnikov Apr 13 '11 at 11:20

You're a bit vague about what you mean by "average" price. Do you mean the average price you paid for oranges or the average price oranges were transacted on the market. If the first, you account for the ones you sold as an income instead of a loss, so you should give it the opposite sign. But if you just are interested in the average price at which transactions occurred, not accounting for whether they were sold or bought, then the simple formula with absolute values is OK. What do you want?

Suppose you're interested in the average price you paid for the oranges.

You have used an amount of money equal to $2\times 5+3\times 6-3\times 4=16$ dollars to pay for oranges. You are left with two oranges, so you could say the average price per orange you paid is $8$ dollars.

On the other hand, if you're interested in the average transaction price, then you might need:

$$\frac{2\times 5+3\times 6+3\times 4}{2+3+3}=5 \text{ dollars.}$$

In your edited version, you say you want to evaluate "worth", I think averages are not really useful. Totals would be more useful. In fact, a good double-entry bookkeeping system that keeps track of your amount of oranges and your capital would be more useful here.

-
What? I never even got close to 8 dollars :-). Does that mean that you are saying using minus is wrong? Should I use absolute value? – user9537 Apr 13 '11 at 11:18
Perhaps you could copy your comment here too, with its average of 5 dollars an orange, just for contrast. – Henry Apr 13 '11 at 11:18
@Henry: I assembled all my comments into one reply. I don't think it's really what the OP is after, but I'm not really sure what he wants. When one doesn't know what one wants, it's no use throwing around numbers and formulas. In the first place, one has to make clear what one wants to measure. – Raskolnikov Apr 13 '11 at 11:36
Thanks. I will look up that wiki. – user9537 Apr 13 '11 at 12:13
Also, try asking your question on money.stackexchange.com . I think it would fit better there than on math.SE. – Raskolnikov Apr 13 '11 at 12:19