Showing posts with label money. Show all posts
Showing posts with label money. Show all posts

Thursday, October 06, 2011

The Cost of Loyalty

So if you have a loyalty card for, say, Costa you will get 5 points for every pound you spend. One point is worth 1 pence, so you're effectively saving 5p from each £1 you spend - a saving of 5%, right?

Yeah, it's not that simple.

For one thing, if you think of it as paying full price then getting 5p back per £1, then there's the restriction that these 5 pences you're 'saving' can only be spent in Costa. Also, you only get points for the whole pounds you spend (not the pence).

So what are you saving?

Think of it this way - let's say every time you go to Costa you buy the same thing, spending the same amount of money each time.

The question then is, how many visits does it take to earn enough points to get your usual order for free?


Okay, so we have our usual order, with price P. The amount of money you 'save' (in the form of points) per visits is 0.05*floor(P). The floor function - f() from now on - rounds the price down to the nearest pound, since you don't get points for pennies.

So we want to find the number, N, of purchases we need for the total points value to be greater than or equal to our order price P. In other words:

0.05*f(P)*N = P

or  N = P/(0.05*f(P))

Now, lets start by looking at the simplest case, where P is an exact number of pounds - i.e. P = f(P)

In this case, P and f(P) cancel each other out, so N = 20. Notice, regardless of whether your order is £1 or £20, it will always take 20 visits to get one 'free'.

More generally, the equation becomes N = ceil(20*P/f(P))

Where ceil is a function which rounds the value up to the nearest whole number. Because there's no such thing as a fractional visit, unless you count a visit in which you spend less than usual. Anyway.

Okay, so lets look at an example - a pot of tea costs about £1.60. So we work out N = ceil(20*1.6/f(1.6)) = ceil(32/1) = 32 visits. And just to check, for a pot of tea you get 5 points per visit (5p), and 32*0.05 = 1.60 = the price of a pot of tea. Perfect.


Now. What about savings?

In the tea example, you're buying 32 pots of tea and getting one for free. Which isn't a great saving, but it is a saving nonetheless.

So, the total amount you spend is P*N, and you're getting N+1 pots. That means the effective price per cup works out at P*N/(N+1).

For tea, that means you're effectively paying ~£1.55 per pot - a saving (S) of 5p per pot. What's that saving as a percent? Without going into too much detail, it turns out it's %S = 1/(N+1).

Which works out at 3% for tea. Which is less than the 5% saving you might have expected.


Incidentally..

The example for when the price is an exact number of pounds turns out to offer an effective saving of ~4.76%. Which, again, is less than 5%, but a little better. This, by the way, is also the maximum % saving you can achieve with a Costa card.

In general, the % saving is much worse when the pence amount of P is high and the pound amount is low - the worst case being when the price is £1.99. This would require 40 visits to 'get one free' and offers a saving of only 2.4%.

So based on best and worst case scenarios, we can say that your % saving will always be between 2.4% and 4.8%. Similarly, visits required to get one free, N, will always be between 20 and 40.

[In fact, the absolute worst case is when P is less than 1, in which case you never get any points.]


But to clarify..

This 'saving' is the saving over what you would have paid if you bought N+1 pots of tea and didn't have a loyalty card - i.e. not getting the N+1th one for free.

But what if you could spend the money you saved on something else?

Think of it this way - you've bought N pots of tea, and thanks to the loyalty card, you've saved the equivalent of the cost of one more pot of tea (£1.60). In this case, the saving per pot bought would be P/N. For the pot of tea, that's 1.60/32 = 5p.

To get the percent saving (per order), we divide this number by total price, P. For tea that works out at 3.1%. In fact, this is equivalent to the point-value saved per purchase, divided by the full order price - i.e. 0.05*f(P)/P == 1/N

So for the whole-pound values, this does, in fact, work out at a 5% saving. And the worst saving is still for £1.99 purchases, now working out at a 2.5% saving.


One more thing

All of this also goes for Tesco, and Waterstones, and wherever else does money-for-points loyalty cards too. You just replace 0.05 with however many points you get per pound, divided by 100 (e.g. Tesco = 0.01).

If we call this value rho (which looks a bit like a lower-case p), then the general formulas are:
But again, we're assuming you spend approximately the same amount (P) every time you visit a given place. If not, things get tricky. For a rough estimate, one thing we can try is using an average per visit spend (Pbar).

One other thing we can do is replace the P on the top of the fraction with a target points/saving; replacing f(P) with f(Pbar) if necessary.

So, for example, if the average order (Pbar) is £3.55 and you want enough points to get a free slice lemon cake (£2.50), then it will take N = 17 visits.


Oatzy.

Tuesday, July 12, 2011

With Enough Tries..?

Probability is tricky. It isn't always intuitive. Coincidences aren't necessarily as rare or as unusual as they might seem.

I can't remember how I got to it, but the other day I came across the wiki article on the Law of Truly Large Numbers. An interesting idea to say the least.

Then a couple of days later I was looking through one of my books for blog ideas, and came across an essay with an example strikingly similar to that in the wiki article (in never gave it a name).

Coincidence?


So what is the Law of Truly Large Numbers?

The Wiki page gives this description:
[The law] states that with a sample size large enough, any outrageous thing is likely to happen.
The example given on the page is a little inelegant, so I'll go with the (abridged) similar example from the book,
Suppose that a really memorable, once in a lifetime coincidence is one which has a one in a million chance of happening today, and that during any particular day there are 100 opportunities... [T]he chance that one of these coincidences will happen to you tomorrow is 1 in 10,000. Still very unlikely...
[But] the chance that every one of the next twenty years will have no one-in-a-million coincidences for you is.. 0.48, or a 48 per cent chance.
According to this extremely rough and ready calculation, there is actually more than a fifty-fifty chance that in the next twenty years you will experience a memorable one-in-a-million coincidence. This also means that for every twenty people you know, there is a greater than 50% [chance] that one of them will have an amazing story to tell during the course of a year.
Now this is an interesting thought.

And it raises an interesting question - If you play the lottery enough times, does winning eventually become significantly more likely? Inevitable?

It's an often quoted 'fact' that you're more likely to be stuck by lightening on your way to buy your ticket, than you are to win. But what does 'the law' have to say on the subject?


Preamble

For this we're assuming a good old fashion, six balls from a pool of 49 lottery.

Probability of winning the jackpot (matching all six balls) with one ticket is 1/13983816 or about 7 in 100million

If you play two lotteries, then your odds of winning are (Odd of winning the first) + (odds of winning the second) + (odds of winning both).

OR, and this is easier to work out,

Let 'Odds of not winning', q = 1-p(winning)

'Odds of winning at least once in two games' = 1 - (odds of winning neither) = 1 - (q*q)

This can be generalised to 'Odds of winning jackpot playing n games', p = 1 - (q^n)


Round One: Will I hit the Jackpot in My Lifetime?

First of all, odds of winning the jackpot by playing every week for a year

p = 1 - [1-p(winning)]^52 = 3.7 in 1million

So not great. How about if you play ever week, starting on your 16th birthday and giving up (dying) on your 86th. Or basically, playing for 70 years. Probability of hitting that jackpot?

About 1 in 4,000 chance. So still not great.

Of course, if you buy 40 tickets a week, then that gives you a 1 in 100 chance of winning the jackpot at some point in your life. But by that point you're spending £2,080 a year on lottery tickets. The average jackpot would have to be more than £14.6 million for the expected return (prize*chance of winning) to make it worth playing.


Round Two: What About Immortality?

So we've got the equation p = 1 - (q^n)

The question is, can we find n - i.e. the number of games you'd have to play - such that the probability of winning (p) is 50:50

The trick is logarithms, and the formula is

n = log(1-p)/log(q)

So for p = 0.5, n = 9,692,842 games, or about 186,400 years.

For a 1 in 4 chance of winning? 77,363 years

1 in 100 hundred chance?! 2,703 years

Alternatively, to have a 50:50 chance of winning in your lifetime (70 years) you'd need to buy 2,663 tickets a week. Yeah.

Basically, even by the Law of Truly Large Numbers, and immortality, you'd be waiting a ridiculously long time and you'd still be lucky to win.


Round Three: I'll Take Anything!

Now wait a minute, I hear you say, I could still win something by matching 5 numbers, or even 3. Okay, that's a fair point.

So you need to match 3 or more numbers to win something. Probability of winning anything in any given game? ~6 in 100,000

So once again, chance of winning something if you play every week for 70 years? 195 in 1,000

Now that's interesting. That's just short of a 1 in 5 chance. But to be worth playing, the average prize value would have to be ~£18,666. Worth it? I'll let you decide*.

And finally, how long would you have to play to have a 50:50 chance of winning something? ~223 years. Or 45 years if you buy 5 tickets a week.

Which is going to be a real kick in the balls if that something turns out to be £5.


Or To Put it Another Way

