Created
May 26, 2019 13:46
-
-
Save sck/455bad1d31d3a6a24708fa7799a9ff53 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> library(forecast) | |
> train = read.csv("c.csv") | |
> T<-train[which(train$name == 'btc'), ] | |
> Train<-T[ with(T, order(ts)),] | |
> head(Train) | |
# name ts usd_value volume | |
# 1 btc 1.558271e+12 7912.8 23649292230 | |
# 15 btc 1.558272e+12 7955.9 23741378790 | |
# 29 btc 1.558272e+12 7940.0 23816540813 | |
# 43 btc 1.558272e+12 7942.9 23891912844 | |
# 57 btc 1.558273e+12 7964.6 23914583777 | |
# 71 btc 1.558273e+12 7947.0 23941990903 | |
> holt(Train[,'usd_value']) | |
# Point Forecast Lo 80 Hi 80 Lo 95 Hi 95 | |
# 1670 7942.866 7918.622 7967.110 7905.788 7979.943 | |
# 1671 7942.887 7909.384 7976.390 7891.648 7994.126 | |
# 1672 7942.908 7902.198 7983.618 7880.648 8005.169 | |
# 1673 7942.930 7896.108 7989.751 7871.323 8014.536 | |
# 1674 7942.951 7890.728 7995.174 7863.082 8022.819 | |
# 1675 7942.972 7885.854 8000.090 7855.618 8030.326 | |
# 1676 7942.993 7881.368 8004.619 7848.745 8037.241 | |
# 1677 7943.014 7877.188 8008.841 7842.342 8043.687 | |
# 1678 7943.036 7873.261 8012.811 7836.324 8049.747 | |
# 1679 7943.057 7869.544 8016.570 7830.628 8055.485 | |
> thetaf(Train[,'usd_value']) | |
# Point Forecast Lo 80 Hi 80 Lo 95 Hi 95 | |
# 1670 7942.862 7918.661 7967.063 7905.850 7979.874 | |
# 1671 7942.887 7909.402 7976.372 7891.677 7994.098 | |
# 1672 7942.913 7902.209 7983.617 7880.662 8005.164 | |
# 1673 7942.938 7896.116 7989.761 7871.329 8014.548 | |
# 1674 7942.964 7890.734 7995.194 7863.086 8022.843 | |
# 1675 7942.990 7885.862 8000.117 7855.621 8030.358 | |
# 1676 7943.015 7881.378 8004.652 7848.750 8037.280 | |
# 1677 7943.041 7877.203 8008.879 7842.350 8043.731 | |
# 1678 7943.066 7873.279 8012.853 7836.336 8049.796 | |
# 1679 7943.092 7869.568 8016.616 7830.647 8055.537 | |
# | |
> forecast(Train[,'usd_value']) | |
# Point Forecast Lo 80 Hi 80 Lo 95 Hi 95 | |
# 1670 7942.836 7918.636 7967.037 7905.825 7979.848 | |
# 1671 7942.836 7909.358 7976.315 7891.636 7994.037 | |
# 1672 7942.836 7902.144 7983.529 7880.602 8005.071 | |
# 1673 7942.836 7896.028 7989.645 7871.250 8014.423 | |
# 1674 7942.836 7890.624 7995.049 7862.985 8022.688 | |
# 1675 7942.836 7885.729 7999.944 7855.499 8030.174 | |
# 1676 7942.836 7881.222 8004.451 7848.605 8037.068 | |
# 1677 7942.836 7877.023 8008.650 7842.183 8043.490 | |
# 1678 7942.836 7873.076 8012.597 7836.147 8049.526 | |
# 1679 7942.836 7869.340 8016.332 7830.434 8055.239 | |
# | |
> auto.arima(Train[,'usd_value']) | |
# Series: Train[, "usd_value"] | |
# ARIMA(2,1,3) | |
# | |
# Coefficients: | |
# ar1 ar2 ma1 ma2 ma3 | |
# -1.2890 -0.9429 1.2548 0.8634 -0.0667 | |
# s.e. 0.0347 0.0314 0.0416 0.0519 0.0254 | |
# | |
# sigma^2 estimated as 353: log likelihood=-7256.91 | |
# AIC=14525.82 AICc=14525.87 BIC=14558.33 | |
# | |
> fit = auto.arima(Train[,'usd_value']) | |
> forecast(fit) | |
# Point Forecast Lo 80 Hi 80 Lo 95 Hi 95 | |
# 1670 7943.523 7919.446 7967.601 7906.700 7980.346 | |
# 1671 7942.970 7909.496 7976.444 7891.776 7994.164 | |
# 1672 7943.099 7902.820 7983.379 7881.498 8004.701 | |
# 1673 7943.454 7897.233 7989.675 7872.766 8014.143 | |
# 1674 7942.875 7891.190 7994.560 7863.830 8021.920 | |
# 1675 7943.287 7887.002 7999.572 7857.207 8029.367 | |
# 1676 7943.302 7882.522 8004.082 7850.346 8036.258 | |
# 1677 7942.894 7877.946 8007.842 7843.564 8042.224 | |
# 1678 7943.406 7874.724 8012.088 7838.366 8048.446 | |
# 1679 7943.131 7870.669 8015.593 7832.310 8053.952 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment