Description Usage Format Details Value Fields Methods Examples
This R6 class defines functions for running agent-based simulations described in Ellison & Miceli (2017 - Language 93(2):255-287) - hereafter EM.
These simulations use the cognitive model
defined by the class TensorAgent in this package. The modelling works by setting the parameters using
auxiliary methods, then calling a $simulate()
method to execute the simulation.
The simulation models a two-language community, with 2 monolingual populations and a bilingual community.
The sizes of each of these communities can be set by parameter. The language mode and monitoring level are
set globally in the simulation, applying to all individuals in the bilingual community (they have no effect
on the monolingual communities).
1 |
R6Class
object.
Graphs 10a,b,c in EM are based on simulations run using this class.
An object of class PopulationSimulation.
Object of PopulationSimulation
with methods for drawing graphs according suitable for final version of the paper.
LanguageMode
The parameter defining how likely agents are to generate potential (even if unrealised) intrusions from non-target langauges. Parameter takes values [0,1], 0 if no chance of intrusions, 1 if 50% chance of intrusion.
MonitoringLevel
The parameter defining how intensely agents monitor to avoid non-target language intrusions. Parameter takes values [0,1], 0 if no monitoring takes place, 1 if all potential intrusions are blocked.
Population_A
The number of agents in population speaking only language A.
Population_B
The number of agents in population speaking only language B.
Population_AB
The number of agents in population speaking both languages: A and B.
Population
The total number of agents.
SamplesPerAgent
The amount of data collected from each agent to serve as inputs to other agents' lexical memory.
NumberOfGenerations
The number of generations. In this simulation process, one generation involves two steps: talking on inputs, and generating data according to the cognitive model which will be input for the next generation.
new()
Creates a new, empty PopulationSimulation
object.
$setPopulationStructure(A=100,B=100,AB=0)
Sets the population levels for the 2 monolingual communities and the bilingual community.
$setLanguageMode(languageMode)
Sets the language mode field.
$setMonitoringLevel(monitoringLevel)
Sets the monitoring level field.
$setSamplesPerAgent(samplesPerAgent)
Sets the samples-per-agent field.
$setNumberOfGenerations(numberOfGenerations)
Sets the number of generations for the simulation.
$clearLexicon()
Empty the lexicons of all agents.
$constructDataTensor()
Initialises the tensor structures of each agent.
$make_p_f_st__bm()
Builds the probabilistic mapping from meanings and target languages to forms in each agent. This is a complete run of the TensorAgent simulation for each agent, based on the input distribution of language-meaning-form combinations.
$setLexicon(A_d=0.5,A_nA=0.5,A_nB=0.0,B_d=0.5,B_nA=0.0,B_nB=0.5)
Set the initial frequency associated with each form in each language. A_d
is the doppel as it is in language A, A_nA
is the non-doppel native to language A as it appears in A, A_nB
is the non-doppel native to language B should it appear in A, B_d
is the doppel in language B, B_nA
is the non-doppel native to A if it appears in language B, B_nB
is the non-doppel native to B as it appears in that language. Values for each of these can be any positive floating-point number.
$productionDistribution()
Aggregates the distribution over forms in each language.
$sampleFromDistribution(distribution,exact=FALSE)
Takes a sample from the given distribution. If exact
is TRUE
then the distribution extracted is exact distributional copy as opposed to a random sample.
$setDistribution(samples)
Sets the distribution over lexical items in each agent (call $clearLexicon()
first).
$simulate(exact=FALSE)
Simulate for the specified number of generations, with the given parameter values, from a starting distribution of A_d=0.55,A_nA=0.45,A_nB=0.0,B_d=0.5,B_nA=0.0,B_nB=0.5
.
1 2 3 4 5 6 7 8 9 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.