* Imagine a game you only get to play once. You pay me £3,640 to play, then you pick a number between 1 and 5. I then generate a random number between 1 and 5.

If the number that's generated is the number you chose then you will win some randomly chosen prize between £5 and £5million; you're more likely to win a smaller prize than a larger one, and you can't know in advance what the prize will be.

Want to play?

If you play the lottery, but answered no to the above, you should probably reconsider.


tl;dr As has been said many times before, your odds of winning the lottery jackpot are catastrophically minute. Even if you were to play every week of your life.


Oatzy.

Friday, April 22, 2011

The Perfect Price

Say you made a thing. You put a lot of time and effort into your thing, and you're so proud of it, you want to share it with the world. But how much should you charge for it?

If you price it too high no-one will buy it. If you price it too low, you won't make a profit. And you spent far too much time and money on your thing to not turn a profit.

So you go to a good friend - who just so happens to work in marketing - and ask him to do a little market research for you. This friend is a pretty cool guy, so he goes out on to the streets and shows people your product, and asks them how much they'd be willing to pay for one. But being an expert, he does it in such a way as to get honest and unbiased answers.

After an afternoon of efficient (and pro bono) work, he comes back to you with good sample of 750 responses. After discarding 250 who weren't interested in your product, he analyses the remaining 500 responses.

And by some pleasing miracle, he finds that the prices these people are willing to pay approximates a normal distribution, with average £10 and standard deviation £2.50


So what do you charge? £10?

The people who said they would only pay a price less than £10 won't buy it, because they're cheap-skates, and who needs their business anyway. But on the plus side, half the people surveyed - 250 people - said they'd pay £10 or more. So you would expect to make about £2,500 from the sample group.

Which isn't too bad. But can you do better?

You decide, because you're a bit of a smart-arse, to work out a function for your expected return for if you were to charge £x.

So what you do first is integrate your normal distribution function from x to infinity. This gives you the shaded-area under the curve - the proportion of your sample willing to pay £x,
You then multiply that by the sample size (500) to get the number of people willing to play that amount, and by £x to get how much money you'd make all together. Easy.

Still with me?

Your resulting function looks like this,
(before being multiplied by the sample size)


erfc is the complementary error function, but you needn't worry about what that is exactly, because that's what Wolfram Alpha is for. So, proud of yourself for worked that out (somehow), you plot a graph of this function giving you a graph that looks like this
And right away you spot that there is definitely a peak on that graph, and know that that would be the optimal amount to charge.
So with Wolfram Alpha' help again, it's a piece of cake for you find that that peak is at x=£7.73.

This is your best price. Which is a couple of quid less than the average your sample was willing to pay. But if you were to charge this amount, 409 people from your sample would be willing to buy your thing - and that would make you a respectable ~£3,162 

Good times!

And now you sit back in your chair and laugh, because a little maths just made you an extra 660-odd quid. Which isn't bad going.


As it turns out, if you ask people what they'd be willing to pay (and if their responses approximate a normal distribution) then the price that maximises profits - the one that balances per-unit profit, and expected sales numbers - is ALWAYS less than the average of what people are willing to pay.

And cinemas - whose escalating prices are discouraging movie-goers and leading to declining profits - could perhaps learn something from this. But probably won't.


Spherical Cow in a Vacuum

The world, as you may have noticed, is not an ideal place. Life is never so simple.

The central limit theorem says a normal distribution will often suffice (for a large enough sample population), but it's not necessarily going to be the best fit. Or it might be that the results from your sample don't scale to the general public.

But much worse than that is people. People aren't rational, people don't necessarily know what they want, people don't know what things are worth, and people are surprisingly easy to manipulate - to an extent, you can effectively tell people what they want to pay; as anyone in marketing will proudly tell you, while grinning maniacally and eying up your wallet.


So in that vein, I leave you with these two TED talk

Dan Gilbert on our mistaken expectations
Rory Sutherland: Life lessons from an ad man

Watch them.


Oatzy.


[There are lots of other TED Talks on a huge range of subjects. Most worth watching. Some of them are particularly fantastic. Go explore!]

Saturday, January 01, 2011

Life by Numbers: End of Year Report

General

Age: 21
DOB: 18/01/89
Height: 6ft 2.5
Weight: 11st 10
BMI: 20.8


Lifestyle & Money


Average night's sleep: 8hrs 34
Typically asleep between 2:30am and 11am
Minimum sleep duration: 5.5hrs
Maximum: 11hrs

Job interviews: 1
Jobs: 0
Job Seeker's Allowance received: £1,660.88

Major expenditures:
Acer Aspire 5542 - £430
HTC Desire - £150 up front (+ £20/month)
Two nights at Hotel 53 (Valentines weekend) - £264

Monthly subscriptions, Jan 2010: £49.99
Current monthly subscriptions: £33.98

Total spend on Amazon.co.uk - £231.77

Overdrawn: 3 times
Maximum: -£17.52

Net change in bank balance*: -£59.24
Net worth as of 31/12/10: £715.87

Dog walks: 1
Visits to the gym: 2
1 new pair of Adidas trainers; Used twice.
1 new pair of Converse, black.


Entertainment

Most listened to artist: Pink Floyd
Most listened to song: Change by Karnivool
Most listened to album: Sound Awake by Karnivool

Books read cover to cover: 4
* Chuck Palahniuk - Survivor
* Chuck Palahniuk - Snuff
* Richard Bach - Illusions
* Neil F. Johnson - Simple Complexity

Books started but not finished: 7
Graphic novels read: ~12

Films seen at the cinema: 3
* The Lovely Bones
* Inception
* Scott Pilgrim vs The World

2010 released films seen: 6

Films rented (LoveFilm): 10

Words written for NaNoWriMo: 28,369
Percent to target: 56.7%

Games bought: 2
* Pokémon SoulSilver
* Professor Layton and the Lost Future


Food and Drink

Average cups of tea per day: 3.35
Percent of all drinks that are tea: 53.5%

Percent of all drinks that are alcoholic: 19.7%
Approximate average units per week: 13*

Favourite alcoholic drink: Whiskey (bourbon)
As percent of all alcoholic drinks: 52%

Second most drank: Wine (21%)

Most frequently eaten animals*:
1 - Cow
2 - Chicken
3 - Pig

Favourite meals:
1 - Ham and Cheese Sandwich (4.25 a week)
2 - Bolognese (1 every 8 days)
3 - Mixed Kebab & Chips (1 every ~9 days)

Favourite Snack: Ice Cream
Average bowls per week: 2.65

Beer festivals: 1
Visits to Cadbury Land: 1


Travel & FourSquare

Current Mayorships: 16
Badges: 15

Percent of days checked-in on: 58.7%
Average number of 'days out' per week: 4
Average check-ins per 'day out' - 3.68

Most frequently visited venue: Costa Coffee (Parkgate)
Check-ins per week: 1.6

Most frequently visited franchise: Costa Coffee
Days out that include visiting a Costa: ~67%

Check-in locations (via 4mapper):
Local (red spot=home)


Long distance train journeys: 7
4 x Birmingham
2 x York
1 x Loughborough
Total cost: £127.25

Vintage train events visited: 2
Vintage train magazines appeared in*: several, unwittingly


Twitter

Total tweets (as of 31/12/10): 9091
Days online: 608
Average life-time tweet rate: 15 tweets/day
Average tweet rate over 2010: 30.5 tweets/day
Most tweets in a single day: 93 (on 08/09/10)

Composition of tweets:
34.3% Replies
5.46% RTs
0.35% #FF

Average tweet distribution over 1 day:
New friends*: 28
Total foll/followers (as of 31/12/10): 57/120

Most talked to friends:
@aaangst (3.69)
@PkmnTrainerJ (3.04)
@SallyBembridge (3.01)
@Shinelikestars_ (2.26)
@Aerliss (1)

Replies to the above 5 made up 27% of all my tweets; 79% of all replies.

Tweets retweeted: ~1 in 26
Equivalent RTs per day: 1.17



Notes

* Net change doesn't take into account cash and savings. Net worth does.
* based on an assumed average of 1.5 units per serving. Recomended maximum intake: 21 units/week.
* based on which animal the main meat constituent (of a meal) came from.
* no, I don't know which publications precisely.
* 'friends' here defined as a mutual follow. Though I would consider most of them friends, to varying degrees.


You can compare these numbers with those from August 31st here.

Further stats on individual websites below. Due to various reasons there are limits on what data I actually have. So it's worth pointing out that following websites only cover the last -% of the year,

Daytum - 80%
FourSquare - 74%
Twitter (Twoolr) - 66%

Though the interesting thing about Twitter is that while the data I've got only covers 40% of my total time on Twitter, it covers 81% of my total tweets!

Secondly, some of the details (datum in particular) is loose estimates - things are measured in 'serving' and imprecisely at that. FourSquare only logs places where I can and have checked-in - people's houses, or places not on FourSquare aren't logged.

