View difference between Paste ID: 1wFgtA79 and peG2wg5p
SHOW: | | - or go back to the newest paste.
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
14+
     83.80,  105.80,  124.33,  156.50,  517.00,  799.00,
15
    818.00,  659.00,  594.00
16
)
17
months <- 1:length(prices)
18
result <- lm(log10(prices) ~ months)
19
a <- coef(result)[2]
20
b <- coef(result)[1]
21
22
plot(months, prices, type='n', log='y', xaxt='n', yaxt='n',
23
     xlim=c(0,70), ylim=c(0.005,10000),
24
     main=sprintf("Bitcoin price trend (y = %f * x - %f)", a, abs(b)),
25
     xlab="", ylab="Typical price in USD")
26
27
years = 2009 + 0:5
28
dates = ISOdate(rep(years, rep(4, length(years))),
29
                rep(0:3 * 3 + 1, length(years)), 1)
30
31
axis(1, 1:length(dates) * 3 - 2, labels=format(dates, '%b %y'))
32
axis(2, 10^(-1:4), 10^(-1:4))
33
34
abline(h=c(1:9 / 100, 1:9 / 10, 1:9, 1:9*10, 1:9 * 100, 1:10 * 1000),
35
       col="lightgrey")
36
37
abline(v=1:100, col="lightgrey")
38
39
abline(result, col="red")
40
lines(months, prices, type="o")
41
box()
42
43
dev.off()