【原创】大数据部落——中国专业的第三方数据服务提供商
提供定制化的一站式数据挖掘和统计分析咨询报告服务:y0.cn/teradat(咨询服务请联系官网客服)
R语言时间序列arima和随机森林模型预测分析
library(forecast)library(ggplot2)library(magrittr)library(randomForest) ## randomForest 4.6-12 ## Type rfNews() to see new features/changes/bug fixes. ## ## Attaching package: 'randomForest' ## The following object is masked from 'package:ggplot2': ## ## margin # data <- Quandl(c(\\\type = \collapse = \data<-readRDS(\)autoplot(data, facets=TRUE)
lm_mod<-lm(GDP~ ., data=data) ar1<-auto.arima(data[, 1], stepwise=FALSE)ar2<-auto.arima(data[, 2], stepwise=FALSE)ar3<-auto.arima(data[, 3], stepwise=FALSE) 【原创】大数据部落——中国专业的第三方数据服务提供商
提供定制化的一站式数据挖掘和统计分析咨询报告服务:y0.cn/teradat(咨询服务请联系官网客服)
GDP<-forecast(ar1)$meanIndProd<-forecast(ar2)$meanUnRate<-forecast(ar3)$meanf3<-cbind(IndProd,UnRate)arireg<-auto.arima(data[, 1], stepwise=FALSE, xreg=data[,-1]) pred_lm<-ts(predict(lm_mod, f3), start=c(2017, 3), frequency=4)comb<-ts.union(pred_lm, data[,1])predLM<-pmin(comb[,1], comb[,2], na.rm=TRUE) autoplot(forecast(data, h=12))
autoplot(forecast(ar2, h=12), ylab=\) 【原创】大数据部落——中国专业的第三方数据服务提供商
提供定制化的一站式数据挖掘和统计分析咨询报告服务:y0.cn/teradat(咨询服务请联系官网客服)
autoplot(forecast(ar3, h=12), ylab=\)
autoplot(forecast(ar1, h=12), ylab=\) 【原创】大数据部落——中国专业的第三方数据服务提供商
提供定制化的一站式数据挖掘和统计分析咨询报告服务:y0.cn/teradat(咨询服务请联系官网客服)
autoplot(forecast(arireg, xreg=f3, h=12), ylab=\)
summary(lm_mod)
相关推荐: