ARIMA quantile regression in R - Cross Validated most recent 30 from stats.stackexchange.com 2019-07-23T10:11:06Z https://stats.stackexchange.com/feeds/question/236758 http://www.creativecommons.org/licenses/by-sa/3.0/rdf https://stats.stackexchange.com/q/236758 3 ARIMA quantile regression in R Newbie https://stats.stackexchange.com/users/132262 2016-09-25T02:33:26Z 2017-08-21T05:33:57Z <p>I would like to perform a quantile regression of a <a href="https://en.wikipedia.org/wiki/Autoregressive_integrated_moving_average" rel="nofollow">autoregressive integrated moving average</a> (ARIMA) model (p,0,q) of a stock return in R. My question is: how can I include the moving average process in the regression? I read I need to use <strong>rq</strong> (which is available in "quantreg" package) but I cannot follow the procedure for an ARIMA case. Can anybody help me pls? packages used and code until now:</p> <pre><code>library(quantmod) #to get the stock prices library(quantreg) #to get the function for quantile regression ticker &lt;- c("AAPL") myenv &lt;- new.env() symnames &lt;- getSymbols(ticker, env=myenv) ts &lt;- do.call(merge, eapply(myenv, Ad)[symnames]) rt &lt;- diff(log(ts), lag = 1) rt_final &lt;- rt[-1:-1,] fit_rt&lt;-auto.arima(rt_final); summary(fit_rt) x &lt;- fitted(fit_rt) y &lt;- cbind(x, lx = lag(x),llx=lag(lag(x))) #include two for now qregr &lt;- rq(x ~ lx + llx, data = y) #this is where I need to include the MA(2) process, right? qregr &lt;- rq(x ~ lx + llx, tau = seq(0.05, 0.95, by = 0.05), data = y); summary(qregr) plot(qregr) </code></pre> <p>thanks,</p> https://stats.stackexchange.com/questions/236758/-/236875#236875 2 Answer by Carl for ARIMA quantile regression in R Carl https://stats.stackexchange.com/users/99274 2016-09-25T22:26:57Z 2016-09-25T22:26:57Z <p>From the comments in <a href="http://robjhyndman.com/hyndsight/quantile-forecasts-in-r/" rel="nofollow">Generating quantile forecasts in R</a>: </p> <p>Larry Pohlman: For the quantile forecast question you can use the R "quantile" function or the quantile regression function "rq"</p> <p>Rob J Hyndman: You can only use the quantile function if you can simulate future sample paths of the time series (unless you want to assume iid data). I'm not sure how you would use "rq()" without assuming a linear regression model which is usually too restrictive for forecasting.</p> <p>Larry Pohlman: strictly speaking quantile regressions are only linear if the residuals are homoscedastic.Otherwise the quantitle regression generates a family of linear functions for every quantile. Check Roger Koenker's papers / book</p> <p>Rob J Hyndman: I've read Koenker, and I've used <code>rq</code>. Homoscedasticity will give you parallel lines. I don't want parallel lines, and I don't even want linear functions, or a family of linear functions. Forecast quantiles are almost never linear.</p>