aua
aua

Reputation: 97

Advanced ARIMA Model

I need to construct an advanced Arima model. Value of v1 is fixed for all advanced arima models but value for the xreg is different (contains 7 data columns). I need to extract mean residuals for this 7 regressions. So far I have come up with this code.

model <- data[c(2:8)]
AdvancedMAE <- function(model){
  p <- ncol(model)
  p1 <- Arima(data$v1,order=c(0,3,1),xreg=as.matrix(model))
  p2 <- data.frame(mean(abs(p1$residuals)))
  p2
  }
allvalue <- AdvancedMAE(model=model)

but the result that I get is mean of all data, not mean for each 7 loop regressions.

Upvotes: 0

Views: 124

Answers (1)

Maurits Evers
Maurits Evers

Reputation: 50738

The following is a bit too long for a comment.

First off, please always provide representative & minimal sample data; if you can't share your data due to privacy reasons, provide mock data. arima.sim makes simulating data for specific ARIMA processes very easy. If you provide random sample data, don't forget to use a fixed random seed with set.seed.

As to your questions:

  1. I don't know what you mean by an "advanced Arima model". You seem to fit a basic ARIMA(0, 3, 1) model with external regressors.
  2. Are you sure the three degrees of differencing are correct? Not knowing anything about your data (one of the reasons why providing data is important!), to me a d = 3 process would set off alarm bells. It's pretty rare to have a process that would require d > 2.
  3. "I need to extract mean residuals for this 7 regressions" In your model, you don't perform 7 regressions. You perform a single regression with (what looks like) 7 external regressors.

Upvotes: 1

Related Questions