Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 439275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T20:45:36+00:00 2026-05-12T20:45:36+00:00

data <-c(88, 84, 85, 85, 84, 85, 83, 85, 88, 89, 91, 99, 104,

  • 0
data <-c(88, 84, 85, 85, 84, 85, 83, 85, 88, 89, 91, 99, 104, 112, 126, 138, 146,151,   150, 148, 147, 149, 143, 132, 131, 139, 147, 150, 148, 145, 140, 134, 131, 131, 129, 126, 126, 132, 137, 140, 142, 150, 159, 167, 170, 171, 172, 172, 174, 175, 172, 172, 174, 174, 169, 165, 156, 142, 131, 121, 112, 104, 102, 99, 99, 95, 88, 84, 84, 87, 89, 88, 85, 86, 89, 91, 91, 94, 101, 110, 121, 135, 145, 149, 156, 165, 171, 175, 177, 182, 193, 204, 208, 210, 215, 222, 228, 226, 222, 220)

Why do the ARMA models acting on the first differences of the data differ from the corresponding ARIMA models?

for (p in 0:5)
{
for (q in 0:5)
{
#data.arma = arima(diff(data), order = c(p, 0, q));cat("p =", p, ", q =", q, "AIC =",  data.arma$aic, "\n");
data.arma = arima(data, order = c(p, 1, q));cat("p =", p, ", q =", q, "AIC =", data.arma$aic, "\n");
}
}

Same with Arima(data,c(5,1,4)) and Arima(diff(data),c(5,0,4)) in the forecast package. I can get the desired consistency with

auto.arima(diff(data),max.p=5,max.q=5,d=0,approximation=FALSE, stepwise=FALSE, ic ="aic", trace=TRUE);
auto.arima(data,max.p=5,max.q=5,d=1,approximation=FALSE, stepwise=FALSE, ic ="aic", trace=TRUE);

but it seems the holder of the minimum AIC estimate for these data has not been considered by the algorithm behind auto.arima; hence the suboptimal choice of ARMA(3,0) instead of ARMA(5,4) acting on the first differences. A related question is how much the two AIC estimates should differ before one considers one model better than the other has little to do wuth programming – the smallest AIC holder should at least be considered/reported, even though 9 coefficients may be a bit too much for a forecast from 100 observations.

My R questions are:

1) Vectorised version of the double loop so it is faster?

2) Why does arima(5,1,4) acting on the data differ from arma(5,4) acting on the first differences of the data? Which one is to be reported?

3) How do I sort the AICs output so that the smaller come first?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T20:45:36+00:00Added an answer on May 12, 2026 at 8:45 pm

    There are a lot of questions and issues raised here. I’ll try to respond to each of them.

    Arima() is just a wrapper for arima(), so it will give the same model.

    arima() handles a model with differencing by using a diffuse prior. That is not the same as just differencing the data before fitting the model. Consequently, you will get slightly different results from arima(x,order=c(p,1,q)) and arima(diff(x),order=c(p,0,q)).

    auto.arima() handles differencing directly and does not use a diffuse prior when fitting. So you will get the same results from auto.arima(x,d=1,...) and auto.arima(diff(x),d=0,...)

    auto.arima() has an argument max.order which specifies the maximum of p+q. By default, max.order=5, so your arima(5,1,4) would not be considered. Increase max.order if you want to consider such large models (although I wouldn’t recommend it).

    You can’t vectorize a loop involving nonlinear optimization at each iteration.

    If you want to sort your output, you’ll need to save it to a data.frame and then sort on the relevant column. The code currently just spits out the results as it goes and nothing is saved except for the most recent model fitted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following data: yvar <- c(1:150) replication <- c( rep(c(rep(1, 10), rep(2,10),
I have JSON Data in this format : var jsonData = [{date:'August 19, 2004',open:100.01,high:104.06},{date:'August
In Windows Azure role, I cannot ping out D:\Users\foglight>ping www.google.com Pinging www.l.google.com [209.85.143.104] with
Data: a dependency list, already verified to be acyclic. So here, 'a' depends on
Data table structure is: id1,id2,id3,id4,... (some other fields). I want to create summary query
data: id bb 1 14,35 2 5,11,12,125,36 3 3,23,45,15,1 4 651 5 5,1,6 6
Data Access Objects (DAOs) are a common design pattern, and recommended by Sun. But
Data from another system is replicated into a SQL Server 2005 database in real-time
Data comes in by email as a zipped file. The Java solution we wrote
.data VALS: .half 0xbead, 0xface RES: .space 4 .text la $t0,VALS lh $t1,($t0) lhu

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.