Skip to content

Commit

Permalink
ActivityDrivenModel: Use the copula
Browse files Browse the repository at this point in the history
Use the copula to generate correlated activities and reluctances.

Co-authored-by: Amrita Goswami <[email protected]>
  • Loading branch information
MSallermann and amritagos committed Mar 24, 2024
1 parent 9e5257d commit cd452a6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/models/ActivityDrivenModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ void ActivityDrivenModel::get_agents_from_power_law()
power_law_distribution<> dist_activity( eps, gamma );
truncated_normal_distribution<> dist_reluctance( reluctance_mean, reluctance_sigma, reluctance_eps );

bivariate_gaussian_copula copula( covariance_factor, dist_activity, dist_reluctance );

auto mean_activity = dist_activity.mean();

// Initial conditions for the opinions, initialize to [-1,1]
Expand All @@ -77,18 +79,16 @@ void ActivityDrivenModel::get_agents_from_power_law()
{
network.agents[i].data.opinion = dis_opinion( gen ); // Draw the opinion value

if( !mean_activities )
{ // Draw from a power law distribution (1-gamma)/(1-eps^(1-gamma)) * a^(-gamma)
network.agents[i].data.activity = dist_activity( gen );
}
else
{
network.agents[i].data.activity = mean_activity;
}
auto res = copula( gen );
network.agents[i].data.activity = res[0];

if( use_reluctances )
{
network.agents[i].data.reluctance = dist_reluctance( gen );
network.agents[i].data.reluctance = res[1];
}
if( mean_activities )
{
network.agents[i].data.activity = mean_activity;
}
}

Expand Down

0 comments on commit cd452a6

Please sign in to comment.