Search

  • Two envelopes problem

    @Michael

    Simulation in R to demonstrate the different sampling mechanisms.

    cases=matrix(c(c(10,5),c(10,20)),nrow=2,ncol=2,byrow=FALSE)
    
    number_of_envelope_pairs=10000
    resulting_envelope_value_C=rep(0,number_of_envelope_pairs)
    #Case_C
    for(i in 1:number_of_envelope_pairs){
      my_envelope_pair=cases[,rbinom(1,1,0.5)+1]
      after_switch=my_envelope_pair[2] #this chooses "the other one than 10"
      resulting_envelope_value_C[i]=after_switch
    }
    case_C_gain=mean(resulting_envelope_value_C-10)
    case_C_gain #can see it's 2.5
    

    Onto something that sounds like Case_A, and something you can to do it to make it superficially resemble Case_C.

    #Something that sounds like Case_A
    my_envelopes=rep(0,number_of_envelope_pairs)
    my_envelopes_switch_gain=my_envelopes
    for(i in 1:number_of_envelope_pairs){
      case_index=rbinom(1,1,0.5)+1
      envelope_index=rbinom(1,1,0.5)+1
      my_envelopes[i]=cases[envelope_index, case_index]
      my_envelopes_switch_gain[i]=cases[-envelope_index, case_index]-my_envelopes[i]
      }
    mean(my_envelopes_switch_gain) #approx 0, this is if you don't open the envelope
    
    #illustrating the conditioning, NB this is not the same as conditioning on
    #the pair being (5,10) or the pair being (10,20)
    #this is the gain given the chosen envelope is 10 and the
    #other envelope is known to be 5 or 20.
    mean(my_envelopes_switch_gain[my_envelopes==10])
    #this gives you approx 2.5 as we saw in case C.
    

    You notice that when you condition on "having your envelope be 10" in that set up, you're subsetting to cases where the gain is -5 or 10, and those occur with equal probability since the cases (5,10) and (10,20) occur with equal probability. If you were to condition on your envelope being 10 in the loop (case index=1), you end up with exactly the same gain numerically but it represents a subjectively different belief state for an agent. Why? The subsetting done at the end lets you look at the whole ensemble of cases where the first envelope was 10, where the assignment of 10 was random. Fixing the envelope as 10 within case makes the assignment of 10 nonrandom.

    #Thing which is actually Case_A
    my_envelopes=rep(0,number_of_envelope_pairs)
    my_envelopes_switch_gain=my_envelopes
    for(i in 1:number_of_envelope_pairs){
      what_case_am_i_in_given_i_have_10=rbinom(1,1,0.5)+1
    #random assignment of case, 10 provides no knowledge of case
      five_ten_switch_gain_given_random_envelope=0
    #conditioning on pair being 5,10, gain is known
      ten_twenty_switch_gain_given_random_envelope=0
    #conditioning on pair being 10,20, gain is known
      case_gains=c(five_ten_switch_gain_given_random_envelope,
                   ten_twenty_switch_gain_given_random_envelope)
      my_envelopes_switch_gain[i]=case_gains[what_case_am_i_in_given_i_have_10]
    }
    
    mean(my_envelopes_switch_gain)#this is just 0
    

    The thing we're butting heads on, in my view, is the Case_A inner loop line 1, which is where the randomness comes in through the allocation of pairs. If at any point, in the loop, the agent *knows* what case they're in, their gain is deterministic. When you grant that knowledge hypothetically, you either enter subcase A 1 (the first gain line) or subcase A 2 (the second gain line). Once you've done those hypothetical calculations, you reintroduce the randomness of allocating envelopes in the next line to choose the received gain.

Welcome to The Philosophy Forum!

Get involved in philosophical discussions about knowledge, truth, language, consciousness, science, politics, religion, logic and mathematics, art, history, and lots more. No ads, no clutter, and very little agreement — just fascinating conversations.