Hi All
Could you pls advise how to get fitted values based on prediction of arima/ets model for input data? I dont need prediction, but only fitted using model. Thanks!
Solved! Go to Solution.
The following seems to be working for me for the ETS tool:
the.model <- read.Alteryx("#1") mod.obj <- unserializeObject(as.character(the.model$Object[1])) model.fitted <- fitted(mod.obj) write.Alteryx(data.frame(Fitted=as.matrix(model.fitted)), 1)
Hi Neil,
I am trying to use same code for getting fitted values for ARIMA model ARIMA(1,0,1)(1,0,1)12 but i am getting error "Error: R (95): Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x), :
". any thoughts?
Thanks,
Kris
It's working for me. What Alteryx version are you on? Can you include the workflow and data that's giving you the error?
Thanks Neil! It is working for me now.
I was using version 11.3 and had problems, upgraded to 2018.2 and it is working.
Thanks
Hi,
I'm using the TS Factory tools to get predictions on groups of data. I'm interested in the next forecasted point, as well as the fitted values - similar to the need in the original post. I am leveraging the R code Neil provided, however it doesn't appear to be giving fitted values for anything beyond the first group. What would needs to be added / changed with the R code so the fitted values are listed by group? See attached workflow. Thanks!
@cwkoops could you attach a package (Options->Export Workflow) rather than a workflow? The TS Factory tools aren't getting included.
The TS Model Factory tool outputs each group as a separate model object in a new row. The second line of the original R code is only pulling from row 1:
mod.obj <- unserializeObject(as.character(the.model$Object[1]))
Changing that 1 to a 2 gets you the second group. You'll likely want to iterate across each row (for loop or something along those lines) to get a more robust solution.
Thanks Neil. I was playing around with those values, but nothing was obvious to me. This seems to work with the for loop you mentioned.
the.model <- read.Alteryx("#1", mode = "data.frame")
for(i in 1:nrow(the.model)){
mod.obj <- unserializeObject(as.character(the.model$Object[i]))
model.fitted <- fitted(mod.obj)
write.Alteryx(data.frame(Fitted=as.matrix(model.fitted)), 1)
}
So now I have the correct # of rows, but the 2nd column with the group identifier would be nice, but possibly not necessary as I could just append it to the original input data stream...if the # of rows is the same. Any thoughts there?