Reputation: 97
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
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:
d = 3
process would set off alarm bells. It's pretty rare to have a process that would require d > 2
.Upvotes: 1