Libro: Small System dynamics models for big issues: triple jump towards real-world complexity
Let’s focus on families with multiple problems only, and let’s assume that individuals born in families with multiple problems are indeed trapped, but that they do not necessarily resort to crime. Model an aging chain of kids, youngsters, adults and retirees. Initially, there are 1 million kids, 1 million youngsters, 3 million adults, and 750000 retirees within these families with multiple problems. Suppose for the sake of simplicity that only retirees die, on average after an average time as retiree of 15 years, i.e. deaths equals retirees divided by average time as retiree. Similarly, adults flow after an average time as adult of 40 years from adults to retirees, youngsters after an average time as youngster of 12 years from youngsters to adults, and kids after an average time as kid of 12 years from kids to youngsters. Both adults and youngsters give birth: the birth inflow is thus the sum of the adults times the annual fertility rate of adults of 3 percent per adult per year and the youngsters times the annual fertility rate of youngsters of 0.3% per youngster per year.
Suppose 6 million crimes are committed annually by others, that is, by criminals that are not part of families with multiple problems. Apart from these crimes by others, crimes are committed by criminal kids at a rate of 2 criminal acts per criminal kid per year, by criminal youngsters at a rate of 4 criminal acts per criminal youngster per year, by criminal adults at a rate of 12 criminal acts per criminal adult per year, and by criminal retirees at a rate of 4 criminal acts per criminal retiree per year. Suppose that, in these families with multiple problems, the percentage of kids with criminal behavior amounts to 5%, the percentage of youngsters with criminal behavior amounts to 50%, the percentage of adults with criminal behavior amounts to 60%, and the percentage of retirees with criminal behavior amounts to 10%.
Como primer paso haremos un listado del tipo de variables en el modelo:
Variables de Estado (Stock variables)
Variables de flujo (flow variables)
Birth inflow
Kids to youngsters
Youngsters to adults
Adults to retiree
Deaths
Crimes by kids
Crimes by youngsters
Crimes by Adults
Crimes by Retirees
Variables auxiliares endógenas (endogenous auxiliary variables)
Parámetros de simulación (variables en la frontera del sistema o exogenous auxiliary variables)
library(deSolve)
crimes <- function(t, state, parameters) {
with(as.list(c(state,parameters)), {
#Endogenous auxiliary variables
criminal.kids= kids*percentage.kids.criminal.behavior
criminal.youngsters= youngsters*percentage.youngsters.criminal.behavior
criminal.adults= adults*percentage.adults.criminal.behavior
criminal.retirees= retirees*percentage.retirees.criminal.behavior
crimes.by.kids= criminal.kids*crimactsperkid
crimes.by.youngsters= criminal.youngsters*crimactsperyoungster
crimes.by.adults= criminal.adults*crimactsperadult
crimes.by.retirees=criminal.retirees*crimactsperretiree
crimes= crimes.by.kids+crimes.by.youngsters+crimes.by.adults+crimes.by.retirees+ crimesbyothers
#Flow variables
adults.to.retirees = adults/avg.time.as.adult
youngsters.to.adults= youngsters/avg.time.as.youngster
kids.to.youngsters= kids/avg.time.as.kid
death= retirees/avg.time.as.retiree
birth= (adults*fertilityadults) + (youngsters*fertilityyoungsters)
crimes.by.kids= criminal.kids*crimactsperkid
crimes.by.youngsters= criminal.youngsters*crimactsperyoungster
crimes.by.adults= criminal.adults*crimactsperadult
crimes.by.retirees=criminal.retirees*crimactsperretiree
#State (stock) variables
dkids<- birth - kids.to.youngsters
dyoungsters <- kids.to.youngsters - youngsters.to.adults
dadults = youngsters.to.adults - adults.to.retirees
dretirees= adults.to.retirees-death
list(c(dkids,
dyoungsters,
dadults,
dretirees
))
})
}
parameters<-c(crimactsperkid = 2,
crimactsperyoungster = 4,
crimactsperadult = 12,
crimactsperretiree = 4,
fertilityyoungsters = .3/100,
fertilityadults=3/100,
crimesbyothers=6000000,
percentage.kids.criminal.behavior=5/100,
percentage.youngsters.criminal.behavior=50/100,
percentage.adults.criminal.behavior=60/100,
percentage.retirees.criminal.behavior=10/100,
avg.time.as.adult=40,
avg.time.as.retiree=15,
avg.time.as.youngster=12,
avg.time.as.kid=12)
InitialConditions <- c(kids = 1000000,
youngsters = 1000000,
adults=3000000,
retirees=750000)
times <- seq(0 , #initial time
50, #end time
1 ) #time step, days
intg.method<-c("rk4")
out <- ode(y = InitialConditions,
times = times,
func = crimes,
parms = parameters,
method =intg.method )
plot(out,
col=c("blue"))
Referencias
Pruyt, E. (2013). Small System dynamics models for big issues : triple jump towards real-world complexity. E. http://resolver.tudelft.nl/uuid:10980974-69c3-4357-962f-d923160ab638