Advertisement
Guest User

Untitled

a guest
Jan 1st, 2021
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 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(30:90, n, replace = TRUE))/100
  17. #capconratio<-sort(capconratio, decreasing = FALSE)
  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[5])
  45. ysamp<-(timescale["C",5])
  46. yminmax<-c(timescale["C",2:n],timescale["Investment",2:n] )
  47. plot(time[2:n], timescale["R",2:n], type = "l", xlab = "Time", ylab = "Rate of Profit")
  48. lines(time[2:n], exp[2:n], col = "blue" )
  49. legend(x=xsamp,y=timescale["R",5],c("Rate of Profit","Rate of Exploitation"),cex=.8,col=c("black","blue"),pch=c(1,2))
  50. plot(time[2:n], timescale["C",2:n], type = "l", col ="red", xlab = "time",
  51. ylim = c(min(yminmax), max(yminmax)), ylab = "Investment and Constant Capital")
  52. lines(time[2:n], timescale["Investment",2:n], col = "blue")
  53. legend(x=xsamp,y=ysamp,c("Constant Capital","Investment"),cex=.8,col=c("red","blue"),pch=c(1,2))
  54. ratio<-timescale["Investment",]/(timescale["C",])
  55. ratio1<-ratio[2:n]
  56. plot(ratio1, type = "l", xlab = "time", ylab = "Ratio of Constant Capital and Investment")
  57. OOC<-timescale["C",]/(timescale["V",])
  58. OOC2<-OOC[2:n]
  59. plot(OOC2, type = "l", xlab = "time", ylab = "Organic Capital Composition")
  60. head(timescale)
  61. timescale["S", n]/(timescale["V", n]+timescale["S", n])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement