Simulation of my hypothesis for the online-exp
Author
Wataru Toyokawa
Title
Simulation of my hypothesis for the online-exp
Description
This is a code used in Toyokawa W, Whalen A and Laland KN. (2019). Social learning strategies regulate the wisdom and madness of interactive crowds. Nature Human Behaviour 3(2):183-193. (doi: 10.1038/s41562-018-0518-x)
Category
Academic Articles & Supplements
Keywords
Social learning, collective intelligence, reinforcement learning, computational modelling, human behaviour
URL
http://www.notebookarchive.org/2024-04-alrxs4n/
DOI
https://notebookarchive.org/2024-04-alrxs4n
Date Added
2024-04-23
Date Last Modified
2024-04-23
File Size
374.58 kilobytes
Supplements
Rights
CC BY 4.0



This is a code used in Toyokawa W, Whalen A and Laland KN. (2019). Social learning strategies regulate the wisdom and madness of interactive crowds. Nature Human Behaviour 3(2):183-193. (doi:10.1038/s41562-018-0518-x)
Simulation of my hypothesis for the online-exp
Simulation of my hypothesis for the online-exp
Wataru Toyokawa
Model
q[i][t]=(1-λ)softmax+λconformity[n,θ]
whose softmax parameters (learning rate & temperature) are optimize for asocial condition. Varying λ and θ, I aim to check whether tradeoff between noise reduction benefit and herding effect would emerge.
Intermediate condition
Intermediate condition
Round[RandomVariate[NormalDistribution[3.1-2*0.742,0.55],1],0.1](*low*)Round[RandomVariate[NormalDistribution[3.1-0.642,0.55],1],0.1](*mid*)Round[RandomVariate[NormalDistribution[3.1,0.55],1],0.1](*high*)
Plot[Evaluate@Table[PDF[NormalDistribution[μ,0.55],x],{μ,{3.1-2*0.742,3.1-0.742,3.1}}],{x,-6,6},FillingAxis,PlotRange{0,1}]
Parameter setting:
lifetime = 70,
changing at 41 (1-40: environment 1, 41-70: environment 2)
Parameter setting:
lifetime = 70,
changing at 41 (1-40: environment 1, 41-70: environment 2)
lifetime = 70,
changing at 41 (1-40: environment 1, 41-70: environment 2)
Note that both LR and Temp parameters are drawn from normal distributions whose means and SDs are based on the experimental result
(*--settings--*)lifetime=70;changingPoint=41;replication=10000;(*10000*)basePayoffMean=3.1;payoffSD=0.55;qualityDiff=0.742;boxDistribution1={0,0,1};boxDistribution2={2,0,1};groupSizes={3,10,30};Lambda=Flatten[{0.01,Table[i,{i,0.1,0.9,0.1}]}];Theta={0.5,1,3,6};(*parammeansandsds*)alphaRawMuGroup=0.90;alphaRawSDGroup=1.61;(*betaMuGroup=3.17;betaSDGroup=1.09;*)betaMean=1.68;annealingMean=3.01;betaSd=0.64;annealingSd=2.04;alphaRawMuIndiv=-0.05;alphaRawSDIndiv=2.14;betaMuIndiv=2.7;betaSDIndiv=1.13;thetaSD=2.69;lambdaSD=2;(*----*)lengthBoxDistribution=Length[boxDistribution1];inherentExpect=1.`*^-10;boxMeans1=Table[basePayoffMean,{lengthBoxDistribution}]+boxDistribution1*qualityDiff;boxMeans2=Table[basePayoffMean,{lengthBoxDistribution}]+boxDistribution2*qualityDiff;payoffGenerate[m_]:=Round[RandomVariate[NormalDistribution[m,payoffSD],1],0.01];
Simulation:
Simulation:
simulationResults/UNC_Moderate_expParameters_timeSeries.csv
simulationResults/UNC_Moderate_expParameters_eachGroup.csv
Plot optimal choice rate:
Plot optimal choice rate:
fig1=Show[GraphicsGrid[Table[ListLinePlot[Table[Take[LandscapeSimulation2[[Position[Transpose[{Transpose[N[LandscapeSimulation2]][[2]],Transpose[N[LandscapeSimulation2]][[3]]}],{N[θ],N[λ]}][[i]]]][[1]],{4,lifetime+3}],{i,1,Length[groupSizes]}],FrameTrue,PlotRange{0,1},PlotLabel{θ,λ},LabelStyle{12,FontFamily"Times New Roman"},PlotStyleTranspose[{Append[Append[Table[GrayLevel[.8-0.2*i],{i,1,Length[groupSizes]-2}],Orange],Red],{Dotted,Dashed,Bold},{AbsoluteThickness[2],AbsoluteThickness[2],AbsoluteThickness[2]}}]],{λ,Lambda},{θ,Theta}],Spacings->{Scaled[0],Scaled[0]}],ImageSize140*72/25.4,AxesLabel{"Round","Choice accuracy"}](*Table[Histogram[Table[Take[LandscapeSimulation2[[Position[Transpose[{Transpose[N[LandscapeSimulation2]][[2]],Transpose[N[LandscapeSimulation2]][[3]]}],{N[θ],N[λ]}][[i]]]][[1]],{lifetime+5,lifetime+replication+4}],{i,1,Length[groupSizes]}],PlotRange{0,2},PlotLabel{θ,λ}],{λ,lambda},{θ,theta}]*)Export["figure001.pdf",fig1]
figure001.pdf
Weak conformity vs strong conformity
Weak conformity vs strong conformity
(*--settings--*)lifetime=70;changingPoint=41;replication=1000;(*10000*)basePayoffMean=3.1;payoffSD=0.55;qualityDiff=0.742;boxDistribution1={0,0,1};boxDistribution2={2,0,1};groupSizes={5,10,15};Lambda={0.2,0.7};Theta={1,3};(*alphaRawMuGroup=0.84;alphaRawSDGroup=1.48;betaMuGroup=3.17;betaSDGroup=1.09;alphaRawMuIndiv=-0.05;alphaRawSDIndiv=2.14;betaMuIndiv=2.7;betaSDIndiv=1.13;thetaSD=0.5;lambdaSD=1;*)(*----*)lengthBoxDistribution=Length[boxDistribution1];inherentExpect=1.`*^-10;boxMeans1=Table[basePayoffMean,{lengthBoxDistribution}]+boxDistribution1*qualityDiff;boxMeans2=Table[basePayoffMean,{lengthBoxDistribution}]+boxDistribution2*qualityDiff;payoffGenerate[m_]:=Round[RandomVariate[NormalDistribution[m,payoffSD],1],0.1];
Simulation:
Simulation:
simulationResults/UNC_Moderate_expParameters_timeSeriesEachGroup.csv


Cite this as: Wataru Toyokawa, "Simulation of my hypothesis for the online-exp" from the Notebook Archive (2024), https://notebookarchive.org/2024-04-alrxs4n

Download

