importFrom(colorspace,sequential_hcl)
importFrom(fracdiff,fracdiff,diffseries,fracdiff.sim)
importFrom(tseries,adf.test,pp.test,kpss.test)
importFrom(zoo, rollmean, as.Date, as.yearqtr)
importFrom(timeDate, as.timeDate, isBizday, difftimeDate, Easter, as.Date.timeDate)
importFrom(nnet,nnet)
import(parallel,Rcpp)

importFrom("grDevices", "gray", "heat.colors", "nclass.FD")
importFrom("graphics", "abline", "axis", "grid", "layout", "lines",
             "mtext", "par", "plot", "points", "polygon", "text",
             "title", "hist")
importFrom("stats", "Box.test", "acf", "approx", "ar", "arima",
             "arima.sim", "as.ts", "complete.cases", "cycle",
             "decompose", "diffinv", "end", "extractAIC", "fitted", "formula",
             "frequency","window","filter","na.contiguous","spec.ar",
             "hatvalues", "is.ts", "ksmooth", "lm", "lsfit","loess", "median",
             "model.frame", "na.exclude", "na.omit", "na.pass", "optim",
             "optimize", "pf", "plot.ts", "poly", "predict", "pt",
             "qnorm", "qt", "quantile", "residuals", "rnorm", "runif",
             "sd", "simulate", "smooth.spline", "start", "stl", "supsmu",
             "terms", "time", "ts", "tsp", "tsp<-", "tsdiag", "var",
             "logLik","nobs","napredict")
importFrom("stats", "aggregate", "as.formula", "is.mts", "reformulate")
importFrom("utils", "packageVersion", "tail", "head")
importFrom("ggplot2", "autoplot", "fortify")
importFrom("lmtest","bgtest")

importFrom(magrittr,"%>%")
export("%>%")

export(arfima, Arima, arima.errors, arimaorder, auto.arima, BoxCox, croston,
forecast, forecast.ar, forecast.Arima, forecast.ets, forecast.fracdiff,findfrequency,
forecast.HoltWinters, forecast.lm, forecast.stl, forecast.StructTS, forecast.bats, forecast.tbats, accuracy, holt, hw, InvBoxCox,
is.acf, is.Arima, is.bats, is.constant, is.ets, is.forecast, is.mforecast, is.nnetar, is.nnetarmodels, is.splineforecast, is.stlm,
nnetar, forecast.nnetar, baggedETS,forecast.baggedETS,is.baggedETS,bld.mbb.bootstrap,
plot.Arima, plot.ar, taperedacf, taperedpacf,
meanf, monthdays, na.interp, ets, plot.bats, plot.tbats, plot.ets, plot.forecast,
plot.splineforecast, rwf, seasadj, seasonaldummy,naive,snaive,stlf,subset.ts,
seasonaldummyf, ggAcf, ggPacf, ggCcf, ggtaperedacf, ggtaperedpacf, gglagplot, gglagchull,
ggtsdisplay, ggmonthplot, ggsubseriesplot, ggseasonplot, seasonplot, ses, sindexf, splinef, tslm, fourier,
fourierf,forecast.lm,thetaf, tsdisplay, simulate.ets, simulate.ar, simulate.Arima, simulate.fracdiff, simulate.nnetar,
ndiffs, nsdiffs, dm.test,tbats.components, Acf,Pacf,Ccf,ma,BoxCox.lambda,dshw, bats, tbats, msts,
getResponse, tsoutliers, tsclean, bizdays, easter,stlm, forecast.stlm,
StatForecast, GeomForecast, geom_forecast, gghistogram,
checkresiduals,
CV, tsCV, CVar,
autolayer, autolayer.ts, autolayer.mts, autolayer.forecast, autolayer.mforecast,
autoplot.acf, autoplot.ar, autoplot.Arima,
autoplot.decomposed.ts, autoplot.ets, autoplot.StructTS, autoplot.forecast, autoplot.mforecast,
autoplot.splineforecast, autoplot.stl, autoplot.ts, autoplot.mpacf, autoplot.mts,
autoplot.seas,
fortify.ts,
seasonal, trendcycle,remainder,
fitted.Arima,  fitted.bats, fitted.tbats, fitted.ets, fitted.nnetar,
residuals.ar, residuals.Arima, residuals.bats, residuals.ets, residuals.fracdiff,
residuals.forecast, residuals.nnetar, residuals.stlm)

