1
Computational Social Psychology
Week 2: Creating your very first model
Jiin Jung, Ph.D.
Lehigh University
jiin.jung@lehigh.edu
Life (1958)
“La plume de ma tante
est sur le bureau de mon oncle”
Objectives
Open the code tab in NetLogo
Types the code below
Create “command buttons” in Interface
Create “command buttons” in Interface
“step” is go but for just one tick
Let’s run the model
* If you can track agents actions, use “pen-down”
Let’s bring some randomness�This makes agents heterogeneous
Now agents randomly pick an integer between 0 to 9,
and turn right by that number
Let’s run again
You want to parameterize a population
Create an interface element
to input a parameter value
You want to parameterize a population
Replace 10 with a parameter label, “population”
Let’s run the model with 60 turtles
Let’s get agents interact with other agents�– This brings ‘sociality’ to agents
Programming “social” agents
Agents find friend(s) at each iteration
Each turtle has its own friend(s).
🡪 This is called a turtle variable
Make turtles social – make friends
Let’s make agents' sociality visible to us
Programming “social” agents
If an agent has any friend(s), the agent gets bigger
Let’s run the model with 60 turtles
Program ‘Friends bring more friends’
Let’s program “social agents become more social”
Sociality
Let’s plot how fast sociality increases?
Let’s plot how fast sociality increases?
Global variables
Create a plot in interface tab
Plotting the frequency distribution of sociality
Notice the patterns of sociality increases
“La plume de ma tante” model
Resources