[R] Two envelopes problem

davidr at rhotrading.com davidr at rhotrading.com
Mon Aug 25 23:44:55 CEST 2008


There's a pretty thorough discussion on Wikipedia
http://en.wikipedia.org/wiki/Two_envelopes_problem
Suffice it to say that not everyone agrees.
-- David


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Deepayan Sarkar
Sent: Monday, August 25, 2008 4:35 PM
To: Mario
Cc: r-help at r-project.org; Greg Snow
Subject: Re: [R] Two envelopes problem

On Mon, Aug 25, 2008 at 1:51 PM, Mario <mdosrei at nimr.mrc.ac.uk> wrote:
> No, no, no. I have solved the Monty Hall problem and the Girl's problem and
> this is quite different. Imagine this, I get the envelope and I open it and
> it has £A (A=10 or any other amount it doesn't matter), a third friend gets
> the other envelope, he opens it, it has £B, now £B could be either £2A or
> £A/2. He doesn't know what I have, he doesn't have any additional
> information. According to your logic, he should switch, as he has a 50%
> chance of having £2B and 50% chance of having £B/2. But the same logic
> applies to me. In conclusion, its advantageous for both of us to switch. But
> this is a paradox, if I'm expected to make a profit, then surely he's
> expected to make a loss! This is why this problem is so famous. If you look
> at the last lines of my simulation, I get, conditional on the first envelope
> having had £10, that the second envelope has £5 approximatedly 62.6% of the
> time and 37.4% for the second envelope. In fact, it doesn't matter what the
> original distribution of money in the envelopes is, conditional on the first
> having £10, you should exactly see 2/3 of the second envelopes having £5 and
> 1/3 having £20. But I'm getting a slight deviation from this ratio, which is
> consistent, and I don't know why.

That has nothing to do with switching, and everything to do with
properties of regression. Try:

> env <- generateenv(r=2, rintexp, n=1e6, rate=1/10)
> colMeans(env)
[1] 15.76573 15.75436
> mean(env[which(env[,1] == 10) , 2]) # greater than 10
[1] 10.64476
> mean(env[which(env[,1] == 20) , 2]) # less than 20
[1] 18.10053

And now with a distribution with mean less than 10

> env <- generateenv(r=.5, rintexp, n=1e6, rate=1/10)
> colMeans(env) # mean less than 10
[1] 7.881469 7.873117
> mean(env[which(env[,1] == 10) , 2])
[1] 8.966886

-Deepayan
______________________________________________
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.


More information about the R-help mailing list