diff --git a/README.md b/README.md new file mode 100644 index 0000000..de542c9 --- /dev/null +++ b/README.md @@ -0,0 +1,44 @@ +## README + +## About +This is some R code for the paper [Labor, Capital, and the Optimal Growth ofSocial Movements](https://nunosempere.github.io/ea/MovementBuildingForUtilityMaximizers.pdf) + +## Structure of the code. + +1. `Variables.R`: Contains variables +2. `Transition dynamics.R`: If we know our system at time t, generate an approximation of our system at time t+stepsize. +3. `Forward Shooting.R`: Carries out the forward shooting. +4. `ReverseShooting.R`: Nonfunctional. Ignore. +5. `Plotting.R`: Generates graphs of the results + +## How to run + +Open files 1.,2.,3., and 5. in an IDE for R, like RStudio. Run them in order. For `Plotting.R`, add or create the directory in which you want the graphs to be generated, making sure it has suitable permissions. + +## Gotchas +Using a very small stepsize runs into floating point errors. Consider a stylized example: + +```r +options(digits=22) + +dx <- 10^43 +numsteps <- 10^7 +stepsize <- 10^(-3) + +## Example 1 +x <- pi*1e+60 +print(x) +for(i in c(1:numsteps)){ + x <- x+dx*stepsize +} +x == pi*1e+60 +print(x) + +## Example 2 +x <- pi*1e+60 + numsteps*stepsize*dx +x == pi*1e+60 +print(x) + +``` + +The two examples should give the same results, but don't. diff --git a/code/ForwardShooting.R b/code/ForwardShooting.R new file mode 100644 index 0000000..9c2a87c --- /dev/null +++ b/code/ForwardShooting.R @@ -0,0 +1,63 @@ +# Forward shooting +options(digits=7) + +## Evolution +x1_array_forward_shooting <- c() +x3_array_forward_shooting <- c() +a1_array_forward_shooting <- c() +a3_array_forward_shooting <- c() +s1_array_forward_shooting <- c() +s3_array_forward_shooting <- c() +x1_t = x1_init +x3_t = x3_init +#stepsize +comienzo = Sys.time() +max = max(times_forward_shooting) + +for(t in times_forward_shooting){ + if((100*t/max) %in% seq(from=0, to=100, by=1)){ + cat(paste(floor(100*t/max), "%", sep="")) + cat("\n") + } + a1_t = a1(t) + a3_t = a3(t) + s1_t = s1(t) + s3_t = s3(t) + x1_t = x1_t*(1+r1_stepsize) + dx1(t)*stepsize + x3_t = x3_t*(1+r3_stepsize) + dx3(t)*stepsize + + a1_array_forward_shooting <- c(a1_array_forward_shooting, a1_t) + a3_array_forward_shooting <- c(a3_array_forward_shooting, a3_t) + s1_array_forward_shooting <- c(s1_array_forward_shooting, s1_t) + s3_array_forward_shooting <- c(s3_array_forward_shooting, s3_t) + x1_array_forward_shooting <- c(x1_array_forward_shooting, x1_t) + x3_array_forward_shooting <- c(x3_array_forward_shooting, x3_t) + +} +fin = Sys.time() +fin-comienzo + +## Checking conditions +options(digits=22) + +l = length(times_forward_shooting) +x1_array_forward_shooting[l] +x1_growth = (x1_array_forward_shooting[l]-x1_array_forward_shooting[l-1])/x1_array_forward_shooting[l-1]/(1*stepsize) +x1_growth +sum(x1_array_forward_shooting<0) + +x3_array_forward_shooting[l] +x3_growth = (x3_array_forward_shooting[l]-x3_array_forward_shooting[l-1])/x3_array_forward_shooting[l-1]/(1*stepsize) +x3_growth +sum(x3_array_forward_shooting<0) + + +a1_growth = (a1_array_forward_shooting[l]-a1_array_forward_shooting[l-1])/a1_array_forward_shooting[l-1]/stepsize +a1_growth + +a3_growth = (a3_array_forward_shooting[l]-a3_array_forward_shooting[l-1])/a3_array_forward_shooting[l-1]/stepsize +a3_growth + +a1_array_forward_shooting[l]/x1_array_forward_shooting[l] +plot((a1_array_forward_shooting/x1_array_forward_shooting)[(l-100):l]) + diff --git a/code/Plotting.R b/code/Plotting.R new file mode 100644 index 0000000..500f474 --- /dev/null +++ b/code/Plotting.R @@ -0,0 +1,442 @@ +# Plotting +## install.packages("tidyverse") <- Not totally necessary. +## install.packages("ggplot2") +## install.packages("ggsci") +library(ggplot2) +library(ggsci) + +## General variables +saveplots=TRUE +times = times_forward_shooting + ## Also for reverse shooting plots; time in reverse shooting is inverted +shootingtype="reverse"#"forward"# +shootingtype="forward"#"reverse"# +# directory = "/home/nuno/Documents/core/SRF/BackShooting/RCode/plots/temp" + +workingdir = "/home//Documents/" # Write your own +# directory = paste(workingdir, shootingtype, "shooting", "/", last, "years", sep="") +# directory +setwd(workingdir) +# setwd(directory) + +if(shootingtype=="forward"){ + x1_array_plotting <- x1_array_forward_shooting + x3_array_plotting <- x3_array_forward_shooting + a1_array_plotting <- a1_array_forward_shooting + a3_array_plotting <- a3_array_forward_shooting + s1_array_plotting <- s1_array_forward_shooting + s3_array_plotting <- s3_array_forward_shooting +} else if(shootingtype=="reverse"){ + x1_array_plotting <- x1_array_reverse_shooting + x3_array_plotting <- x3_array_reverse_shooting + a1_array_plotting <- a1_array_reverse_shooting + a3_array_plotting <- a3_array_reverse_shooting + s1_array_plotting <- s1_array_reverse_shooting + s3_array_plotting <- s3_array_reverse_shooting +} + +height = 5 +width = floor(height*(1+sqrt(5))/2) +imagenumbercounter = 1 +saveplot = function(imagename){ + if(saveplots){ + ggsave(paste(imagenumbercounter,"_", imagename, "_",shootingtype, "shooting",".png", sep =""), units="in", width=width, height=height) + imagenumbercounter <<- imagenumbercounter+1 + ## https://stackoverflow.com/questions/1236620/global-variables-in-r + } +} +options(digits=1) ## Just for display + +## x1 and x3 + +xs <- list() +xs$values <- c(x1_array_plotting, x3_array_plotting) +xs$var <- c(rep("x1", length(x1_array_plotting)), rep("x3", length(x3_array_plotting))) +xs$times = rep(times,2) +xs <- as.data.frame(xs) +title_text = "Evolution of state variables" +(ggplot(data = xs, aes(x = times, y= values, color = var)) + + geom_line(size = 0.5) + + labs( + title=title_text, + x="Year since start", + y="Capital and labor" + ) + +theme( + legend.title = element_blank(), + plot.title = element_text(hjust = 0.5), + legend.position="bottom", + legend.box="vertical" + ) + + scale_color_lancet( + breaks=c("x1", "x3"), + labels=c("Capital", "Labor") + + ) + + scale_y_continuous(breaks = seq(min(x1_array_plotting), max(x1_array_plotting), length.out=5)) ## Necessary for displaying very large numbers +) +saveplot("StateVariablesX1X3") + +## x1 and x3: log plot +title_text = "Evolution of state variables" +(ggplot(data = xs, aes(x = times, y= values, color = var)) + + geom_line(size = 0.5) + +labs( + title=title_text, + subtitle="(logarithmic scale)", + x="Year since start", + y="Capital and labor" + ) + +theme( + legend.title = element_blank(), + plot.title = element_text(hjust = 0.5), + plot.subtitle = element_text(hjust = 0.5), + legend.position="bottom", + legend.box="vertical" + ) + + scale_color_lancet( + breaks=c("x1", "x3"), + labels=c("Capital", "Labor") + + ) + + scale_y_continuous(trans = 'log2') +) +saveplot("StateVariablesX1X3logplot") + + +## Only x3 +equis3 <- list() +equis3$values <- c(x3_array_plotting) +equis3$times = times +equis3 <- as.data.frame(equis3) + +title_text = "Evolution of movement size" +(ggplot(data = equis3, aes(x = times, y= values)) + +geom_line(size = 0.5) + +labs( + title=title_text, + x="Year since start", + y="Labor" + ) + +theme( + legend.title = element_blank(), + plot.title = element_text(hjust = 0.5), + legend.position="bottom", + legend.box="vertical" + ) +) +saveplot("StateVariableX3") + + +## s1, s3, s4 +sigmas <- list() +s4_array_plotting=1-s1_array_plotting-s3_array_plotting +sigmas$values <- c(s1_array_plotting, s3_array_plotting,s4_array_plotting) +sigmas$fraction <- c(rep("s1", length(s1_array_plotting)), rep("s3", length(s3_array_plotting)),rep("s4", length(s3_array_plotting))) +sigmas$times = rep(times,3) +sigmas <- as.data.frame(sigmas) + +title_text = "Evolution of labor fractions" +(ggplot(data = sigmas, aes(x = times, y= values, color = fraction)) + + geom_line(size = 0.5) + +labs( + title=title_text, + x="Year since start", + y="Fraction of total labor" + ) + +theme( + legend.title = element_blank(), + plot.title = element_text(hjust = 0.5), + legend.position="bottom", + legend.direction="vertical" + ) + + scale_color_lancet( + breaks=c("s1", "s3", "s4"), + labels=c("Direct work", "Movement building", "Money-making") + + ) +) +saveplot("MovementFractions") + +## s1 and s3 +sigmas <- list() +sigmas$values <- c(s1_array_plotting, s3_array_plotting) +sigmas$fraction <- c(rep("s1", length(s1_array_plotting)), rep("s3", length(s3_array_plotting))) +sigmas$times = rep(times,2) +sigmas <- as.data.frame(sigmas) + +title_text = "Evolution of labor fractions" +subtitle_text = "(only direct work and movement building)" +(ggplot(data = sigmas, aes(x = times, y= values, color = fraction)) + + geom_line(size = 0.5) + +labs( + title=title_text, + subtitle=subtitle_text, + x="Year since start", + y="Fraction of total labor" + ) + +theme( + legend.title = element_blank(), + plot.subtitle = element_text(hjust = 0.5), + plot.title = element_text(hjust = 0.5), + legend.position="bottom", + legend.direction="vertical" + ) + + scale_color_lancet( + breaks=c("s1", "s3"), + labels=c("Direct work", "Movement building") + + ) +) +saveplot("MovementFractionsS1S3") + +## Just direct work. +sigma1 <- list() +sigma1$values <- c(s1_array_plotting) +sigma1$times = times +sigma1 <- as.data.frame(sigma1) + +title_text = "Evolution of direct work \nas a fraction of total labor" +(ggplot(data = sigma1, aes(x = times, y= values)) + +geom_line(size = 0.5) + +labs( + title=title_text, + x="Year since start", + y="Fraction of total labor" + ) + +theme( + legend.title = element_blank(), + plot.title = element_text(hjust = 0.5), + legend.position="bottom", + legend.box="vertical" + ) +) +saveplot("MovementFractionsS1") + + +## Just movement building +sigma3 <- list() +sigma3$values <- c(s3_array_plotting) +sigma3$times = times +sigma3 <- as.data.frame(sigma3) + +title_text = "Evolution of movement building\nas a fraction of total labor" +(ggplot(data = sigma3, aes(x = times, y= values)) + +geom_line(size = 0.5) + +labs( + title=title_text, + x="Year since start", + y="Fraction of labor" + ) + +theme( + legend.title = element_blank(), + plot.title = element_text(hjust = 0.5), + legend.position="bottom", + legend.box="vertical" + ) +) +saveplot("MovementFractionsS3") + +## Just direct work - logplot +sigma1 <- list() +sigma1$values <- c(s1_array_plotting) +sigma1$times = times +sigma1 <- as.data.frame(sigma1) + +title_text = "Evolution of direct work \nas a fraction of labor" +(ggplot(data = sigma1, aes(x = times, y= values)) + +geom_line(size = 0.5) + +labs( + title=title_text, + subtitle="(logarithmic scale)", + x="Year since start", + y="Fraction of labor" + ) + +theme( + legend.title = element_blank(), + plot.subtitle = element_text(hjust = 0.5), + plot.title = element_text(hjust = 0.5), + legend.position="bottom", + legend.box="vertical" + ) + + scale_y_continuous(trans = 'log2') +) +saveplot("MovementFractionsS1logplot") + +## Just movement building +sigma3 <- list() +sigma3$values <- c(s3_array_plotting) +sigma3$times = times +sigma3 <- as.data.frame(sigma3) + +title_text = "Evolution of movement building\nas a fraction of labor" +(ggplot(data = sigma3, aes(x = times, y= values)) + +geom_line(size = 0.5) + +labs( + title=title_text, + subtitle="(logarithmic scale)", + x="Year since start", + y="Fraction of total labor" + ) + +theme( + legend.title = element_blank(), + plot.subtitle = element_text(hjust = 0.5), + plot.title = element_text(hjust = 0.5), + legend.position="bottom", + legend.box="vertical" + ) + + scale_y_continuous(trans = 'log2') +) +saveplot("MovementFractionsS3logplot") + +## sigma_1*x3 and sigma3*x3, sigma_4*x3, +sigmaxs <- list() +sigmaxs$values <- c(s1_array_plotting*x3_array_plotting, s3_array_plotting*x3_array_plotting, s4_array_plotting*x3_array_plotting) +sigmaxs$fraction <- c(rep("s1x3", length(s1_array_plotting)), rep("s3x3", length(s3_array_plotting)), rep("s4x3", length(s3_array_plotting))) +sigmaxs$times = rep(times,3) +sigmaxs <- as.data.frame(sigmaxs) + +title_text = "Evolution of labor\n in absolute terms" +(ggplot(data = sigmaxs, aes(x = times, y= values, color = fraction)) + + geom_line(size = 0.5) + +labs( + title=title_text, + x="Year since start", + y="Absolute number\nof movement participants" + ) + +theme( + legend.title = element_blank(), + plot.title = element_text(hjust = 0.5), + legend.position="bottom", + legend.direction="vertical" + ) + + scale_color_lancet( + breaks=c("s1x3", "s3x3", "s4x3"), + labels=c("Direct work", "Movement building", "Money-making") + + ) +) +saveplot("MovementParticipantNumbersS1S3S4") + +## sigma_1*x3 and sigma3*x3 +sigmaxs <- list() +sigmaxs$values <- c(s1_array_plotting*x3_array_plotting, s3_array_plotting*x3_array_plotting) +sigmaxs$fraction <- c(rep("s1x3", length(s1_array_plotting)), rep("s3x3", length(s3_array_plotting))) +sigmaxs$times = rep(times,2) +sigmaxs <- as.data.frame(sigmaxs) + +title_text = "Evolution of movement participants\nin absolute terms" +(ggplot(data = sigmaxs, aes(x = times, y= values, color = fraction)) + + geom_line(size = 0.5) + +labs( + title=title_text, + subtitle="(only direct workers and movement builders)", + x="Year since start", + y="Absolute number\nof movement participants" + ) + +theme( + legend.title = element_blank(), + plot.title = element_text(hjust = 0.5), + legend.position="bottom", + legend.direction="vertical" + ) + + scale_color_lancet( + breaks=c("s1x3", "s3x3"), + labels=c("Direct work", "Movement building") + + ) +) +saveplot("MovementParticipantNumbersS1S3") + +## sigma_1*x3 and sigma3*x3 logplot +sigmaxs <- list() +sigmaxs$values <- c(s1_array_plotting*x3_array_plotting, s3_array_plotting*x3_array_plotting) +sigmaxs$fraction <- c(rep("s1x3", length(s1_array_plotting)), rep("s3x3", length(s3_array_plotting))) +sigmaxs$times = rep(times,2) +sigmaxs <- as.data.frame(sigmaxs) + +title_text = "Evolution of movement participants\nin absolute terms \n(logarithmic scale)" +(ggplot(data = sigmaxs, aes(x = times, y= values, color = fraction)) + + geom_line(size = 0.5) + +labs( + title=title_text, + subtitle="(only direct workers and movement builders)", + x="Year since start", + y="Absolute number\nof movement participants" + ) + +theme( + legend.title = element_blank(), + plot.title = element_text(hjust = 0.5), + legend.position="bottom", + legend.direction="vertical" + ) + + scale_color_lancet( + breaks=c("s1x3", "s3x3"), + labels=c("Direct work", "Movement building") + + ) + + scale_y_continuous(trans = 'log2') +) +saveplot("MovementParticipantNumbersS1S3logplot") + +## alpha1 and alpha3 +alphas <- list() +alphas$values <- c(a1_array_plotting, a3_array_plotting) +alphas$fraction <- c(rep("a1", length(s1_array_plotting)), rep("a2", length(s3_array_plotting))) +alphas$times = rep(times,2) +alphas <- as.data.frame(alphas) + +title_text = "Evolution of spending" +(ggplot(data = alphas, aes(x = times, y= values, color = fraction)) + + geom_line(size = 0.5) + +labs( + title=title_text, + x="Year since start", + y="Spending" + ) + +theme( + legend.title = element_blank(), + plot.title = element_text(hjust = 0.5), + legend.position="bottom", + legend.direction="vertical" + ) + + scale_color_lancet( + breaks=c("a1", "a2"), + labels=c("Direct spending","Spending on movement building") + + ) +) +saveplot("SpendingA1A3") + +## alpha1 and alpha3: log plot + +alphas <- list() +alphas$values <- c(a1_array_plotting, a3_array_plotting) +alphas$fraction <- c(rep("a1", length(s1_array_plotting)), rep("a2", length(s3_array_plotting))) +alphas$times = rep(times,2) +alphas <- as.data.frame(alphas) + +title_text = "Evolution of spending" +(ggplot(data = alphas, aes(x = times, y= values, color = fraction)) + + geom_line(size = 0.5) + +labs( + title=title_text, + subtitle="(logarithmic scale)", + x="Year since start", + y="Spending" + ) + +theme( + legend.title = element_blank(), + plot.title = element_text(hjust = 0.5), + plot.subtitle = element_text(hjust = 0.5), + legend.position="bottom", + legend.direction="vertical" + ) + + scale_color_lancet( + breaks=c("a1", "a2"), + labels=c("Direct spending","Spending on movement building") + ) + + scale_y_continuous(trans = 'log2') +) +saveplot("SpendingA1A3logplot") + diff --git a/code/ReverseShooting.R b/code/ReverseShooting.R new file mode 100644 index 0000000..bf5b088 --- /dev/null +++ b/code/ReverseShooting.R @@ -0,0 +1,63 @@ +# Reverse shooting +options(digits=22) + +## Evolution +x1_array_reverse_shooting <- c() +x3_array_reverse_shooting <- c() +a1_array_reverse_shooting <- c() +a3_array_reverse_shooting <- c() +s1_array_reverse_shooting <- c() +s3_array_reverse_shooting <- c() +l = length(a1_array_forward_shooting) +x1_t = x1_array_forward_shooting[l] +x3_t = x3_array_forward_shooting[l] + +comienzo = Sys.time() +max = max(times_reverse_shooting) +t=times_reverse_shooting[1] +for(t in times_reverse_shooting){ + if((100*t/max) %in% seq(from=0, to=100, by=3)){ + print(paste(floor(100*t/max), "%", sep="")) + #print("\n") + } + + t_previous = t-stepsize + a1_t = a1(t_previous) + a3_t = a3(t_previous) + s1_t = s1(t_previous) + s3_t = s3(t_previous) + guessmin = 0 + guessmax = x3_t + x3_target = x3_t + + x3_t = dx3_reverse_shooting(t, guessmin, guessmax, x3_target, t_previous) + # x3_t = x3_t - dx3(t-stepsize)*stepsize # + x1_t = (x1_t - dx1(t-stepsize)*stepsize)/(1+r1_stepsize) + + ## But then I can calulate s1, s3 again, and do another iteration. + # for(i in c(1:10)){ + # # using the new x3_t + # s3_t = s3(t_previous) + # x3_t = dx3_reverse_shooting(t, guessmin, guessmax, x3_target) + # x3_t + # } + # s1_t = s1(t_previous) + # x1_t = (x1_t - dx1(t-stepsize)*stepsize)/(1+r_stepsize) + + a1_array_reverse_shooting <- c(a1_t, a1_array_reverse_shooting) + a3_array_reverse_shooting <- c(a3_t, a3_array_reverse_shooting) + s1_array_reverse_shooting <- c(s1_t, s1_array_reverse_shooting) + s3_array_reverse_shooting <- c(s3_t, s3_array_reverse_shooting) + x1_array_reverse_shooting <- c(x1_t, x1_array_reverse_shooting) + x3_array_reverse_shooting <- c(x3_t, x3_array_reverse_shooting) + +} +fin = Sys.time() +fin-comienzo +options(digits=7) +x1_array_reverse_shooting[1] ## 10^11 +x3_array_reverse_shooting[1] + + +# View(x1_array_reverse_shooting) + diff --git a/code/TransitionDynamics.R b/code/TransitionDynamics.R new file mode 100644 index 0000000..4c00a3f --- /dev/null +++ b/code/TransitionDynamics.R @@ -0,0 +1,55 @@ +# Transition dynamics +# install.packages("pracma") +library(pracma) + +## For forward shooting +a1 <- function(t){ + term_a1 = λ_1 * + ((1- λ_1)/( λ_1 * w_3 * exp(γ_1 * t)))^((1-λ_1) * (1-η)) / + (k1_forward_shooting * exp((ρ-r_1) * t)) + result_a1 = term_a1^(1/η) + return(result_a1) +} + +a3 <- function(t){ + first_term_a3 = w_3 * exp(γ_1 * t) * δ_3 * λ_3 * + β_3 * exp(γ_3 * t) / (r_1 - γ_1 - r_3) + second_term_a3 = (1-λ_3)/(λ_3 * w_3 * exp(γ_1 * t)) + subresult_a3 = first_term_a3 * (second_term_a3^(δ_3*(1-λ_3))) + result_a3 = subresult_a3^(1/(1-δ_3)) + return(result_a3) +} + +s1 <- function(t){ + result_s1 = ((1-λ_1)/ λ_1) * (a1_t / (x3_t * w_3 * exp(γ_1 * t))) + return(result_s1) +} + +s3 <- function(t){ + result_s3 = ((1-λ_3)/ λ_3) * (a3_t / (x3_t * w_3 * exp(γ_1 * t))) + return(result_s3) +} + +dx1 <- function(t){ + result_x1 = - a1_t - a3_t + x3_t * w_3 * exp(γ_1 * t) * (1-s1_t - s3_t) + return(result_x1) +} +dx3 <- function(t){ + result_x3 = β_3 * exp(γ_3 * t) * (a3(t)^λ_3 * (s3_t*x3_t)^(1-λ_3))^δ_3 + return(result_x3) +} + +dx3_reverse_shooting <- function(t, guessmin, guessmax, x3_target, t_previous){ + ## Inverting dx3 turns out to be a little bit involved. + check_hypothesis <- function(x3_hypothesis){ + dx3_hypothesis = β_3 * exp(γ_3 * t_previous) * (a3(t_previous)^λ_3 * (s3_t*x3_hypothesis)^(1-λ_3))^δ_3 + difference = x3_target - (x3_hypothesis + dx3_hypothesis*stepsize) + return(difference) + } + x3_best_guess <- bisect(check_hypothesis, guessmin, guessmax)$root + #uniroot(check_hypothesis, lower=guessmin, upper=guessmax, tol = 10^(-22))[[1]] + # x3_best_guess <- uniroot(check_hypothesis, lower=(x3_target-2), upper=(x3_target), tol = 10^(-22), extendInt = "down")[[1]] + ## x3_best_guess <- uniroot(check_hypothesis, c(0, x3_target), tol = 10^(-22), a = 0, extendInt = "upX")[[1]] + return(x3_best_guess) +} + diff --git a/code/Variables.R b/code/Variables.R new file mode 100644 index 0000000..9c883a4 --- /dev/null +++ b/code/Variables.R @@ -0,0 +1,36 @@ +# Variables +η = 0.9 ## 1.1 +ρ = 0.005 +r_1 = 0.06 +r_3 = -0.02 +γ_1 = 0.03 +γ_3 = 0.01 +w_3 = 5000 ## Mean on the EA Survey 2018: ~7000 +β_3 = 1 ## 1 ## 0.5 Corresponds to roughly 5 people convincing 10 other people per year on a 50k year budget + ## Dramatic if beta = 0.5, w_3 = 1000 +λ_1 = 0.5 +λ_3 = 0.5 +δ_3 = 0.44 + +## k1_forward_shooting +k1_forward_shooting = 3*10^(-7) + ## 1*10^(-7) fails. 2*10^(-7) fails + ## Artfully guessed. +k1_reverse_shooting = k1_forward_shooting + + +stepsize = 0.1 + ## stepsize = 0.1 => seconds (7s). + ## stepsize = 0.01 => minutes (3 mins). +r1_stepsize = ((1+r_1)^stepsize)-1 +r3_stepsize = ((1+r_3)^stepsize)-1 + +first = 0 +last = 1000 +times_forward_shooting = seq(from=first, to=last, by=stepsize) +times_reverse_shooting = seq(from=last, to=first, by=-stepsize) + +### Initial conditions. Correspond to "year 0". +x1_init = 10^10 +x3_init = 10^5 + diff --git a/plots/10000years/.Rhistory b/plots/10000years/.Rhistory new file mode 100644 index 0000000..da0542e --- /dev/null +++ b/plots/10000years/.Rhistory @@ -0,0 +1,512 @@ +k1_reverse_shooting = k1_forward_shooting +## Artfully guessed, such that s1 < 1 +stepsize = 0.1 +## stepsize = 0.1 => seconds (7s). +## stepsize = 0.01 => minutes (3 mins). +r_stepsize = ((1+r_1)^stepsize)-1 +first = 0 +last = 10000 +times_forward_shooting = seq(from=first, to=last, by=stepsize) +times_reverse_shooting = seq(from=last, to=first, by=-stepsize) +### Initial conditions. Correspond to "year 0". +x1_init = 10^10 ## 1 billion? 15 billion? 100 billion? Too much? +x3_init = 10^5 +# Forward shooting +options(digits=7) +## Evolution +x1_array_forward_shooting <- c() +x3_array_forward_shooting <- c() +a1_array_forward_shooting <- c() +a3_array_forward_shooting <- c() +s1_array_forward_shooting <- c() +s3_array_forward_shooting <- c() +x1_t = x1_init +x3_t = x3_init +#stepsize +comienzo = Sys.time() +max = max(times_forward_shooting) +for(t in times_forward_shooting){ +if((100*t/max) %in% seq(from=0, to=100, by=1)){ +cat(paste(floor(100*t/max), "%", sep="")) +cat("\n") +} +a1_t = a1(t) +a3_t = a3(t) +s1_t = s1(t) +s3_t = s3(t) +x1_t = x1_t*(1+r_stepsize) + dx1(t)*stepsize +x3_t = x3_t + dx3(t)*stepsize +a1_array_forward_shooting <- c(a1_array_forward_shooting, a1_t) +a3_array_forward_shooting <- c(a3_array_forward_shooting, a3_t) +s1_array_forward_shooting <- c(s1_array_forward_shooting, s1_t) +s3_array_forward_shooting <- c(s3_array_forward_shooting, s3_t) +x1_array_forward_shooting <- c(x1_array_forward_shooting, x1_t) +x3_array_forward_shooting <- c(x3_array_forward_shooting, x3_t) +} +fin = Sys.time() +fin-comienzo +## Checking condition +options(digits=22) +l = length(times_forward_shooting) +x1_array_forward_shooting[l] +x1_growth = (x1_array_forward_shooting[l]-x1_array_forward_shooting[l-1])/x1_array_forward_shooting[l-1]/(1*stepsize) +x1_growth +sum(x1_array_forward_shooting<0) +x3_array_forward_shooting[l] +x3_growth = (x3_array_forward_shooting[l]-x3_array_forward_shooting[l-1])/x3_array_forward_shooting[l-1]/(1*stepsize) +x3_growth +sum(x3_array_forward_shooting<0) +a1_growth = (a1_array_forward_shooting[l]-a1_array_forward_shooting[l-1])/a1_array_forward_shooting[l-1]/stepsize +a1_growth +a3_growth = (a3_array_forward_shooting[l]-a3_array_forward_shooting[l-1])/a3_array_forward_shooting[l-1]/stepsize +a3_growth +a1_array_forward_shooting[l]/x1_array_forward_shooting[l] +plot((a1_array_forward_shooting/x1_array_forward_shooting)[(l-100):l]) +# Plotting +## install.packages("tidyverse") <- Not totally necessary. +## install.packages("ggplot2") +## install.packages("ggsci") +library(ggplot2) +library(ggsci) +## General variables +saveplots=TRUE +times = times_forward_shooting +## Also for reverse shooting plots; time in reverse shooting is inverted +shootingtype="reverse"#"forward"# +shootingtype="forward"#"reverse"# +# directory = "/home/nuno/Documents/core/SRF/BackShooting/RCode/plots/temp" +directory = paste("/home/nuno/Documents/core/SRF/BackShooting/RCode/plots/satisfactory3/", shootingtype, "shooting", "/", last, "years", sep="") +directory +setwd(directory) +if(shootingtype=="forward"){ +x1_array_plotting <- x1_array_forward_shooting +x3_array_plotting <- x3_array_forward_shooting +a1_array_plotting <- a1_array_forward_shooting +a3_array_plotting <- a3_array_forward_shooting +s1_array_plotting <- s1_array_forward_shooting +s3_array_plotting <- s3_array_forward_shooting +} else if(shootingtype=="reverse"){ +x1_array_plotting <- x1_array_reverse_shooting +x3_array_plotting <- x3_array_reverse_shooting +a1_array_plotting <- a1_array_reverse_shooting +a3_array_plotting <- a3_array_reverse_shooting +s1_array_plotting <- s1_array_reverse_shooting +s3_array_plotting <- s3_array_reverse_shooting +} +height = 5 +width = floor(height*(1+sqrt(5))/2) +imagenumbercounter = 1 +saveplot = function(imagename){ +if(saveplots){ +ggsave(paste(imagenumbercounter,"_", imagename, "_",shootingtype, "shooting",".png", sep =""), units="in", width=width, height=height) +imagenumbercounter <<- imagenumbercounter+1 +## https://stackoverflow.com/questions/1236620/global-variables-in-r +} +} +options(digits=1) ## Just for display +## x1 and x3 +xs <- list() +xs$values <- c(x1_array_plotting, x3_array_plotting) +xs$var <- c(rep("x1", length(x1_array_plotting)), rep("x3", length(x3_array_plotting))) +xs$times = rep(times,2) +xs <- as.data.frame(xs) +title_text = "Evolution of state variables" +(ggplot(data = xs, aes(x = times, y= values, color = var)) + +geom_line(size = 0.5) ++ labs( +title=title_text, +#subtitle="n =303", +x="Year since start", +y="Capital and labor" +#caption="@EA Mental Health Survey" +) ++theme( +legend.title = element_blank(), +#plot.subtitle = element_text(hjust = 0.5), +plot.title = element_text(hjust = 0.5), +#axis.text.y = element_blank(), +legend.position="bottom", +legend.box="vertical" +) ++ scale_color_lancet( +breaks=c("x1", "x3"), +labels=c("Capital", "Labor") +) ++ scale_y_continuous(breaks = seq(min(x1_array_plotting), max(x1_array_plotting), length.out=5)) +) +saveplot("StateVariablesX1X3") +## x1 and x3: log plot +title_text = "Evolution of state variables" +(ggplot(data = xs, aes(x = times, y= values, color = var)) + +geom_line(size = 0.5) ++labs( +title=title_text, +subtitle="(logarithmic scale)", +#subtitle="n =303", +x="Year since start", +y="Capital and labor" +#caption="@EA Mental Health Survey" +) ++theme( +legend.title = element_blank(), +#plot.subtitle = element_text(hjust = 0.5), +plot.title = element_text(hjust = 0.5), +plot.subtitle = element_text(hjust = 0.5), +#axis.text.y = element_blank(), +legend.position="bottom", +legend.box="vertical" +) ++ scale_color_lancet( +breaks=c("x1", "x3"), +labels=c("Capital", "Labor") +) ++ scale_y_continuous(trans = 'log2') +) +saveplot("StateVariablesX1X3logplot") +## Only x3 +equis3 <- list() +equis3$values <- c(x3_array_plotting) +equis3$times = times +equis3 <- as.data.frame(equis3) +title_text = "Evolution of movement size" +(ggplot(data = equis3, aes(x = times, y= values)) ++geom_line(size = 0.5) ++labs( +title=title_text, +#subtitle="n =303", +x="Year since start", +y="Labor" +#caption="@EA Mental Health Survey" +) ++theme( +legend.title = element_blank(), +#plot.subtitle = element_text(hjust = 0.5), +plot.title = element_text(hjust = 0.5), +#axis.text.y = element_blank(), +legend.position="bottom", +legend.box="vertical" +) +##+ scale_color_lancet() +) +saveplot("StateVariableX3") +## s1, s3, s4 +sigmas <- list() +s4_array_plotting=1-s1_array_plotting-s3_array_plotting +sigmas$values <- c(s1_array_plotting, s3_array_plotting,s4_array_plotting) +sigmas$fraction <- c(rep("s1", length(s1_array_plotting)), rep("s3", length(s3_array_plotting)),rep("s4", length(s3_array_plotting))) +sigmas$times = rep(times,3) +sigmas <- as.data.frame(sigmas) +title_text = "Evolution of labor fractions" +(ggplot(data = sigmas, aes(x = times, y= values, color = fraction)) + +geom_line(size = 0.5) ++labs( +title=title_text, +#subtitle="n =303", +x="Year since start", +y="Fraction of total labor" +#caption="@EA Mental Health Survey" +) ++theme( +legend.title = element_blank(), +#plot.subtitle = element_text(hjust = 0.5), +plot.title = element_text(hjust = 0.5), +#axis.text.y = element_blank(), +legend.position="bottom", +legend.direction="vertical" +) ++ scale_color_lancet( +breaks=c("s1", "s3", "s4"), +labels=c("Direct work", "Movement building", "Money-making") +) +) +saveplot("MovementFractions") +## s1 and s3 +sigmas <- list() +sigmas$values <- c(s1_array_plotting, s3_array_plotting) +sigmas$fraction <- c(rep("s1", length(s1_array_plotting)), rep("s3", length(s3_array_plotting))) +sigmas$times = rep(times,2) +sigmas <- as.data.frame(sigmas) +title_text = "Evolution of labor fractions" +subtitle_text = "(only direct work and movement building)" +(ggplot(data = sigmas, aes(x = times, y= values, color = fraction)) + +geom_line(size = 0.5) ++labs( +title=title_text, +subtitle=subtitle_text, +x="Year since start", +y="Fraction of total labor" +#caption="@EA Mental Health Survey" +) ++theme( +legend.title = element_blank(), +plot.subtitle = element_text(hjust = 0.5), +plot.title = element_text(hjust = 0.5), +#axis.text.y = element_blank(), +legend.position="bottom", +legend.direction="vertical" +) ++ scale_color_lancet( +breaks=c("s1", "s3"), +labels=c("Direct work", "Movement building") +) +) +saveplot("MovementFractionsS1S3") +## Just direct work. +sigma1 <- list() +sigma1$values <- c(s1_array_plotting) +sigma1$times = times +sigma1 <- as.data.frame(sigma1) +title_text = "Evolution of direct work \nas a fraction of total labor" +(ggplot(data = sigma1, aes(x = times, y= values)) ++geom_line(size = 0.5) ++labs( +title=title_text, +#subtitle="n =303", +x="Year since start", +y="Fraction of total labor" +#caption="@EA Mental Health Survey" +) ++theme( +legend.title = element_blank(), +#plot.subtitle = element_text(hjust = 0.5), +plot.title = element_text(hjust = 0.5), +#axis.text.y = element_blank(), +legend.position="bottom", +legend.box="vertical" +) +##+ scale_color_lancet() +) +saveplot("MovementFractionsS1") +## Just movement building +sigma3 <- list() +sigma3$values <- c(s3_array_plotting) +sigma3$times = times +sigma3 <- as.data.frame(sigma3) +title_text = "Evolution of movement building\nas a fraction of total labor" +(ggplot(data = sigma3, aes(x = times, y= values)) ++geom_line(size = 0.5) ++labs( +title=title_text, +#subtitle="n =303", +x="Year since start", +y="Fraction of labor" +#caption="@EA Mental Health Survey" +) ++theme( +legend.title = element_blank(), +#plot.subtitle = element_text(hjust = 0.5), +plot.title = element_text(hjust = 0.5), +#axis.text.y = element_blank(), +legend.position="bottom", +legend.box="vertical" +) +##+ scale_color_lancet() +) +saveplot("MovementFractionsS3") +## Just direct work - logplot +sigma1 <- list() +sigma1$values <- c(s1_array_plotting) +sigma1$times = times +sigma1 <- as.data.frame(sigma1) +title_text = "Evolution of direct work \nas a fraction of labor" +(ggplot(data = sigma1, aes(x = times, y= values)) ++geom_line(size = 0.5) ++labs( +title=title_text, +subtitle="(logarithmic scale)", +x="Year since start", +y="Fraction of labor" +#caption="@EA Mental Health Survey" +) ++theme( +legend.title = element_blank(), +plot.subtitle = element_text(hjust = 0.5), +plot.title = element_text(hjust = 0.5), +#axis.text.y = element_blank(), +legend.position="bottom", +legend.box="vertical" +) +##+ scale_color_lancet() ++ scale_y_continuous(trans = 'log2') +) +saveplot("MovementFractionsS1logplot") +## Just movement building +sigma3 <- list() +sigma3$values <- c(s3_array_plotting) +sigma3$times = times +sigma3 <- as.data.frame(sigma3) +title_text = "Evolution of movement building\nas a fraction of labor" +(ggplot(data = sigma3, aes(x = times, y= values)) ++geom_line(size = 0.5) ++labs( +title=title_text, +subtitle="(logarithmic scale)", +x="Year since start", +y="Fraction of total labor" +#caption="@EA Mental Health Survey" +) ++theme( +legend.title = element_blank(), +plot.subtitle = element_text(hjust = 0.5), +plot.title = element_text(hjust = 0.5), +#axis.text.y = element_blank(), +legend.position="bottom", +legend.box="vertical" +) +##+ scale_color_lancet() ++ scale_y_continuous(trans = 'log2') +) +saveplot("MovementFractionsS3logplot") +## sigma_1*x3 and sigma3*x3, sigma_4*x3, +sigmaxs <- list() +sigmaxs$values <- c(s1_array_plotting*x3_array_plotting, s3_array_plotting*x3_array_plotting, s4_array_plotting*x3_array_plotting) +sigmaxs$fraction <- c(rep("s1x3", length(s1_array_plotting)), rep("s3x3", length(s3_array_plotting)), rep("s4x3", length(s3_array_plotting))) +sigmaxs$times = rep(times,3) +sigmaxs <- as.data.frame(sigmaxs) +title_text = "Evolution of labor\n in absolute terms" +(ggplot(data = sigmaxs, aes(x = times, y= values, color = fraction)) + +geom_line(size = 0.5) ++labs( +title=title_text, +#subtitle="n =303", +x="Year since start", +y="Absolute number\nof movement participants" +#caption="@EA Mental Health Survey" +) ++theme( +legend.title = element_blank(), +#plot.subtitle = element_text(hjust = 0.5), +plot.title = element_text(hjust = 0.5), +#axis.text.y = element_blank(), +legend.position="bottom", +legend.direction="vertical" +) ++ scale_color_lancet( +breaks=c("s1x3", "s3x3", "s4x3"), +labels=c("Direct work", "Movement building", "Money-making") +) +) +saveplot("MovementParticipantNumbersS1S3S4") +## sigma_1*x3 and sigma3*x3 +sigmaxs <- list() +sigmaxs$values <- c(s1_array_plotting*x3_array_plotting, s3_array_plotting*x3_array_plotting) +sigmaxs$fraction <- c(rep("s1x3", length(s1_array_plotting)), rep("s3x3", length(s3_array_plotting))) +sigmaxs$times = rep(times,2) +sigmaxs <- as.data.frame(sigmaxs) +title_text = "Evolution of movement participants\nin absolute terms" +(ggplot(data = sigmaxs, aes(x = times, y= values, color = fraction)) + +geom_line(size = 0.5) ++labs( +title=title_text, +subtitle="(only direct workers and movement builders)", +x="Year since start", +y="Absolute number\nof movement participants" +#caption="@EA Mental Health Survey" +) ++theme( +legend.title = element_blank(), +#plot.subtitle = element_text(hjust = 0.5), +plot.title = element_text(hjust = 0.5), +#axis.text.y = element_blank(), +legend.position="bottom", +legend.direction="vertical" +) ++ scale_color_lancet( +breaks=c("s1x3", "s3x3"), +labels=c("Direct work", "Movement building") +) +) +saveplot("MovementParticipantNumbersS1S3") +## sigma_1*x3 and sigma3*x3 logplot +sigmaxs <- list() +sigmaxs$values <- c(s1_array_plotting*x3_array_plotting, s3_array_plotting*x3_array_plotting) +sigmaxs$fraction <- c(rep("s1x3", length(s1_array_plotting)), rep("s3x3", length(s3_array_plotting))) +sigmaxs$times = rep(times,2) +sigmaxs <- as.data.frame(sigmaxs) +title_text = "Evolution of movement participants\nin absolute terms \n(logarithmic scale)" +(ggplot(data = sigmaxs, aes(x = times, y= values, color = fraction)) + +geom_line(size = 0.5) ++labs( +title=title_text, +subtitle="(only direct workers and movement builders)", +x="Year since start", +y="Absolute number\nof movement participants" +#caption="@EA Mental Health Survey" +) ++theme( +legend.title = element_blank(), +#plot.subtitle = element_text(hjust = 0.5), +plot.title = element_text(hjust = 0.5), +#axis.text.y = element_blank(), +legend.position="bottom", +legend.direction="vertical" +) ++ scale_color_lancet( +breaks=c("s1x3", "s3x3"), +labels=c("Direct work", "Movement building") +) ++ scale_y_continuous(trans = 'log2') +) +saveplot("MovementParticipantNumbersS1S3logplot") +## alpha1 and alpha3 +alphas <- list() +alphas$values <- c(a1_array_plotting, a3_array_plotting) +alphas$fraction <- c(rep("a1", length(s1_array_plotting)), rep("a2", length(s3_array_plotting))) +alphas$times = rep(times,2) +alphas <- as.data.frame(alphas) +title_text = "Evolution of spending" +(ggplot(data = alphas, aes(x = times, y= values, color = fraction)) + +geom_line(size = 0.5) ++labs( +title=title_text, +#subtitle="n =303", +x="Year since start", +y="Spending" +#caption="@EA Mental Health Survey" +) ++theme( +legend.title = element_blank(), +#plot.subtitle = element_text(hjust = 0.5), +plot.title = element_text(hjust = 0.5), +#axis.text.y = element_blank(), +legend.position="bottom", +legend.direction="vertical" +) ++ scale_color_lancet( +breaks=c("a1", "a2"), +labels=c("Direct spending","Spending on movement building") +) +) +saveplot("SpendingA1A3") +## alpha1 and alpha3: log plot +alphas <- list() +alphas$values <- c(a1_array_plotting, a3_array_plotting) +alphas$fraction <- c(rep("a1", length(s1_array_plotting)), rep("a2", length(s3_array_plotting))) +alphas$times = rep(times,2) +alphas <- as.data.frame(alphas) +title_text = "Evolution of spending" +(ggplot(data = alphas, aes(x = times, y= values, color = fraction)) + +geom_line(size = 0.5) ++labs( +title=title_text, +subtitle="(logarithmic scale)", +x="Year since start", +y="Spending" +#caption="@EA Mental Health Survey" +) ++theme( +legend.title = element_blank(), +#plot.subtitle = element_text(hjust = 0.5), +plot.title = element_text(hjust = 0.5), +plot.subtitle = element_text(hjust = 0.5), +#axis.text.y = element_blank(), +legend.position="bottom", +legend.direction="vertical" +) ++ scale_color_lancet( +breaks=c("a1", "a2"), +labels=c("Direct spending","Spending on movement building") +) ++ scale_y_continuous(trans = 'log2') +) +saveplot("SpendingA1A3logplot") diff --git a/plots/10000years/10_MovementParticipantNumbersS1S3S4_forwardshooting.png b/plots/10000years/10_MovementParticipantNumbersS1S3S4_forwardshooting.png new file mode 100644 index 0000000..7dcd999 Binary files /dev/null and b/plots/10000years/10_MovementParticipantNumbersS1S3S4_forwardshooting.png differ diff --git a/plots/10000years/11_MovementParticipantNumbersS1S3_forwardshooting.png b/plots/10000years/11_MovementParticipantNumbersS1S3_forwardshooting.png new file mode 100644 index 0000000..c43e14f Binary files /dev/null and b/plots/10000years/11_MovementParticipantNumbersS1S3_forwardshooting.png differ diff --git a/plots/10000years/12_MovementParticipantNumbersS1S3logplot_forwardshooting.png b/plots/10000years/12_MovementParticipantNumbersS1S3logplot_forwardshooting.png new file mode 100644 index 0000000..d805f2a Binary files /dev/null and b/plots/10000years/12_MovementParticipantNumbersS1S3logplot_forwardshooting.png differ diff --git a/plots/10000years/13_SpendingA1A3_forwardshooting.png b/plots/10000years/13_SpendingA1A3_forwardshooting.png new file mode 100644 index 0000000..7d72b85 Binary files /dev/null and b/plots/10000years/13_SpendingA1A3_forwardshooting.png differ diff --git a/plots/10000years/13_SpendingA1A3logplot_forwardshooting.png b/plots/10000years/13_SpendingA1A3logplot_forwardshooting.png new file mode 100644 index 0000000..616887d Binary files /dev/null and b/plots/10000years/13_SpendingA1A3logplot_forwardshooting.png differ diff --git a/plots/10000years/1_StateVariablesX1X3_forwardshooting.png b/plots/10000years/1_StateVariablesX1X3_forwardshooting.png new file mode 100644 index 0000000..2505680 Binary files /dev/null and b/plots/10000years/1_StateVariablesX1X3_forwardshooting.png differ diff --git a/plots/10000years/2_StateVariablesX1X3logplot_forwardshooting.png b/plots/10000years/2_StateVariablesX1X3logplot_forwardshooting.png new file mode 100644 index 0000000..8b00586 Binary files /dev/null and b/plots/10000years/2_StateVariablesX1X3logplot_forwardshooting.png differ diff --git a/plots/10000years/3_StateVariableX3_forwardshooting.png b/plots/10000years/3_StateVariableX3_forwardshooting.png new file mode 100644 index 0000000..aa64cf4 Binary files /dev/null and b/plots/10000years/3_StateVariableX3_forwardshooting.png differ diff --git a/plots/10000years/4_MovementFractions_forwardshooting.png b/plots/10000years/4_MovementFractions_forwardshooting.png new file mode 100644 index 0000000..88e9f08 Binary files /dev/null and b/plots/10000years/4_MovementFractions_forwardshooting.png differ diff --git a/plots/10000years/5_MovementFractionsS1S3_forwardshooting.png b/plots/10000years/5_MovementFractionsS1S3_forwardshooting.png new file mode 100644 index 0000000..706c3cb Binary files /dev/null and b/plots/10000years/5_MovementFractionsS1S3_forwardshooting.png differ diff --git a/plots/10000years/6_MovementFractionsS1_forwardshooting.png b/plots/10000years/6_MovementFractionsS1_forwardshooting.png new file mode 100644 index 0000000..20f76b0 Binary files /dev/null and b/plots/10000years/6_MovementFractionsS1_forwardshooting.png differ diff --git a/plots/10000years/7_MovementFractionsS3_forwardshooting.png b/plots/10000years/7_MovementFractionsS3_forwardshooting.png new file mode 100644 index 0000000..9e1388f Binary files /dev/null and b/plots/10000years/7_MovementFractionsS3_forwardshooting.png differ diff --git a/plots/10000years/8_MovementFractionsS1logplot_forwardshooting.png b/plots/10000years/8_MovementFractionsS1logplot_forwardshooting.png new file mode 100644 index 0000000..eed4671 Binary files /dev/null and b/plots/10000years/8_MovementFractionsS1logplot_forwardshooting.png differ diff --git a/plots/10000years/9_MovementFractionsS3logplot_forwardshooting.png b/plots/10000years/9_MovementFractionsS3logplot_forwardshooting.png new file mode 100644 index 0000000..f1e462e Binary files /dev/null and b/plots/10000years/9_MovementFractionsS3logplot_forwardshooting.png differ diff --git a/plots/1000years/.Rhistory b/plots/1000years/.Rhistory new file mode 100644 index 0000000..59a58ec --- /dev/null +++ b/plots/1000years/.Rhistory @@ -0,0 +1,512 @@ +sum(x1_array_forward_shooting<0) +x3_array_forward_shooting[l] +x3_growth = (x3_array_forward_shooting[l]-x3_array_forward_shooting[l-1])/x3_array_forward_shooting[l-1]/(1*stepsize) +x3_growth +sum(x3_array_forward_shooting<0) +a1_growth = (a1_array_forward_shooting[l]-a1_array_forward_shooting[l-1])/a1_array_forward_shooting[l-1]/stepsize +a1_growth +a3_growth = (a3_array_forward_shooting[l]-a3_array_forward_shooting[l-1])/a3_array_forward_shooting[l-1]/stepsize +a3_growth +a1_array_forward_shooting[l]/x1_array_forward_shooting[l] +plot((a1_array_forward_shooting/x1_array_forward_shooting)[(l-100):l]) +# Forward shooting +options(digits=7) +## Evolution +x1_array_forward_shooting <- c() +x3_array_forward_shooting <- c() +a1_array_forward_shooting <- c() +a3_array_forward_shooting <- c() +s1_array_forward_shooting <- c() +s3_array_forward_shooting <- c() +x1_t = x1_init +x3_t = x3_init +#stepsize +comienzo = Sys.time() +max = max(times_forward_shooting) +for(t in times_forward_shooting){ +if((100*t/max) %in% seq(from=0, to=100, by=1)){ +cat(paste(floor(100*t/max), "%", sep="")) +cat("\n") +} +a1_t = a1(t) +a3_t = a3(t) +s1_t = s1(t) +s3_t = s3(t) +x1_t = x1_t*(1+r1_stepsize) + dx1(t)*stepsize +x3_t = x3_t*(1+r3_stepsize) + dx3(t)*stepsize +a1_array_forward_shooting <- c(a1_array_forward_shooting, a1_t) +a3_array_forward_shooting <- c(a3_array_forward_shooting, a3_t) +s1_array_forward_shooting <- c(s1_array_forward_shooting, s1_t) +s3_array_forward_shooting <- c(s3_array_forward_shooting, s3_t) +x1_array_forward_shooting <- c(x1_array_forward_shooting, x1_t) +x3_array_forward_shooting <- c(x3_array_forward_shooting, x3_t) +} +# Variables +η = 0.9 ## 1.1 +ρ = 0.005 +r_1 = 0.06 +r_3 = -0.05 +γ_1 = 0.03 +γ_3 = 0.01 +w_3 = 5000 ## Mean on the EA Survey 2018: ~7000 +β_3 = 1 ## 1 ## 0.5 Corresponds to roughly 5 people convincing 10 other people per year on a 50k year budget +## Dramatic if beta = 0.5, w_3 = 1000 +λ_1 = 0.5 +λ_3 = 0.5 +δ_3 = 0.44 +## k1_forward_shooting +k1_forward_shooting = 3*10^(-7) ## 1*10^(-7) fails. 2*10^(-7) fails +k1_reverse_shooting = k1_forward_shooting +## Artfully guessed, such that s1 < 1 +stepsize = 0.1 +## stepsize = 0.1 => seconds (7s). +## stepsize = 0.01 => minutes (3 mins). +r1_stepsize = ((1+r_1)^stepsize)-1 +r3_stepsize = ((1+r_3)^stepsize)-1 +first = 0 +last = 1000 +times_forward_shooting = seq(from=first, to=last, by=stepsize) +times_reverse_shooting = seq(from=last, to=first, by=-stepsize) +### Initial conditions. Correspond to "year 0". +x1_init = 10^10 ## 1 billion? 15 billion? 100 billion? Too much? +x3_init = 10^5 +# Forward shooting +options(digits=7) +## Evolution +x1_array_forward_shooting <- c() +x3_array_forward_shooting <- c() +a1_array_forward_shooting <- c() +a3_array_forward_shooting <- c() +s1_array_forward_shooting <- c() +s3_array_forward_shooting <- c() +x1_t = x1_init +x3_t = x3_init +#stepsize +comienzo = Sys.time() +max = max(times_forward_shooting) +for(t in times_forward_shooting){ +if((100*t/max) %in% seq(from=0, to=100, by=1)){ +cat(paste(floor(100*t/max), "%", sep="")) +cat("\n") +} +a1_t = a1(t) +a3_t = a3(t) +s1_t = s1(t) +s3_t = s3(t) +x1_t = x1_t*(1+r1_stepsize) + dx1(t)*stepsize +x3_t = x3_t*(1+r3_stepsize) + dx3(t)*stepsize +a1_array_forward_shooting <- c(a1_array_forward_shooting, a1_t) +a3_array_forward_shooting <- c(a3_array_forward_shooting, a3_t) +s1_array_forward_shooting <- c(s1_array_forward_shooting, s1_t) +s3_array_forward_shooting <- c(s3_array_forward_shooting, s3_t) +x1_array_forward_shooting <- c(x1_array_forward_shooting, x1_t) +x3_array_forward_shooting <- c(x3_array_forward_shooting, x3_t) +} +fin = Sys.time() +fin-comienzo +## Checking condition +options(digits=22) +l = length(times_forward_shooting) +x1_array_forward_shooting[l] +x1_growth = (x1_array_forward_shooting[l]-x1_array_forward_shooting[l-1])/x1_array_forward_shooting[l-1]/(1*stepsize) +x1_growth +sum(x1_array_forward_shooting<0) +x3_array_forward_shooting[l] +x3_growth = (x3_array_forward_shooting[l]-x3_array_forward_shooting[l-1])/x3_array_forward_shooting[l-1]/(1*stepsize) +x3_growth +sum(x3_array_forward_shooting<0) +a1_growth = (a1_array_forward_shooting[l]-a1_array_forward_shooting[l-1])/a1_array_forward_shooting[l-1]/stepsize +a1_growth +a3_growth = (a3_array_forward_shooting[l]-a3_array_forward_shooting[l-1])/a3_array_forward_shooting[l-1]/stepsize +a3_growth +a1_array_forward_shooting[l]/x1_array_forward_shooting[l] +plot((a1_array_forward_shooting/x1_array_forward_shooting)[(l-100):l]) +# Plotting +## install.packages("tidyverse") <- Not totally necessary. +## install.packages("ggplot2") +## install.packages("ggsci") +library(ggplot2) +library(ggsci) +## General variables +saveplots=TRUE +times = times_forward_shooting +## Also for reverse shooting plots; time in reverse shooting is inverted +shootingtype="reverse"#"forward"# +shootingtype="forward"#"reverse"# +directory = paste("/home/nuno/Documents/core/SRF/BackShooting/RCode/plots/satisfactory3/", shootingtype, "shooting", "/", last, "years", sep="") +directory +setwd(directory) +if(shootingtype=="forward"){ +x1_array_plotting <- x1_array_forward_shooting +x3_array_plotting <- x3_array_forward_shooting +a1_array_plotting <- a1_array_forward_shooting +a3_array_plotting <- a3_array_forward_shooting +s1_array_plotting <- s1_array_forward_shooting +s3_array_plotting <- s3_array_forward_shooting +} else if(shootingtype=="reverse"){ +x1_array_plotting <- x1_array_reverse_shooting +x3_array_plotting <- x3_array_reverse_shooting +a1_array_plotting <- a1_array_reverse_shooting +a3_array_plotting <- a3_array_reverse_shooting +s1_array_plotting <- s1_array_reverse_shooting +s3_array_plotting <- s3_array_reverse_shooting +} +height = 5 +width = floor(height*(1+sqrt(5))/2) +imagenumbercounter = 1 +saveplot = function(imagename){ +if(saveplots){ +ggsave(paste(imagenumbercounter,"_", imagename, "_",shootingtype, "shooting",".png", sep =""), units="in", width=width, height=height) +imagenumbercounter <<- imagenumbercounter+1 +## https://stackoverflow.com/questions/1236620/global-variables-in-r +} +} +options(digits=1) ## Just for display +xs <- list() +xs$values <- c(x1_array_plotting, x3_array_plotting) +xs$var <- c(rep("x1", length(x1_array_plotting)), rep("x3", length(x3_array_plotting))) +xs$times = rep(times,2) +xs <- as.data.frame(xs) +title_text = "Evolution of state variables" +(ggplot(data = xs, aes(x = times, y= values, color = var)) + +geom_line(size = 0.5) ++ labs( +title=title_text, +#subtitle="n =303", +x="Year since start", +y="Capital and labor" +#caption="@EA Mental Health Survey" +) ++theme( +legend.title = element_blank(), +#plot.subtitle = element_text(hjust = 0.5), +plot.title = element_text(hjust = 0.5), +#axis.text.y = element_blank(), +legend.position="bottom", +legend.box="vertical" +) ++ scale_color_lancet( +breaks=c("x1", "x3"), +labels=c("Capital", "Labor") +) ++ scale_y_continuous(breaks = seq(min(x1_array_plotting), max(x1_array_plotting), length.out=5)) +) +## x1 and x3: log plot +title_text = "Evolution of state variables" +(ggplot(data = xs, aes(x = times, y= values, color = var)) + +geom_line(size = 0.5) ++labs( +title=title_text, +subtitle="(logarithmic scale)", +#subtitle="n =303", +x="Year since start", +y="Capital and labor" +#caption="@EA Mental Health Survey" +) ++theme( +legend.title = element_blank(), +#plot.subtitle = element_text(hjust = 0.5), +plot.title = element_text(hjust = 0.5), +plot.subtitle = element_text(hjust = 0.5), +#axis.text.y = element_blank(), +legend.position="bottom", +legend.box="vertical" +) ++ scale_color_lancet( +breaks=c("x1", "x3"), +labels=c("Capital", "Labor") +) ++ scale_y_continuous(trans = 'log2') +) +saveplot("StateVariablesX1X3logplot") +## Only x3 +equis3 <- list() +equis3$values <- c(x3_array_plotting) +equis3$times = times +equis3 <- as.data.frame(equis3) +title_text = "Evolution of movement size" +(ggplot(data = equis3, aes(x = times, y= values)) ++geom_line(size = 0.5) ++labs( +title=title_text, +#subtitle="n =303", +x="Year since start", +y="Labor" +#caption="@EA Mental Health Survey" +) ++theme( +legend.title = element_blank(), +#plot.subtitle = element_text(hjust = 0.5), +plot.title = element_text(hjust = 0.5), +#axis.text.y = element_blank(), +legend.position="bottom", +legend.box="vertical" +) +##+ scale_color_lancet() +) +saveplot("StateVariableX3") +## s1, s3, s4 +sigmas <- list() +s4_array_plotting=1-s1_array_plotting-s3_array_plotting +sigmas$values <- c(s1_array_plotting, s3_array_plotting,s4_array_plotting) +sigmas$fraction <- c(rep("s1", length(s1_array_plotting)), rep("s3", length(s3_array_plotting)),rep("s4", length(s3_array_plotting))) +sigmas$times = rep(times,3) +sigmas <- as.data.frame(sigmas) +title_text = "Evolution of labor fractions" +(ggplot(data = sigmas, aes(x = times, y= values, color = fraction)) + +geom_line(size = 0.5) ++labs( +title=title_text, +#subtitle="n =303", +x="Year since start", +y="Fraction of total labor" +#caption="@EA Mental Health Survey" +) ++theme( +legend.title = element_blank(), +#plot.subtitle = element_text(hjust = 0.5), +plot.title = element_text(hjust = 0.5), +#axis.text.y = element_blank(), +legend.position="bottom", +legend.direction="vertical" +) ++ scale_color_lancet( +breaks=c("s1", "s3", "s4"), +labels=c("Direct work", "Movement building", "Money-making") +) +) +# Variables +η = 0.9 ## 1.1 +ρ = 0.005 +r_1 = 0.06 +r_3 = -0.02 +γ_1 = 0.03 +γ_3 = 0.01 +w_3 = 5000 ## Mean on the EA Survey 2018: ~7000 +β_3 = 1 ## 1 ## 0.5 Corresponds to roughly 5 people convincing 10 other people per year on a 50k year budget +## Dramatic if beta = 0.5, w_3 = 1000 +λ_1 = 0.5 +λ_3 = 0.5 +δ_3 = 0.44 +## k1_forward_shooting +k1_forward_shooting = 3*10^(-7) ## 1*10^(-7) fails. 2*10^(-7) fails +k1_reverse_shooting = k1_forward_shooting +## Artfully guessed, such that s1 < 1 +stepsize = 0.1 +## stepsize = 0.1 => seconds (7s). +## stepsize = 0.01 => minutes (3 mins). +r1_stepsize = ((1+r_1)^stepsize)-1 +r3_stepsize = ((1+r_3)^stepsize)-1 +first = 0 +last = 1000 +times_forward_shooting = seq(from=first, to=last, by=stepsize) +times_reverse_shooting = seq(from=last, to=first, by=-stepsize) +### Initial conditions. Correspond to "year 0". +x1_init = 10^10 ## 1 billion? 15 billion? 100 billion? Too much? +x3_init = 10^5 +# Forward shooting +options(digits=7) +## Evolution +x1_array_forward_shooting <- c() +x3_array_forward_shooting <- c() +a1_array_forward_shooting <- c() +a3_array_forward_shooting <- c() +s1_array_forward_shooting <- c() +s3_array_forward_shooting <- c() +x1_t = x1_init +x3_t = x3_init +#stepsize +comienzo = Sys.time() +max = max(times_forward_shooting) +for(t in times_forward_shooting){ +if((100*t/max) %in% seq(from=0, to=100, by=1)){ +cat(paste(floor(100*t/max), "%", sep="")) +cat("\n") +} +a1_t = a1(t) +a3_t = a3(t) +s1_t = s1(t) +s3_t = s3(t) +x1_t = x1_t*(1+r1_stepsize) + dx1(t)*stepsize +x3_t = x3_t*(1+r3_stepsize) + dx3(t)*stepsize +a1_array_forward_shooting <- c(a1_array_forward_shooting, a1_t) +a3_array_forward_shooting <- c(a3_array_forward_shooting, a3_t) +s1_array_forward_shooting <- c(s1_array_forward_shooting, s1_t) +s3_array_forward_shooting <- c(s3_array_forward_shooting, s3_t) +x1_array_forward_shooting <- c(x1_array_forward_shooting, x1_t) +x3_array_forward_shooting <- c(x3_array_forward_shooting, x3_t) +} +fin = Sys.time() +fin-comienzo +## Checking condition +options(digits=22) +l = length(times_forward_shooting) +x1_array_forward_shooting[l] +x1_growth = (x1_array_forward_shooting[l]-x1_array_forward_shooting[l-1])/x1_array_forward_shooting[l-1]/(1*stepsize) +x1_growth +sum(x1_array_forward_shooting<0) +x3_array_forward_shooting[l] +x3_growth = (x3_array_forward_shooting[l]-x3_array_forward_shooting[l-1])/x3_array_forward_shooting[l-1]/(1*stepsize) +x3_growth +sum(x3_array_forward_shooting<0) +a1_growth = (a1_array_forward_shooting[l]-a1_array_forward_shooting[l-1])/a1_array_forward_shooting[l-1]/stepsize +a1_growth +a3_growth = (a3_array_forward_shooting[l]-a3_array_forward_shooting[l-1])/a3_array_forward_shooting[l-1]/stepsize +a3_growth +a1_array_forward_shooting[l]/x1_array_forward_shooting[l] +plot((a1_array_forward_shooting/x1_array_forward_shooting)[(l-100):l]) +# Plotting +## install.packages("tidyverse") <- Not totally necessary. +## install.packages("ggplot2") +## install.packages("ggsci") +library(ggplot2) +library(ggsci) +## General variables +saveplots=TRUE +times = times_forward_shooting +## Also for reverse shooting plots; time in reverse shooting is inverted +shootingtype="reverse"#"forward"# +shootingtype="forward"#"reverse"# +directory = paste("/home/nuno/Documents/core/SRF/BackShooting/RCode/plots/satisfactory3/", shootingtype, "shooting", "/", last, "years", sep="") +directory +setwd(directory) +if(shootingtype=="forward"){ +x1_array_plotting <- x1_array_forward_shooting +x3_array_plotting <- x3_array_forward_shooting +a1_array_plotting <- a1_array_forward_shooting +a3_array_plotting <- a3_array_forward_shooting +s1_array_plotting <- s1_array_forward_shooting +s3_array_plotting <- s3_array_forward_shooting +} else if(shootingtype=="reverse"){ +x1_array_plotting <- x1_array_reverse_shooting +x3_array_plotting <- x3_array_reverse_shooting +a1_array_plotting <- a1_array_reverse_shooting +a3_array_plotting <- a3_array_reverse_shooting +s1_array_plotting <- s1_array_reverse_shooting +s3_array_plotting <- s3_array_reverse_shooting +} +height = 5 +width = floor(height*(1+sqrt(5))/2) +imagenumbercounter = 1 +saveplot = function(imagename){ +if(saveplots){ +ggsave(paste(imagenumbercounter,"_", imagename, "_",shootingtype, "shooting",".png", sep =""), units="in", width=width, height=height) +imagenumbercounter <<- imagenumbercounter+1 +## https://stackoverflow.com/questions/1236620/global-variables-in-r +} +} +options(digits=1) ## Just for display +xs <- list() +xs$values <- c(x1_array_plotting, x3_array_plotting) +xs$var <- c(rep("x1", length(x1_array_plotting)), rep("x3", length(x3_array_plotting))) +xs$times = rep(times,2) +xs <- as.data.frame(xs) +title_text = "Evolution of state variables" +(ggplot(data = xs, aes(x = times, y= values, color = var)) + +geom_line(size = 0.5) ++ labs( +title=title_text, +#subtitle="n =303", +x="Year since start", +y="Capital and labor" +#caption="@EA Mental Health Survey" +) ++theme( +legend.title = element_blank(), +#plot.subtitle = element_text(hjust = 0.5), +plot.title = element_text(hjust = 0.5), +#axis.text.y = element_blank(), +legend.position="bottom", +legend.box="vertical" +) ++ scale_color_lancet( +breaks=c("x1", "x3"), +labels=c("Capital", "Labor") +) ++ scale_y_continuous(breaks = seq(min(x1_array_plotting), max(x1_array_plotting), length.out=5)) +) +saveplot("StateVariablesX1X3") +## x1 and x3: log plot +title_text = "Evolution of state variables" +(ggplot(data = xs, aes(x = times, y= values, color = var)) + +geom_line(size = 0.5) ++labs( +title=title_text, +subtitle="(logarithmic scale)", +#subtitle="n =303", +x="Year since start", +y="Capital and labor" +#caption="@EA Mental Health Survey" +) ++theme( +legend.title = element_blank(), +#plot.subtitle = element_text(hjust = 0.5), +plot.title = element_text(hjust = 0.5), +plot.subtitle = element_text(hjust = 0.5), +#axis.text.y = element_blank(), +legend.position="bottom", +legend.box="vertical" +) ++ scale_color_lancet( +breaks=c("x1", "x3"), +labels=c("Capital", "Labor") +) ++ scale_y_continuous(trans = 'log2') +) +saveplot("StateVariablesX1X3logplot") +## Only x3 +equis3 <- list() +equis3$values <- c(x3_array_plotting) +equis3$times = times +equis3 <- as.data.frame(equis3) +title_text = "Evolution of movement size" +(ggplot(data = equis3, aes(x = times, y= values)) ++geom_line(size = 0.5) ++labs( +title=title_text, +#subtitle="n =303", +x="Year since start", +y="Labor" +#caption="@EA Mental Health Survey" +) ++theme( +legend.title = element_blank(), +#plot.subtitle = element_text(hjust = 0.5), +plot.title = element_text(hjust = 0.5), +#axis.text.y = element_blank(), +legend.position="bottom", +legend.box="vertical" +) +##+ scale_color_lancet() +) +saveplot("StateVariableX3") +## s1, s3, s4 +sigmas <- list() +s4_array_plotting=1-s1_array_plotting-s3_array_plotting +sigmas$values <- c(s1_array_plotting, s3_array_plotting,s4_array_plotting) +sigmas$fraction <- c(rep("s1", length(s1_array_plotting)), rep("s3", length(s3_array_plotting)),rep("s4", length(s3_array_plotting))) +sigmas$times = rep(times,3) +sigmas <- as.data.frame(sigmas) +title_text = "Evolution of labor fractions" +(ggplot(data = sigmas, aes(x = times, y= values, color = fraction)) + +geom_line(size = 0.5) ++labs( +title=title_text, +#subtitle="n =303", +x="Year since start", +y="Fraction of total labor" +#caption="@EA Mental Health Survey" +) ++theme( +legend.title = element_blank(), +#plot.subtitle = element_text(hjust = 0.5), +plot.title = element_text(hjust = 0.5), +#axis.text.y = element_blank(), +legend.position="bottom", +legend.direction="vertical" +) ++ scale_color_lancet( +breaks=c("s1", "s3", "s4"), +labels=c("Direct work", "Movement building", "Money-making") +) +) diff --git a/plots/1000years/10_MovementParticipantNumbersS1S3S4_forwardshooting.png b/plots/1000years/10_MovementParticipantNumbersS1S3S4_forwardshooting.png new file mode 100644 index 0000000..6dd1f08 Binary files /dev/null and b/plots/1000years/10_MovementParticipantNumbersS1S3S4_forwardshooting.png differ diff --git a/plots/1000years/10_MovementParticipantNumbersS1S3_forwardshooting.png b/plots/1000years/10_MovementParticipantNumbersS1S3_forwardshooting.png new file mode 100644 index 0000000..5a05e70 Binary files /dev/null and b/plots/1000years/10_MovementParticipantNumbersS1S3_forwardshooting.png differ diff --git a/plots/1000years/11_MovementParticipantNumbersS1S3_forwardshooting.png b/plots/1000years/11_MovementParticipantNumbersS1S3_forwardshooting.png new file mode 100644 index 0000000..eb0f384 Binary files /dev/null and b/plots/1000years/11_MovementParticipantNumbersS1S3_forwardshooting.png differ diff --git a/plots/1000years/11_MovementParticipantNumbersS1S3logplot_forwardshooting.png b/plots/1000years/11_MovementParticipantNumbersS1S3logplot_forwardshooting.png new file mode 100644 index 0000000..914f4c5 Binary files /dev/null and b/plots/1000years/11_MovementParticipantNumbersS1S3logplot_forwardshooting.png differ diff --git a/plots/1000years/12_MovementParticipantNumbersS1S3logplot_forwardshooting.png b/plots/1000years/12_MovementParticipantNumbersS1S3logplot_forwardshooting.png new file mode 100644 index 0000000..0cf1a1c Binary files /dev/null and b/plots/1000years/12_MovementParticipantNumbersS1S3logplot_forwardshooting.png differ diff --git a/plots/1000years/12_SpendingA1A3_forwardshooting.png b/plots/1000years/12_SpendingA1A3_forwardshooting.png new file mode 100644 index 0000000..b156d7d Binary files /dev/null and b/plots/1000years/12_SpendingA1A3_forwardshooting.png differ diff --git a/plots/1000years/13_SpendingA1A3_forwardshooting.png b/plots/1000years/13_SpendingA1A3_forwardshooting.png new file mode 100644 index 0000000..7bcf22b Binary files /dev/null and b/plots/1000years/13_SpendingA1A3_forwardshooting.png differ diff --git a/plots/1000years/13_SpendingA1A3logplot_forwardshooting.png b/plots/1000years/13_SpendingA1A3logplot_forwardshooting.png new file mode 100644 index 0000000..a00f410 Binary files /dev/null and b/plots/1000years/13_SpendingA1A3logplot_forwardshooting.png differ diff --git a/plots/1000years/14_SpendingA1A3logplot_forwardshooting.png b/plots/1000years/14_SpendingA1A3logplot_forwardshooting.png new file mode 100644 index 0000000..00f7425 Binary files /dev/null and b/plots/1000years/14_SpendingA1A3logplot_forwardshooting.png differ diff --git a/plots/1000years/1_StateVariablesX1X3_forwardshooting.png b/plots/1000years/1_StateVariablesX1X3_forwardshooting.png new file mode 100644 index 0000000..ac34937 Binary files /dev/null and b/plots/1000years/1_StateVariablesX1X3_forwardshooting.png differ diff --git a/plots/1000years/1_StateVariablesX1X3logplot_forwardshooting.png b/plots/1000years/1_StateVariablesX1X3logplot_forwardshooting.png new file mode 100644 index 0000000..6b4f6b6 Binary files /dev/null and b/plots/1000years/1_StateVariablesX1X3logplot_forwardshooting.png differ diff --git a/plots/1000years/2_StateVariableX3_forwardshooting.png b/plots/1000years/2_StateVariableX3_forwardshooting.png new file mode 100644 index 0000000..a3e112a Binary files /dev/null and b/plots/1000years/2_StateVariableX3_forwardshooting.png differ diff --git a/plots/1000years/2_StateVariablesX1X3logplot_forwardshooting.png b/plots/1000years/2_StateVariablesX1X3logplot_forwardshooting.png new file mode 100644 index 0000000..99f81a8 Binary files /dev/null and b/plots/1000years/2_StateVariablesX1X3logplot_forwardshooting.png differ diff --git a/plots/1000years/3_MovementFractions_forwardshooting.png b/plots/1000years/3_MovementFractions_forwardshooting.png new file mode 100644 index 0000000..780f051 Binary files /dev/null and b/plots/1000years/3_MovementFractions_forwardshooting.png differ diff --git a/plots/1000years/3_StateVariableX3_forwardshooting.png b/plots/1000years/3_StateVariableX3_forwardshooting.png new file mode 100644 index 0000000..431a1ee Binary files /dev/null and b/plots/1000years/3_StateVariableX3_forwardshooting.png differ diff --git a/plots/1000years/4_MovementFractionsS1S3_forwardshooting.png b/plots/1000years/4_MovementFractionsS1S3_forwardshooting.png new file mode 100644 index 0000000..06a5273 Binary files /dev/null and b/plots/1000years/4_MovementFractionsS1S3_forwardshooting.png differ diff --git a/plots/1000years/4_MovementFractions_forwardshooting.png b/plots/1000years/4_MovementFractions_forwardshooting.png new file mode 100644 index 0000000..bc90f59 Binary files /dev/null and b/plots/1000years/4_MovementFractions_forwardshooting.png differ diff --git a/plots/1000years/5_MovementFractionsS1S3_forwardshooting.png b/plots/1000years/5_MovementFractionsS1S3_forwardshooting.png new file mode 100644 index 0000000..9ffeaca Binary files /dev/null and b/plots/1000years/5_MovementFractionsS1S3_forwardshooting.png differ diff --git a/plots/1000years/5_MovementFractionsS1_forwardshooting.png b/plots/1000years/5_MovementFractionsS1_forwardshooting.png new file mode 100644 index 0000000..a935016 Binary files /dev/null and b/plots/1000years/5_MovementFractionsS1_forwardshooting.png differ diff --git a/plots/1000years/6_MovementFractionsS1_forwardshooting.png b/plots/1000years/6_MovementFractionsS1_forwardshooting.png new file mode 100644 index 0000000..7f493a9 Binary files /dev/null and b/plots/1000years/6_MovementFractionsS1_forwardshooting.png differ diff --git a/plots/1000years/6_MovementFractionsS3_forwardshooting.png b/plots/1000years/6_MovementFractionsS3_forwardshooting.png new file mode 100644 index 0000000..2790733 Binary files /dev/null and b/plots/1000years/6_MovementFractionsS3_forwardshooting.png differ diff --git a/plots/1000years/7_MovementFractionsS1logplot_forwardshooting.png b/plots/1000years/7_MovementFractionsS1logplot_forwardshooting.png new file mode 100644 index 0000000..7201f8a Binary files /dev/null and b/plots/1000years/7_MovementFractionsS1logplot_forwardshooting.png differ diff --git a/plots/1000years/7_MovementFractionsS3_forwardshooting.png b/plots/1000years/7_MovementFractionsS3_forwardshooting.png new file mode 100644 index 0000000..e476031 Binary files /dev/null and b/plots/1000years/7_MovementFractionsS3_forwardshooting.png differ diff --git a/plots/1000years/8_MovementFractionsS1logplot_forwardshooting.png b/plots/1000years/8_MovementFractionsS1logplot_forwardshooting.png new file mode 100644 index 0000000..e67f897 Binary files /dev/null and b/plots/1000years/8_MovementFractionsS1logplot_forwardshooting.png differ diff --git a/plots/1000years/8_MovementFractionsS3logplot_forwardshooting.png b/plots/1000years/8_MovementFractionsS3logplot_forwardshooting.png new file mode 100644 index 0000000..8813908 Binary files /dev/null and b/plots/1000years/8_MovementFractionsS3logplot_forwardshooting.png differ diff --git a/plots/1000years/9_MovementFractionsS3logplot_forwardshooting.png b/plots/1000years/9_MovementFractionsS3logplot_forwardshooting.png new file mode 100644 index 0000000..42bfc22 Binary files /dev/null and b/plots/1000years/9_MovementFractionsS3logplot_forwardshooting.png differ diff --git a/plots/1000years/9_MovementParticipantNumbersS1S3S4_forwardshooting.png b/plots/1000years/9_MovementParticipantNumbersS1S3S4_forwardshooting.png new file mode 100644 index 0000000..6de4a68 Binary files /dev/null and b/plots/1000years/9_MovementParticipantNumbersS1S3S4_forwardshooting.png differ diff --git a/plots/100years/10_MovementParticipantNumbersS1S3S4_forwardshooting.png b/plots/100years/10_MovementParticipantNumbersS1S3S4_forwardshooting.png new file mode 100644 index 0000000..4f9b93a Binary files /dev/null and b/plots/100years/10_MovementParticipantNumbersS1S3S4_forwardshooting.png differ diff --git a/plots/100years/11_MovementParticipantNumbersS1S3_forwardshooting.png b/plots/100years/11_MovementParticipantNumbersS1S3_forwardshooting.png new file mode 100644 index 0000000..cca66ee Binary files /dev/null and b/plots/100years/11_MovementParticipantNumbersS1S3_forwardshooting.png differ diff --git a/plots/100years/12_MovementParticipantNumbersS1S3logplot_forwardshooting.png b/plots/100years/12_MovementParticipantNumbersS1S3logplot_forwardshooting.png new file mode 100644 index 0000000..33d4905 Binary files /dev/null and b/plots/100years/12_MovementParticipantNumbersS1S3logplot_forwardshooting.png differ diff --git a/plots/100years/13_SpendingA1A3_forwardshooting.png b/plots/100years/13_SpendingA1A3_forwardshooting.png new file mode 100644 index 0000000..62efda1 Binary files /dev/null and b/plots/100years/13_SpendingA1A3_forwardshooting.png differ diff --git a/plots/100years/14_SpendingA1A3logplot_forwardshooting.png b/plots/100years/14_SpendingA1A3logplot_forwardshooting.png new file mode 100644 index 0000000..341ad06 Binary files /dev/null and b/plots/100years/14_SpendingA1A3logplot_forwardshooting.png differ diff --git a/plots/100years/1_StateVariablesX1X3_forwardshooting.png b/plots/100years/1_StateVariablesX1X3_forwardshooting.png new file mode 100644 index 0000000..16a0171 Binary files /dev/null and b/plots/100years/1_StateVariablesX1X3_forwardshooting.png differ diff --git a/plots/100years/2_StateVariablesX1X3logplot_forwardshooting.png b/plots/100years/2_StateVariablesX1X3logplot_forwardshooting.png new file mode 100644 index 0000000..fdce762 Binary files /dev/null and b/plots/100years/2_StateVariablesX1X3logplot_forwardshooting.png differ diff --git a/plots/100years/3_StateVariableX3_forwardshooting.png b/plots/100years/3_StateVariableX3_forwardshooting.png new file mode 100644 index 0000000..949395e Binary files /dev/null and b/plots/100years/3_StateVariableX3_forwardshooting.png differ diff --git a/plots/100years/4_MovementFractions_forwardshooting.png b/plots/100years/4_MovementFractions_forwardshooting.png new file mode 100644 index 0000000..0c1e448 Binary files /dev/null and b/plots/100years/4_MovementFractions_forwardshooting.png differ diff --git a/plots/100years/5_MovementFractionsS1S3_forwardshooting.png b/plots/100years/5_MovementFractionsS1S3_forwardshooting.png new file mode 100644 index 0000000..71dbd1a Binary files /dev/null and b/plots/100years/5_MovementFractionsS1S3_forwardshooting.png differ diff --git a/plots/100years/6_MovementFractionsS1_forwardshooting.png b/plots/100years/6_MovementFractionsS1_forwardshooting.png new file mode 100644 index 0000000..d4c559d Binary files /dev/null and b/plots/100years/6_MovementFractionsS1_forwardshooting.png differ diff --git a/plots/100years/7_MovementFractionsS3_forwardshooting.png b/plots/100years/7_MovementFractionsS3_forwardshooting.png new file mode 100644 index 0000000..d9894b8 Binary files /dev/null and b/plots/100years/7_MovementFractionsS3_forwardshooting.png differ diff --git a/plots/100years/8_MovementFractionsS1logplot_forwardshooting.png b/plots/100years/8_MovementFractionsS1logplot_forwardshooting.png new file mode 100644 index 0000000..086c863 Binary files /dev/null and b/plots/100years/8_MovementFractionsS1logplot_forwardshooting.png differ diff --git a/plots/100years/9_MovementFractionsS3logplot_forwardshooting.png b/plots/100years/9_MovementFractionsS3logplot_forwardshooting.png new file mode 100644 index 0000000..8c9d8b1 Binary files /dev/null and b/plots/100years/9_MovementFractionsS3logplot_forwardshooting.png differ