Skip to contents

The AgentBasedModel class to represent the agents and their social network

Create and run agent-based models of social behavior in socmod.

AgentBasedModel
socmod implementation of an agent-based model

Running models

The run() function uses the specified partner_selection, interaction, and iterate_model functions to specify these dynamics and iterate the model (an instance of socmod::AgentBasedModel).

run()
Run an agent-based model for either a number of iterations (max_its) or until some stop condition is met (e.g., fixation).

Learning (strategy) functions

Functions to pass to run for model iteration in a learning model, and for either success-biased or frequency-biased adaptive learning.

iterate_learning_model()
A generic method for iterating a learning model, setting the current behavior and fitness to be whatever was identified as the next behavior and fitness.
success_bias_interact()
Success-biased interaction to be paired with success_bias_teacher_selection that sets the learner's next behavior and fitness to be the teacher's current behavior and fitness.
success_bias_select_teacher()
Success-biased teacher selection
frequency_bias_interact()
Interaction function for frequency-biased adaptive learning.
frequency_bias_select_teacher()
Frequency biased teacher selection does nothing

Agents and their neighbors

Agents in the model are represented by a number of attributes, with select class methods to track lists of their neighbors.

Agent
Agent for use with AgentBasedModel instances
Neighbors
Encapsulation of an agent's neighbors.

Networks

Create networks, including a growing suite of network construction routines.

make_homophily_network()
Create an undirected asymmetric homophily network.
make_small_world()
Make a small world network.
make_preferential_attachment()
Make a preferential attachment network.
G_NM()
Erdős-Rényi random graph G(N, M).
make_regular_lattice()
Create a regular lattice graph.
plot_homophilynet()
Plot homophily network where groups color nodes.
ggnetplot()
Command that operates like ggplot
add_unique_edge()
Add an undirected edge from v1 to v2 to graph g if it does not already exist.
get_all_possible_edges()
Get all possible edges between node indices 1 to N for either directed or undirected networks.
not_adjacent()
Check two vertices are not adjacent.