Advertisement
Guest User

Bitcoin price trend

a guest
Dec 4th, 2013
1,321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 1.37 KB | None | 0 0
  1. png(width=1200, height=800)
  2. par(las=2)
  3.  
  4. prices <- c(
  5.       0.005,   0.005,   0.005,   0.005,   0.005,   0.005,
  6.       0.005,   0.005,   0.005,   0.005,   0.005,   0.005,
  7.       0.005,   0.005,   0.005,   0.005,   0.005,   0.008,
  8.       0.06,    0.065,   0.062,   0.106,   0.27,    0.24,
  9.       0.39,    0.90,    0.85,    1.50,    6.38,   18.55,
  10.      14.10,    9.75,    5.76,    3.30,    2.60,    3.51,
  11.       6.11,    5.06,    4.88,    4.98,    5.06,    6.03,
  12.       8.04,   10.88,   11.46,   11.58,   11.51,   13.33,
  13.      16.31,   25.93,   58.14,  115.09,  112.81,  108.39,
  14.      83.80,  105.80,  124.33,  156.50,  517.00
  15. )
  16. months <- 1:length(prices)
  17. result <- lm(log10(prices) ~ months)
  18. a <- coef(result)[2]
  19. b <- coef(result)[1]
  20.  
  21. plot(months, prices, type='n', log='y', xaxt='n', yaxt='n',
  22.      xlim=c(0,70), ylim=c(0.005,10000),
  23.      main=sprintf("Bitcoin price trend (y = %f * x - %f)", a, abs(b)),
  24.      xlab="", ylab="Typical price in USD")
  25.  
  26. years = 2009 + 0:5
  27. dates = ISOdate(rep(years, rep(4, length(years))),
  28.                 rep(0:3 * 3 + 1, length(years)), 1)
  29.  
  30. axis(1, 1:length(dates) * 3 - 2, labels=format(dates, '%b %y'))
  31. axis(2, 10^(-1:4), 10^(-1:4))
  32.  
  33. abline(h=c(1:9 / 100, 1:9 / 10, 1:9, 1:9*10, 1:9 * 100, 1:10 * 1000),
  34.        col="lightgrey")
  35.  
  36. abline(v=1:100, col="lightgrey")
  37.  
  38. abline(result, col="red")
  39. lines(months, prices, type="o")
  40. box()
  41.  
  42. dev.off()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement