Re: [R] Two envelopes problem

From: Deepayan Sarkar <>
Date: Mon, 25 Aug 2008 14:35:15 -0700

On Mon, Aug 25, 2008 at 1:51 PM, Mario <> 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 mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Mon 25 Aug 2008 - 21:40:12 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 25 Aug 2008 - 22:33:57 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive