title: The curious case of ARIMA modelling using R
body: <p>I observed something strange while fitting an ARMA model using the function <strong>arma{tseries}</strong> and <strong>arima{stats}</strong> in R. </p>
  
  <p>There is a radical difference in the estimation procedures adopted by the two functions, Kalman filter in arima{stats} as opposed to ML estimation in arma{tseries}.</p>
  
  <p>Given the difference in the estimation procedures between the two functions, one would not expect the results to be radically different for the two function if we use the same timeseries.</p>
  
  <p>Well seems that they can!</p>
  
  <p>Generate the below timeseries and add 2 outliers.</p>
  
  <pre><code>set.seed(1010)
  ts.sim &lt;- abs(arima.sim(list(order = c(1,0,0), ar = 0.7), n = 50))
  ts.sim[8] &lt;- ts.sim[12]*8
  ts.sim[35] &lt;- ts.sim[32]*8
  </code></pre>
  
  <p>Fit an ARMA model using the two function.</p>
  
  <pre><code># Works perfectly fine
  arima(ts.sim, order = c(1,0,0))
  # Works perfectly fine
  arma(ts.sim, order = c(1,0))
  </code></pre>
  
  <p>Change the level of the timeseries by a factor of 1 billion</p>
  
  <pre><code># Introduce a multiplicative shift
  ts.sim.1 &lt;- ts.sim*1000000000
  options(scipen = 999)
  summary(ts.sim.1)
  </code></pre>
  
  <p>Fit an ARMA model using the 2 functions:</p>
  
  <pre><code># Works perfectly fine
  arma(ts.sim.1, order = c(1,0))
  
  # Does not work
  arima(ts.sim.1, order = c(1,0,0))
  
  ## Error in solve.default(res$hessian * n.used, A): system is 
   computationally singular: reciprocal condition number = 1.90892e-19
  </code></pre>
  
  <p>Where I figured out this problem was when SAS software was successfully able to run the proc x12 procedure to conduct the seasonality test but the same function on R gave me the error above. That made me really wonder and look at the SAS results with skepticism but it turn out, it might just be something to do with the arima{stats}.</p>
  
  <p>Can anyone try to elaborate the reason for the above error which limits us to fit a model using arima{stats}?</p>