% Simulate Hawk-Dove investment game by Cho and Jang (2024) % This is generated March 28, 2023 % The file is written by Dr. Jang, T.-S. clear all; close all; num = 10000; tt = 1000; ret_norm = 0.1; ret_crisis = -1.0; ret_safe = 0.04; ret_bar = 0.8; wealth_int = 1000; agent_beta = []; % initial risky asset ratio for individual investors for ii = 1:num agent_beta(ii,1) = ii/num; % initial risky asset agent_wealth(ii,1) = wealth_int; end average_beta = mean(agent_beta); disp(average_beta); wealth_risk = 0; wealth_safe = 0; Gam_count = 0; for jj = 1:tt wealth_risk = 0; wealth_safe = 0; if average_beta < ret_bar glob_state = 0; % normal state ret = ret_norm; else glob_state = 1; % crisis state ret = ret_crisis; Gam_count = Gam_count + 1; disp(jj); %for ii = 1:num % agent_wealth(ii,1) = wealth_int; %end end for ii = 1:num agent_wealth(ii,1) = agent_wealth(ii,1)*(agent_beta(ii,1)*(1+ret) + (1-agent_beta(ii,1))*(1+ret_safe)); wealth_risk = wealth_risk + agent_wealth(ii,1)*agent_beta(ii,1); wealth_safe = wealth_safe + agent_wealth(ii,1)*(1-agent_beta(ii,1)); agent_wealth0(ii,jj) = agent_wealth(ii,1); end %agent_wealth0(jj,1) = sum(agent_wealth); %wealth_risk0(jj,1) = wealth_risk; %wealth_safe0(jj,1) = wealth_safe; kk(jj,1) = 1 - ((1+ret_norm)/(ret_norm-ret_safe))*(Gam_count/jj); gamma0(jj,1) = jj/Gam_count; average_beta = wealth_risk / (wealth_risk + wealth_safe); beta_hist(jj,1) = average_beta; end figure; subplot(1,2,1); plot(beta_hist); title('Numerical Simulation of Average Beta'); subplot(1,2,2); plot(agent_wealth); title('Wealth Distribution');