There are also things I didn't/couldn't track, which I might consider in future. For example local trains and buses I don't get tickets for because I travel for free. DVDs, I can remember which I've bought this year, and films I can't remember precisely what I've seen. Cash transactions I didn't track. And so on.

The question is ultimately whether I care enough about having the record to bother to put in the extra effort. That remains to be seen. It's a very fine balance between detail and sanity.


Oatzy.

Wednesday, September 08, 2010

The Exact Change Problem

[Reblog: Originally titled 'Pimp My Change']


There's an old problem in discrete mathematics, known as the Subset Sum Problem which goes as follows:
Given a set of integers, does the sum of some non-empty subset equal exactly zero? For example, given the set { −7, −3, −2, 5, 8}, the answer is YES because the subset { −3, −2, 5} sums to zero. [wiki]

Or in another context, imagine you're at a restaurant and for some unknown and perverse reason, you want the total cost of your meal to add up to, say, £10. The problem is to pick items from the menu so as to satisfy this condition.

In terms of computer science, this problem is NP-Complete; that is as the problem gets bigger the time taken to find a solution increases non-polynomially (e.g. exponentially).

In other words, if you wanna solve it (even with a computer) you've gotta be willing to wait several thousand years for an answer.


So lets now make the problem slightly different:
Given a certain monetary note [£5/10/20], find a subset of items in a shop such that the change given contains, in exact change, £1.30.

But, there does hide in this seemingly equivalent problem a few interesting caveats:

1) The change given needn't be exactly £1.30

2) If the change isn't exactly £1.30, you have to account for the fact change will usually be given in the smallest number of coins - e.g. £2 is more likely to be given as a £2 coin rather than two £1 coins (or any other arrangement).

3) By taking into account change you already have, the problem is slightly altered. But the solution is found in essentially the same way.


So why is any of this important?

While I'm waiting for my awesome new all access special pass to be delivered I have to pay for the bus, meaning £1.30 both ways on a bus that accepts exact change only.

Of course by making certain assumptions, as those above, it's fairly easy to work out, given a starting amount (a), how much you need to spend (s) to get £1.30 exactly. The hard part is finding items such that (a - s) = £1.30.

This is the essence of the Subset Sum Problem.

But in this instance, there is that loophole that the change needn't be exactly £1.30 - it just has to contain that amount.


So, for example, lets say we start with a £5 note. And lets say, since change will likely be given in the smallest number of coins, our change needs to contain at least one of each of 10p, 20p and £1 coins.

To get 10p & 20p - we need to buy something with a pence value in 11-20p or 61-70p

To get £1 - given the 30p will be taken from one of the five pounds, we have £4 to play with. So we need to buy something with a pound value of £1/3

For other values of c and a, the solutions to the above are relatively similar.

So from the above - if we start with £5 - we have a range of 40 (=(10+10) x 2) possible sums to add up to, cutting the problem down to a more manageable size.

So we don't have an exact solution, but a simplification to the problem instead. And in most cases that's good enough.

But one other thing I should perhaps mention, is that the change needn't all be collected in one transaction - i.e. it can be collected in smaller parts, such as 5p s or 50p s, etc.

Of course, I could just give the smallest amount I have exceeding £1.30. But that would mean giving away money unnecessarily. Or, you know, I could ask a cashier kindly to change the money for me... I dunno.


[Follow Up]

Firstly, if you're on campus, a quick and dirty solution to the change problem is to go to CostCutter and buy a Ginsters Tortilla Wrap [your choice of filling] at a cost of £3.19. A total rip-off, I know.

But the change will be £1.81, most likely given as £1, 50p, 20p, 10p and 1p. And this price lays within the range outlined in the previous blog. Simple.

Another thing to note, whilst playing this 'game', is that you're restricted in what you buy by what you like, what you're willing to spend to get the change and what it would be insane to buy just for the change - i.e. vast numbers of really small items like 1p sweets (if such things still exist).

And conversely, what you choose to buy may also affect what else you buy, if anything. So for example, if you bought the tortilla wrap, you may be weary about getting anything else, in case it ruined the change.

And one final thing to note is that if you plan to use the bus two or more times in one day, it may in fact be easier to get a day-rider, at £2.60, given that £2 is easier to get than single £1s and 60p is generally easier to get than two lots of 30p.


So yeah, just a little something to ponder. Hope it was easy enough to follow.


Till next time,


Oatzy.