S3method(autolayer, ts)
S3method(autolayer, mts)
S3method(autolayer, forecast)
S3method(autolayer, mforecast)
S3method(autoplot, acf)
S3method(autoplot, ar)
S3method(autoplot, Arima)
S3method(autoplot, decomposed.ts)
S3method(autoplot, ets)
S3method(autoplot, forecast)
S3method(autoplot, mforecast)
S3method(autoplot, splineforecast)
S3method(autoplot, stl)
S3method(autoplot, StructTS)
S3method(autoplot, ts)
S3method(autoplot, seas)
S3method(autoplot, mpacf)
S3method(autoplot, mts)
S3method(fortify, ts)
S3method(as.character, Arima)
S3method(as.data.frame,forecast)
S3method(as.data.frame,mforecast)
S3method(as.Date, timeDate)
S3method(coef,ets)
S3method(fitted,Arima)
S3method(fitted,ets)
S3method(fitted,tbats)
S3method(fitted,bats)
S3method(fitted,nnetar)
S3method(fitted,fracdiff)
S3method(fitted,ar)
S3method(forecast,ar)
S3method(forecast,Arima)
S3method(forecast,bats)
S3method(forecast,default)
S3method(forecast,ets)
S3method(forecast,forecast)
S3method(forecast,fracdiff)
S3method(forecast,HoltWinters)
S3method(forecast,lm)
S3method(forecast,mlm)
S3method(forecast,nnetar)
S3method(forecast,baggedETS)
S3method(forecast,stl)
S3method(forecast,stlm)
S3method(forecast,StructTS)
S3method(forecast,tbats)
S3method(forecast,ts)
S3method(forecast,mts)
S3method(forecast,varest)
S3method(getResponse,ar)
S3method(getResponse,Arima)
S3method(getResponse,default)
S3method(getResponse,fracdiff)
S3method(getResponse,lm)
S3method(head,ts)
S3method(tail,ts)
S3method(logLik,ets)
S3method(nobs,ets)
S3method(plot,ar)
S3method(plot,Arima)
S3method(plot,bats)
S3method(plot,ets)
S3method(plot,forecast)
S3method(plot,mforecast)
S3method(plot,splineforecast)
S3method(plot,tbats)
S3method(predict,default)
S3method(print,ARIMA)
S3method(print,bats)
S3method(print,ets)
S3method(print,forecast)
S3method(print,mforecast)
S3method(print,msts)
S3method(print,naive)
S3method(print,nnetar)
S3method(print,baggedETS)
S3method(print,nnetarmodels)
S3method(print,tbats)
S3method(print,CVar)
S3method(residuals, ar)
S3method(residuals, Arima)
S3method(residuals,bats)
S3method(residuals,ets)
S3method(residuals,fracdiff)
S3method(residuals, forecast)
S3method(residuals, geom_forecast)
S3method(residuals, nnetar)
S3method(residuals, stlm)
S3method(seasadj,decomposed.ts)
S3method(seasadj,tbats)
S3method(seasadj,stl)
S3method(seasadj,seas)
S3method(simulate,ar)
S3method(simulate,Arima)
S3method(simulate,ets)
S3method(simulate,fracdiff)
S3method(simulate,nnetar)
S3method(subset,ts)
S3method(summary,Arima)
S3method(summary,ets)
S3method(summary,forecast)
S3method(summary,mforecast)
S3method(tsdiag,ets)
S3method(window,msts)

useDynLib(forecast, .registration = TRUE)
