+ }
+ if(a2 == 1) ccond[ccind] <- ccond[ccind] + (pfact/2)
+ cctot[occind] <- cctot[occind] + (pfact/2)
+ cctot[ccind] <- cctot[ccind] + (pfact/2)
+ }
+ else{
+ if(a1 == 1) ccc1 <- ccc1 + (pfact/2)
+ if(a2 == 1) ccc1 <- ccc1 + (pfact/2)
+ cct1 <- cct1 + pfact
+ }
+ 
+ 
+ obs <- obs + pfact
+ sessno <- sessno + pfact
+ }
+ }
+ }
+ wses <- append(wses, sesswelf/(sessno * 100))
+ }
+ }
+ print(paste(zdata$experiment[1], zdata$delta[1], matrix[2], matrix[3],  "ewelf", relative_welfare(welf/obs,matrix), "coop", coopr/obs, "nplay", nplay, "nmatches", nmatches/nvalid, "nplay/session", nplay/tses, "nsessions", tses), quote = FALSE)
+ print(ccc1/cct1)
+ print(ccond/cctot, quote = FALSE)
+ print(cctot/sum(cctot), quote = FALSE)
+ print(cctot/(sum(cctot)+cct1), quote = FALSE)
+ 
+ ws <- unlist(wses)
+ med <- median(ws)
+ top <- ws[which(ws >= med)]
+ bot <- ws[which(ws < med)]
+ if(NROW(ws) > 1) print(paste("min/max session welf", mean(bot), mean(top)), quote = FALSE)
+ else print("one session", quote = FALSE)
+ 
+ return(list(nplay, tses))
+ }
> 
> relative_welfare <- function(welfare, mat){
+ rel <- welfare - mat[4]
+ diff <- mat[1] - mat[4]
+ return(rel/diff)
+ }
> 
> phi <- 1/3
> 
> optimize <- function(hh, tol){
> report_all()
[1] dal_fre 0.5 -185.714285714286 357.142857142857 ewelf 0.14043140170543 coop 0.0998834692858332 nplay 196 nmatches 41.8333333333333 nplay/session 16.3333333333333 nsessions 12
[1] 0.0908606
[1] 0.95762712 0.28947368 0.33157895 0.02160728
[1] 0.05539906 0.05946792 0.05946792 0.82566510
[1] 0.02946562 0.03162977 0.03162977 0.43915432
[1] min/max session welf 0.0518419536547089 0.209081796491918
[1]  59.92063 -39.28571 141.66667  26.58730
[1] 0 1 0 0 0 0 0
[1] "nbest= 1 nequ= 1 nclose= 1"
[1] 0.265873
[1] "belief free"
list()
[1] "theory coop= 0.166666666666667"
[1] theory welf 0.265873015873016 strategy below
[1] 0 0 0 0 0
[1] 0.1666667 0.1666667 0.1666667 0.1666667 0.1666667
[1] 
[1] dal_fre 0.5 -86.6666666666667 166.666666666667 ewelf 0.15249406175772 coop 0.1770783847981 nplay 80 nmatches 60.8333333333333 nplay/session 13.3333333333333 nsessions 6
[1] 0.1888176
[1] 0.87864078 0.32464930 0.30661323 0.05995792
[1] 0.05078895 0.12302761 0.12302761 0.70315582
[1] 0.02446556 0.05926366 0.05926366 0.33871734
[1] min/max session welf 0.117572863183328 0.197679774724929
[1]  47.22222 -13.88889  70.55556  13.88889
[1] 0 1 0 0 0 0 0
[1] "nbest= 1 nequ= 1 nclose= 1"
[1] 0.1388889
[1] "belief free"
list()
[1] "theory coop= 0.166666666666667"
[1] theory welf 0.138888888888889 strategy below
[1] 0 0 0 0 0
[1] 0.1666667 0.1666667 0.1666667 0.1666667 0.1666667
[1] 
[1] dal_fre 0.5 -56.5217391304348 108.695652173913 ewelf 0.387321105398592 coop 0.457426169433067 nplay 306 nmatches 43.0588235294118 nplay/session 18 nsessions 17
[1] 0.5207512
[1] 0.96891002 0.30684500 0.21085759 0.04448105
[1] 0.3065710 0.1425207 0.1425207 0.4083875
[1] 0.14733779 0.06849537 0.06849537 0.19627075
[1] min/max session welf 0.228047612284748 0.486572631599949
[1] 67.43156 10.50725 65.57971 34.09823
[1] 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.9193544 0.9350759
[1] "nbest= 1 nequ= 6 nclose= 2"
[1] "nbest= 1 nequ= 6 nclose= 2"
 [1] 0.1002415 0.1092611 0.1141304 0.3147707 0.3206463 0.3409823 0.3499866
 [8] 0.3828967 0.5390575 0.5483884 0.5508294 0.5596170 0.6141304 0.6539796
[15] 0.6673615 0.6743156
[1] "belief free"
list()
[1] "theory coop= 0.740740740740741"
[1] theory welf 0.674315619967794 strategy below
[1] 1 1 0 0 1
[1] 0.8333333 0.8333333 0.1666667 0.1666667 0.8333333
[1] 
[1] dal_fre 0.75 -185.714285714286 357.142857142857 ewelf 0.252238554058636 coop 0.192684575097145 nplay 146 nmatches 33 nplay/session 16.2222222222222 nsessions 9
[1] 0.2347856
[1] 0.95679012 0.29908973 0.36150845 0.02548167
[1] 0.10865191 0.08596021 0.08596021 0.71942768
[1] 0.08210846 0.06496030 0.06496030 0.54367292
[1] min/max session welf 0.156081223584145 0.320953710323752
[1] 43.253968 -6.349206 84.126984 26.587302
[1] 0 1 0 0 0 0 0
[1] "nbest= 1 nequ= 1 nclose= 1"
[1] 0.265873
[1] "belief free"
list()
[1] "theory coop= 0.166666666666667"
[1] theory welf 0.265873015873016 strategy below
[1] 0 0 0 0 0
[1] 0.1666667 0.1666667 0.1666667 0.1666667 0.1666667
[1] 
[1] dal_fre 0.75 -86.6666666666667 166.666666666667 ewelf 0.636226598589837 coop 0.653780695356188 nplay 68 nmatches 42.3333333333333 nplay/session 11.3333333333333 nsessions 6
[1] 0.7143498
[1] 0.97905605 0.33653846 0.39038462 0.05619413
[1] 0.56537692 0.08672448 0.08672448 0.26117412
[1] 0.4121080 0.0632142 0.0632142 0.1903720
[1] min/max session welf 0.525778102979072 0.797193657445722
[1] 68.08095 36.20521 68.07104 36.32888
[1] 0 0 0 0 1 0 1
[1] "nbest= 1 nequ= 7 nclose= 0"
[1] 0.1388889 0.1631228 0.1666667 0.4751926 0.5000000
[1] "belief free"
[[1]]
[1] 0.2934414

[[2]]
[1] 0.5835886

[[3]]
[1] 0.2994566

[[4]]
[1] 0.6022674

[[5]]
[1] 0.3157019

[[6]]
[1] 0.6331009

[[7]]
[1] 0.3632888

[[8]]
[1] 0.6808095

[1] "theory coop= 0.717143381923225"
[1] theory welf 0.680809497570506 strategy below
[1] 1.00 1.00 0.30 0.95 0.05
[1] 0.8333333 0.8333333 0.3666667 0.8000000 0.2000000
[1] 
[1] dal_fre 0.75 -56.5217391304348 108.695652173913 ewelf 0.689476347737504 coop 0.723106932719366 nplay 260 nmatches 44.1764705882353 nplay/session 15.2941176470588 nsessions 17
[1] 0.8118951
[1] 0.98616938 0.27481390 0.27419355 0.06234818
[1] 0.65140905 0.06883006 0.06883006 0.21093083
[1] 0.48784855 0.05154771 0.05154771 0.15796879
[1] min/max session welf 0.543357057893918 0.813384743701106
[1] 73.35920 46.60418 73.46880 46.69531
[1] 0 0 0 0 1 0 1
[1] "nbest= 1 nequ= 52 nclose= 1"
[1] 0.1002415 0.1280193 0.3453521 0.4613527 0.4613527 0.5700190 0.6280193
[8] 0.6841522 0.7254981
[1] "belief free"
[[1]]
[1] 0.1839225

[[2]]
[1] 0.3690239

[[3]]
[1] 0.1920113

[[4]]
[1] 0.3826087

[[5]]
[1] 0.1945486

[[6]]
[1] 0.3904894

[[7]]
[1] 0.2033186

[[8]]
[1] 0.4054678

[[9]]
[1] 0.22387

[[10]]
[1] 0.4198351

[[11]]
[1] 0.2065049

[[12]]
[1] 0.4146424

[[13]]
[1] 0.2336948

[[14]]
[1] 0.4358198

[[15]]
[1] 0.2376516

[[16]]
[1] 0.4458278

[[17]]
[1] 0.2200567

[[18]]
[1] 0.4420242

[[19]]
[1] 0.268833

[[20]]
[1] 0.4770451

[[21]]
[1] 0.2532768

[[22]]
[1] 0.4753024

[[23]]
[1] 0.2585753

[[24]]
[1] 0.4879627

[[25]]
[1] 0.2865402

[[26]]
[1] 0.50862

[[27]]
[1] 0.2420266

[[28]]
[1] 0.480596

[[29]]
[1] 0.2928907

[[30]]
[1] 0.5224319

[[31]]
[1] 0.3198426

[[32]]
[1] 0.5419731

[[33]]
[1] 0.2474898

[[34]]
[1] 0.4944718

[[35]]
[1] 0.2779132

[[36]]
[1] 0.516351

[[37]]
[1] 0.3273093

[[38]]
[1] 0.5569945

[[39]]
[1] 0.2602628

[[40]]
[1] 0.517114

[[41]]
[1] 0.2845506

[[42]]
[1] 0.5315114

[[43]]
[1] 0.313716

[[44]]
[1] 0.5520315

[[45]]
[1] 0.3618217

[[46]]
[1] 0.5916421

[[47]]
[1] 0.2669721

[[48]]
[1] 0.5336715

[[49]]
[1] 0.2988602

[[50]]
[1] 0.5555537

[[51]]
[1] 0.3215987

[[52]]
[1] 0.5685396

[[53]]
[1] 0.3494436

[[54]]
[1] 0.5876452

[[55]]
[1] 0.3069816

[[56]]
[1] 0.5736672

[[57]]
[1] 0.337369

[[58]]
[1] 0.5939159

[[59]]
[1] 0.3586352

[[60]]
[1] 0.6055576

[[61]]
[1] 0.3851035

[[62]]
[1] 0.6231987

[[63]]
[1] 0.2898551

[[64]]
[1] 0.5797101

[[65]]
[1] 0.3469838

[[66]]
[1] 0.6136566

[[67]]
[1] 0.3757982

[[68]]
[1] 0.6322084

[[69]]
[1] 0.3956614

[[70]]
[1] 0.6425664

[[71]]
[1] 0.3333333

[[72]]
[1] 0.6231884

[[73]]
[1] 0.3869794

[[74]]
[1] 0.6536402

[[75]]
[1] 0.4141556

[[76]]
[1] 0.6704381

[[77]]
[1] 0.4326781

[[78]]
[1] 0.6795669

[[79]]
[1] 0.3171158

[[80]]
[1] 0.6345641

[[81]]
[1] 0.3768116

[[82]]
[1] 0.6666667

[[83]]
[1] 0.426969

[[84]]
[1] 0.6936185

[[85]]
[1] 0.452448

[[86]]
[1] 0.7086109

[[87]]
[1] 0.3647355

[[88]]
[1] 0.6822074

[[89]]
[1] 0.4202899

[[90]]
[1] 0.7101449

[[91]]
[1] 0.4669531

[[92]]
[1] 0.733592

[1] "theory coop= 0.80472775564409"
[1] theory welf 0.733592008776488 strategy below
[1] 1.00 1.00 0.90 0.95 0.25
[1] 0.8333333 0.8333333 0.7666667 0.8000000 0.3333333
[1] 
[1] dre_et_al_08 0.75 -200 300 ewelf 0.138157894736842 coop 0.138157894736842 nplay 28 nmatches 21 nplay/session 28 nsessions 1
[1] 0.2738095
[1] 0.736842105 0.121212121 0.257575758 0.003584229
[1] 0.05219780 0.09065934 0.09065934 0.76648352
[1] 0.03571429 0.06203008 0.06203008 0.52443609
[1] one session
[1]  33.33333 -16.66667  66.66667  16.66667
[1] 0 1 0 0 0 0 0
[1] "nbest= 1 nequ= 1 nclose= 1"
[1] 0.1666667
[1] "belief free"
list()
[1] "theory coop= 0.166666666666667"
[1] theory welf 0.166666666666667 strategy below
[1] 0 0 0 0 0
[1] 0.1666667 0.1666667 0.1666667 0.1666667 0.1666667
[1] 
[1] dre_et_al_08 0.75 -100 200 ewelf 0.466329966329966 coop 0.466329966329966 nplay 22 nmatches 27 nplay/session 22 nsessions 1
[1] 0.6237374
[1] 0.94017094 0.17073171 0.43902439 0.03846154
[1] 0.2954545 0.1553030 0.1553030 0.3939394
[1] 0.1969697 0.1035354 0.1035354 0.2626263
[1] one session
[1] 66.66667 33.33333 66.66667 33.33333
[1] 0 0 0 0 1 0 1
[1] "nbest= 1 nequ= 2 nclose= 0"
[1] 0.1666667
[1] "belief free"
[[1]]
[1] 0.3333333

[[2]]
[1] 0.6666667

[1] "theory coop= 0.666666666666667"
[1] theory welf 0.666666666666667 strategy below
[1] 1 1 0 1 0
[1] 0.8333333 0.8333333 0.1666667 0.8333333 0.1666667
[1] 
[1] bru_kam 0.8 -83.3333333333328 216.666666666667 ewelf 0.351495726495727 coop 0.317307692307692 nplay 36 nmatches 20 nplay/session 12 nsessions 3
[1] 0.4494949
[1] 0.94838710 0.22560976 0.26829268 0.04892601
[1] 0.2100271 0.1111111 0.1111111 0.5677507
[1] 0.16559829 0.08760684 0.08760684 0.44764957
[1] min/max session welf 0.294361525704809 0.386710239651416
[1] 34.629630  9.444444 49.444444 21.296296
[1] 0 1 0 0 0 0 0
[1] "nbest= 1 nequ= 1 nclose= 1"
[1] 0.212963
[1] "belief free"
list()
[1] "theory coop= 0.166666666666667"
[1] theory welf 0.212962962962964 strategy below
[1] 0 0 0 0 0
[1] 0.1666667 0.1666667 0.1666667 0.1666667 0.1666667
[1] 
[1] she_tar_sai 0.75 -25 200 ewelf 0.686392580287929 coop 0.592746400885936 nplay 56 nmatches 26.25 nplay/session 14 nsessions 4
[1] 0.6325052
[1] 0.96274834 0.48059701 0.42089552 0.08463542
[1] 0.4565382 0.1266062 0.1266062 0.2902494
[1] 0.3344408 0.0927464 0.0927464 0.2126246
[1] min/max session welf 0.574461654434773 0.819783834586466
[1] 66.66667 33.33333 66.66667 33.33333
[1] 0 0 0 0 1 0 1
[1] "nbest= 1 nequ= 2 nclose= 0"
[1] 0.2708333
[1] "belief free"
[[1]]
[1] 0.3333333

[[2]]
[1] 0.6666667

[1] "theory coop= 0.553030303030303"
[1] theory welf 0.666666666666667 strategy below
[1] 1.00 1.00 0.00 0.25 0.00
[1] 0.8333333 0.8333333 0.1666667 0.3333333 0.1666667
[1] 
[1] kag_sch 0.75 -50 200 ewelf 0.582269503546099 coop 0.534143870314083 nplay 114 nmatches 30 nplay/session 19 nsessions 6
[1] 0.6917517
[1] 0.96417636 0.27169275 0.32432432 0.02705552
[1] 0.43442405 0.09350891 0.09350891 0.37855813
[1] 0.33090172 0.07122594 0.07122594 0.28834853
[1] min/max session welf 0.50386480092184 0.668131675607752
[1] 66.66667 33.33333 66.66667 33.33333
[1] 0 0 0 0 1 0 1
[1] "nbest= 1 nequ= 3 nclose= 0"
[1] 0.2361111
[1] "belief free"
[[1]]
[1] 0.3333333

[[2]]
[1] 0.6666667

[1] "theory coop= 0.583333333333333"
[1] theory welf 0.666666666666667 strategy below
[1] 1.0 1.0 0.0 0.5 0.0
[1] 0.8333333 0.8333333 0.1666667 0.5000000 0.1666667
[1] 
[1] are_cou_ran 0.125 -33.3333333333333 133.333333333333 ewelf 0.186813186813187 coop 0.186813186813187 nplay 66 nmatches 21 nplay/session 9.42857142857143 nsessions 7
[1] 0.1894841
[1] 0.7500000 0.1875000 0.1250000 0.1041667
[1] 0.04761905 0.19047619 0.19047619 0.57142857
[1] 0.003663004 0.014652015 0.014652015 0.043956044
[1] min/max session welf 0.13034188034188 0.229166666666666
[1] 75.000000 -2.777778 94.444444 16.666667
[1] 0 1 0 0 0 0 0
[1] "nbest= 1 nequ= 1 nclose= 1"
[1] 0.1666667
[1] "belief free"
list()
[1] "theory coop= 0.166666666666667"
[1] theory welf 0.166666666666666 strategy below
[1] 0 0 0 0 0
[1] 0.1666667 0.1666667 0.1666667 0.1666667 0.1666667
[1] 
[1] "av per sess 15.4831460674157"

