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
#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.
#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
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.