Advertisement
Guest User

Untitled

a guest
Jan 1st, 2021
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. d<-5
  2. ##depreciation timeline
  3. n<-100
  4. ##number of iterations
  5. time<-c(1:n)
  6. timescale <- matrix(nrow=6, ncol = n)
  7. timex <- matrix(nrow=1, ncol = n)
  8. timex<-c(sample(100, n, replace = TRUE))
  9. row.names(timescale)<-c("S", "V", "C", "Investment", "Capitalist Consumption", "R")
  10. timescale["S",1]<-30
  11. timescale["V",1]<-65
  12. timescale["C",1]<-5
  13. total<-sum(timescale["S",1], timescale["V",1], timescale["C",1] )
  14.  
  15. #capconratio[1:n]<-.5
  16. capconratio<-(sample(0:80, n, replace = TRUE))/100
  17. capconratio<-sort(capconratio, decreasing = TRUE)
  18. ##amount of surplus consumed by capitalists
  19.  
  20. timescale["Capitalist Consumption", 1]<-timescale["S",1]*capconratio[1]
  21. timescale["Investment",1]<-timescale["S",1]-timescale["Capitalist Consumption", 1]
  22. cstock<-timescale["C",1]*(d)
  23. ##stock of capital
  24. timescale["R", 1]<-timescale["S",1]/(timescale["V",1]+timescale["C",1])
  25.  
  26. exp[1:n]<-.3
  27. #exp<-(sample(20:30, n, replace = TRUE))/100
  28. #exp<-sort(exp, decreasing = TRUE)
  29. #rate of exploitation
  30. t<-2
  31. while (t<=n)
  32. {
  33.  
  34. timescale["C", t]<-round(cstock/d, digits =3);
  35. timescale["S", t]<-round((total-timescale["C", (t)])*((exp[t])), digits = 3);
  36. timescale["V", t]<-round((total-timescale["C", (t)])*(1-(exp[t])), digits = 3);
  37. timescale["Capitalist Consumption", t]<-round(timescale["S",t]*capconratio[t], digits =3);
  38. timescale["Investment",t]<-round(timescale["S",t]-timescale["Capitalist Consumption", t], digits = 3);
  39. timescale["R", t]<- round(timescale["S",t]/(timescale["V",t]+timescale["C",t]), digits = 3);
  40. cstock<-round(cstock+timescale["Investment",t]-timescale["C", t], digits = 3);
  41. t<-t+1
  42. }
  43.  
  44. xsamp<-(time[20])
  45. ysamp<-(timescale["C",20])
  46. yminmax<-c(timescale["C",2:n],timescale["Investment",2:n] )
  47. yminmax2<-c(timescale["R",2:n],exp[2:n])
  48. plot(time[2:n], timescale["R",2:n], type = "l", xlab = "Time", ylab = "Rate of Profit",
  49. ylim = c(min(yminmax2), max(yminmax2)))
  50. lines(time[2:n], exp[2:n], col = "blue" )
  51. legend(x=xsamp,y=timescale["R",5],c("Rate of Profit","Rate of Exploitation"),
  52. cex=.8,col=c("black","blue"),pch=c(1,2))
  53. plot(time[2:n], timescale["C",2:n], type = "l", col ="red", xlab = "time",
  54. ylim = c(min(yminmax), max(yminmax)), ylab = "Investment and Constant Capital")
  55. lines(time[2:n], timescale["Investment",2:n], col = "blue")
  56. legend(x=xsamp,y=ysamp,c("Constant Capital","Investment"),cex=.8,col=c("red","blue"),pch=c(1,2))
  57. ratio<-timescale["Investment",]/(timescale["C",])
  58. ratio1<-ratio[2:n]
  59. plot(ratio1, type = "l", xlab = "time", ylab = "Ratio of Constant Capital and Investment")
  60. OOC<-timescale["C",]/(timescale["V",])
  61. OOC2<-OOC[2:n]
  62. plot(OOC2, type = "l", xlab = "time", ylab = "Organic Capital Composition")
  63. head(timescale)
  64. timescale["S", n]/(timescale["V", n]+timescale["S", n])
  65.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement