henryliangt / research_abs_notes

research code for abusive supervision
2 stars 0 forks source link

Simulate IMWM theory in Matlab #4

Closed henryliangt closed 4 years ago

henryliangt commented 4 years ago

% Simulation setup tstep = 1; tspan = [0,100]; tvec = (tspan(1): tstep: tspan(2)); tchange = 30; goal_effect_weight = 0.5; intrinsic_value = 0.75; feedback = 1; ability = 1; task_complexity = 0.2; k = 0.3; fade = 0.05; initial_weight = 2.5; assigned_goal_effect = 0; assigned_goal_difficulty = 0.94; personality = 0.5; % Initial value, “xyz_0” indicates the initial value of xyz SELF_EFFICACY_0 = personality; goal_specificity_0 = 0; value = intrinsic_value + assigned_goal_difficultygoal_specificity_0goal_effect_weight; if SELF_EFFICACY_0valuegoal_specificity_0 >= assigned_goal_difficulty personal_goal_0 = assigned_goal_difficulty; else personal_goal_0 = SELF_EFFICACY_0value; end EFFORT_0 = personal_goal_0; performance_0 = min(EFFORT_0(1-task_complexity)ability, ability); EFFORT_vec = zeros(numel(tvec),1); SELF_EFFICACY_vec = zeros(numel(tvec),1); performance_vec = zeros(numel(tvec),1); EFFORT_vec(1) = EFFORT_0; SELF_EFFICACY_vec(1) = SELF_EFFICACY_0; performance_vec(1) = performance_0; % Run simulation % “_minus” indicates the variable value at the previous time step % “_vec” stores the simulation results (time-series) of the variable for i = 1: numel(tvec)-1 EFFORT_minus = EFFORT_vec(i); SELF_EFFICACY_minus = SELF_EFFICACY_vec(i); Weight = initial_weight/(1+itstepfade); if i >= tchange goal_specificity = 1; else goal_specificity = 0; end value = intrinsic_value + assigned_goal_difficultygoal_specificitygoal_effect_weight; if SELF_EFFICACY_minusvaluegoal_specificity >= assigned_goal_difficulty personal_goal = assigned_goal_difficulty; else personal_goal = SELF_EFFICACY_minusvalue; end performance = min(EFFORT_minus(1-task_complexity)ability, ability); capacity = performance/EFFORT_minus; Rate_EFFORT = personal_goal - (performance + (1-feedback)SELF_EFFICACY_minus); Rate_SELF_EFFICACY = k(capacity-SELF_EFFICACY_minus) + Weightassigned_goal_difficultygoal_specificityassigned_goal_effect; EFFORT = EFFORT_minus + Rate_EFFORTtstep; SELF_EFFICACY = SELF_EFFICACY_minus + Rate_SELF_EFFICACYtstep; EFFORT_vec(i+1) = EFFORT; SELF_EFFICACY_vec(i+1) = SELF_EFFICACY; performance_vec(i+1) = min(EFFORT(1-task_complexity)*ability, ability); end

henryliangt commented 4 years ago

https://matlab.mathworks.com/