r - Auto Arima for multiple time series -


i have weekly(2015 jan 2017 apr) sales data multiple products. trying use auto arima predict future. keep getting output na many products. sample code. can please went wrong in code.

data1 <- ts(r_input_stats[,-1],f=52,s=2015+2/52) h <- 25 ns <- ncol(data1) arimaforecast <- matrix(na, nrow=h, ncol=ns) (i in 1:ns){   arimaforecast[,i] <- forecast(auto.arima(data1[,i]), h=h,)$mean} write(t(arimaforecast),file="r_output_stats_arimaallskus.csv",sep=",",ncol=ncol(arimaforecast)) 

can replace above "for loop" "lapply"?and if want know order of auto arima each product ? reply sample data sample data

structure(c(65l, 195l, 110l, 58l, 0l, 273l, 45l, 36l, 15l, 11l,  10l, 27l, 36l, 16l, 29l, 155l, 22l, 182l, 156l, 528l, 63l, 94l,  168l, 171l, 197l, 130l, 235l, 19l, 241l, 134l, 466l, 227l, 302l,  134l, 369l, 405l, 1l, 32l, 5l, 2l, 3l, 0l, 14l, 2011l, 685l,  629l, 417l, 1086l, 9l, 7l, 6l, 5l, 21l, 10l, 119l, 158l, 128l,  85l, 153l, 172l, 0l, 0l, 52l, 312l, 0l, 52l, 0l, 0l, 0l, 0l,  0l, 0l, 19l, 11l, 23l, 16l, 11l, 11l, 12l, 9l, 13l, 20l, 4l,  20l, 424l, 311l, 1384l, 259l, 581l, 1690l, 195l, 155l, 141l,  199l, 360l, 316l, 202l, 384l, 322l, 285l, 1643l, 1437l, 101l,  66l, 294l, 120l, 480l, 204l, 660l, 1100l, 176l, 3933l, 2431l,  22568l, 16l, 20l, 14l, 25l, 24l, 24l, 0l, 0l, 0l, 0l, 0l, 0l,  931l, 3586l, 1505l, 794l, 808l, 2750l, 282l, 396l, 247l, 291l,  666l, 521l, 1576l, 1342l, 1871l, 2084l, 3181l, 3725l, 1161l,  1431l, 8039l, 5721l, 22688l, 40456l, 803l, 622l, 673l, 915l,  1142l, 701l, 0l, 0l, 0l, 0l, 0l, 0l, 61l, 0l, 27l, 0l, 216l,  162l, 26l, 61l, 27l, 33l, 65l, 24l, 161l, 122l, 187l, 115l, 360l,  227l, 14l, 1l, 2l, 9l, 9l, 6l, 109l, 160l, 297l, 199l, 197l,  238l, 351l, 324l, 1566l, 336l, 860l, 1715l, 28l, 20l, 53l, 33l,  59l, 56l, 210l, 420l, 210l, 1050l, 210l, 0l, 9l, 4l, 7l, 9l,  12l, 17l, 16l, 9l, 29l, 46l, 22l, 171l, 92l, 145l, 125l, 238l,  126l, 983l, 48l, 26l, 55l, 263l, 199l, 150l, 810l, 129l, 161l,  211l, 672l, 504l, 30l, 1l, 11l, 2l, 3l, 5l, 0l, 470l, 630l, 1064l,  1875l, 3350l, 235l, 64l, 135l, 327l, 351l, 471l, 210l, 210l,  630l, 420l, 840l, 1110l, 0l, 0l, 150l, 75l, 225l, 375l, 68l,  84l, 88l, 48l, 66l, 116l, 86l, 73l, 54l, 73l, 54l, 85l, 1883l,  1694l, 1143l, 1325l, 1355l, 2383l, 15l, 27l, 14l, 33l, 132l,  42l, 2l, 0l, 0l, 1l, 1l, 1l, 2l, 1860l, 3945l, 5165l, 40290l,  7194l, 0l, 0l, 0l, 0l, 0l, 0l, 2l, 14l, 17l, 18l, 77l, 1l, 1119l,  2533l, 7943l, 2322l, 1298l, 1403l, 41l, 47l, 19l, 39l, 54l, 56l,  272l, 177l, 290l, 178l, 677l, 1361l, 3808l, 3120l, 18010l, 21026l,  90002l, 15925l, 72l, 44l, 54l, 74l, 80l, 49l, 0l, 0l, 0l, 0l,  0l, 0l, 0l, 0l, 0l, 0l, 40l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 44l,  211l, 212l, 234l, 219l, 216l, 3l, 3l, 2l, 6l, 1l, 9l, 17l, 5l,  6l, 12l, 11l, 30l, 0l, 0l, 0l, 0l, 103l, 245l, 0l, 0l, 0l, 0l,  600l, 480l, 22l, 78l, 57l, 54l, 48l, 93l, 9l, 13l, 10l, 11l,  7l, 68l, 31l, 23l, 10l, 39l, 12l, 43l, 17l, 2l, 4l, 12l, 3l,  5l, 39l, 70l, 41l, 36l, 111l, 91l, 0l, 0l, 7l, 39l, 479l, 669l,  0l, 0l, 0l, 0l, 0l, 0l, 7l, 3l, 8l, 3l, 12l, 9l, 0l, 0l, 0l,  1l, 0l, 1l, 16l, 17l, 10l, 8l, 14l, 16l, 16l, 16l, 3l, 7l, 48l,  14l, 120l, 60l, 55l, 36l, 201l, 224l, 15l, 5l, 31l, 5l, 3l, 21l,  0l, 0l, 0l, 0l, 0l, 90l, 6l, 6l, 11l, 10l, 12l, 10l, 1l, 53l,  7l, 18l, 6l, 0l, 0l, 0l, 120l, 20l, 120l, 60l, 12l, 3l, 1l, 40l,  120l, 4l, 9l, 1l, 3l, 9l, 4l, 3l, 22l, 9l, 38l, 44l, 38l, 185l,  59l, 111l, 238l, 224l, 117l, 445l, 20l, 14l, 20l, 27l, 65l, 41l,  128l, 50l, 122l, 64l, 208l, 319l, 8l, 8l, 0l, 6l, 0l, 0l, 0l,  0l, 32l, 587l, 949l, 1155l, 68l, 392l, 39l, 180l, 176l, 92l,  0l, 120l, 40l, 240l, 400l, 120l, 1027l, 1731l, 3675l, 1493l,  1896l, 2207l, 0l, 0l, 0l, 0l, 0l, 0l, 541l, 258l, 531l, 376l,  229l, 324l, 1344l, 0l, 56l, 987l, 4360l, 8701l, 0l, 0l, 0l, 0l,  0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 456l, 1864l, 1137l, 670l, 685l,  1008l, 647l, 329l, 371l, 665l, 552l, 637l, 696l, 448l, 379l,  451l, 658l, 478l, 560l, 0l, 112l, 199l, 1560l, 2344l, 0l, 0l,  0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 3366l, 1580l, 2744l,  616l, 2750l, 2016l, 551l, 264l, 661l, 47l, 1172l, 588l, 7l, 0l,  4l, 17l, 4l, 23l, 225l, 194l, 120l, 418l, 820l, 237l, 136l, 135l,  78l, 322l, 467l, 426l, 145l, 58l, 41l, 348l, 216l, 69l, 122l,  86l, 16l, 90l, 95l, 53l, 10l, 171l, 421l, 66l, 412l, 348l, 221l,  252l, 807l, 1382l, 38516l, 7962l, 343l, 55l, 28l, 60l, 123l,  162l, 56l, 168l, 0l, 448l, 182l, 224l, 0l, 0l, 0l, 0l, 0l, 0l,  0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l,  0l, 0l, 0l, 0l, 48l, 0l, 48l, 96l, 242l, 81l, 37l, 13l, 74l,  320l, 9l, 10l, 3l, 4l, 7l, 64l, 8l, 13l, 12l, 30l, 20l, 13l,  132l, 750l, 1379l, 110l, 81l, 512l, 195l, 207l, 606l, 171l, 318l,  847l, 977l, 570l, 839l, 249l, 762l, 1277l, 802l, 81l, 4804l,  8510l, 4979l, 9953l, 35l, 21l, 24l, 19l, 40l, 35l, 60l, 0l, 0l,  0l, 0l, 0l, 0l, 0l, 0l, 0l, 0l, 1l, 0l, 0l, 540l, 0l, 0l, 1l,  105l, 80l, 64l, 26l, 15l, 141l, 237l, 19l, 63l, 0l, 22l, 99l,  0l, 0l, 0l, 540l, 3352l, 1l, 0l, 0l, 0l, 0l, 0l, 0l, 30l, 17l,  9l, 8l, 51l, 221l, 1l, 3l, 1l, 0l, 1l, 7l, 26l, 215l, 2l, 26l,  17l, 23l, 98l, 51l, 52l, 236l, 157l, 113l, 387l, 144l, 150l,  148l, 622l, 748l, 62l, 12l, 16l, 4l, 11l, 22l, 0l, 0l, 420l,  0l, 1260l, 23l, 56l, 42l, 79l, 80l, 111l, 67l, 15l, 5l, 2l, 10l,  19l, 8l, 0l, 270l, 210l, 0l, 210l, 60l, 180l, 37l, 173l, 43l,  182l, 555l, 45l, 5l, 21l, 121l, 82l, 48l, 132l, 59l, 140l, 72l,  225l, 750l, 0l, 0l, 0l, 0l, 56l, 223l, 19l, 11l, 23l, 14l, 23l,  20l, 0l, 131l, 0l, 840l, 210l, 120l, 77l, 89l, 151l, 88l, 188l,  502l, 12l, 16l, 17l, 19l, 32l, 76l, 307l, 93l, 294l, 154l, 182l,  992l, 166l, 118l, 108l, 260l, 277l, 136l, 446l, 53l, 132l, 161l,  717l, 1186l, 0l, 0l, 0l, 358l, 379l, 2000l, 41l, 36l, 46l, 49l,  74l, 54l, 0l, 61l, 56l, 0l, 50l, 140l, 6l, 6l, 6l, 11l, 21l,  25l, 3l, 5l, 5l, 0l, 7l, 12l, 16l, 7l, 23l, 8l, 13l, 15l, 26l,  3l, 4l, 87l, 17l, 31l, 42l, 17l, 13l, 10l, 27l, 30l, 146l, 0l,  118l, 7l, 4l, 156l, 112l, 0l, 0l, 0l, 49l, 182l, 105l, 101l,  13l, 23l, 84l, 83l, 0l, 0l, 0l, 0l, 0l, 0l, 611l, 73l, 33l, 355l,  284l, 1177l, 39l, 8l, 14l, 18l, 29l, 51l, 103l, 47l, 89l, 58l,  121l, 319l, 0l, 0l, 0l, 0l, 0l, 659l, 289l, 173l, 235l, 355l,  329l, 1027l, 46l, 24l, 25l, 31l, 89l, 83l, 206l, 207l, 192l,  99l, 258l, 568l, 440l, 46l, 442l, 0l, 79l, 1456l, 5l, 4l, 2l,  0l, 5l, 2l, 0l, 0l, 0l, 0l, 0l, 0l, 56l, 87l, 25l, 107l, 189l,  385l, 47l, 18l, 22l, 50l, 47l, 63l, 105l, 88l, 111l, 76l, 195l,  419l, 0l, 0l, 84l, 76l, 405l, 419l, 301l, 270l, 258l, 448l, 456l,  964l, 52l, 43l, 39l, 28l, 68l, 143l, 79l, 181l, 83l, 34l, 261l,  407l, 41l, 17l, 15l, 20l, 20l, 19l, 118l, 43l, 32l, 67l, 79l,  401l, 300l, 0l, 0l, 64l, 719l, 1883l, 5l, 3l, 4l, 7l, 3l, 7l,  280l, 160l, 0l, 240l, 840l, 200l, 147l, 303l, 232l, 238l, 524l,  291l, 44l, 53l, 88l, 94l, 103l, 239l, 33l, 27l, 39l, 37l, 35l,  51l, 2420l, 1308l, 2561l, 1574l, 8384l, 11439l, 220l, 76l, 162l,  121l, 228l, 216l, 5083l, 6017l, 5096l, 5055l, 9845l, 27159l,  7680l, 7720l, 88259l, 31626l, 121167l, 191974l, 3397l, 2470l,  2578l, 3189l, 4489l, 7246l, 0l, 0l, 0l, 0l, 0l, 0l, 405l, 513l,  513l, 216l, 1327l, 891l, 389l, 848l, 825l, 643l, 1215l, 437l,  112l, 106l, 137l, 149l, 179l, 361l, 131l, 83l, 171l, 79l, 151l,  53l, 1917l, 2333l, 1550l, 3144l, 2094l, 2605l, 440l, 135l, 375l,  272l, 387l, 408l, 2240l, 2235l, 2975l, 2379l, 3068l, 3653l, 967l,  1220l, 631l, 332l, 1296l, 1296l, 4666l, 4457l, 37948l, 42699l,  45697l, 47091l, 1009l, 653l, 687l, 938l, 1296l, 863l, 0l, 0l,  0l, 0l, 0l, 0l, 634l, 839l, 422l, 711l, 646l, 1129l, 2403l, 1809l,  2673l, 1377l, 2619l, 3726l), .dim = c(6l, 213l), .dimnames = list(     null, c("70-103", "70-110", "70-111", "70-201", "70-202",      "70-203", "70-204", "70-210", "70-211", "70-300", "70-303",      "365-103", "365-110", "365-111", "365-201", "365-202", "365-203",      "365-204", "365-210", "365-211", "365-217", "375-201", "375-202",      "375-203", "375-210", "375-211", "375-217", "506-103", "506-110",      "506-201", "506-202", "506-203", "506-210", "506-211", "661-103",      "661-110", "661-111", "661-201", "661-202", "661-203", "661-204",      "661-210", "661-300", "661-303", "673-103", "673-110", "673-111",      "673-201", "673-203", "673-204", "673-210", "673-217", "673-300",      "697-201", "697-202", "697-203", "697-210", "697-211", "697-217",      "14071-103", "14071-111", "14071-201", "14071-202", "14071-203",      "14071-210", "33127-103", "33127-110", "33127-111", "33127-201",      "33127-202", "33127-203", "33127-210", "33127-217", "33282-110",      "33282-111", "33282-201", "33282-202", "33282-203", "33282-204",      "33282-210", "33282-211", "33282-300", "33282-303", "33560-103",      "33560-110", "33560-111", "33560-201", "33560-202", "33560-203",      "33560-204", "33560-210", "33560-300", "33560-303", "48330-201",      "48330-202", "48330-203", "48330-210", "48330-211", "48330-217",      "48331-201", "48331-202", "48331-203", "48331-210", "48331-211",      "48331-217", "48372-103", "48372-110", "48372-111", "48372-123",      "48372-201", "48372-202", "48372-203", "48372-204", "48372-210",      "48372-300", "48372-303", "52033-201", "52033-202", "52033-203",      "52033-210", "1002101-103", "1002101-110", "1002101-111",      "1002101-123", "1002101-201", "1002101-202", "1002101-203",      "1002101-210", "1002101-211", "1002102-103", "1002102-110",      "1002102-201", "1002102-202", "1002102-203", "1002102-210",      "1002117-103", "1002117-110", "1002117-111", "1002117-201",      "1002117-202", "1002117-203", "1002117-204", "1002117-210",      "1002117-211", "1002117-300", "1002117-303", "1004101-201",      "1004101-202", "1004101-203", "1004101-210", "1004101-211",      "1004117-103", "1004117-110", "1004117-111", "1004117-201",      "1004117-202", "1004117-203", "1004117-210", "1004117-211",      "1005101-103", "1005101-110", "1005101-111", "1005101-201",      "1005101-202", "1005101-203", "1005101-204", "1005101-210",      "1005101-300", "1005101-303", "1010101-201", "1010101-202",      "1010101-203", "1010101-210", "1049101-201", "1049101-202",      "1049101-203", "1049101-210", "1049101-211", "1049101-217",      "1049117-201", "1049117-202", "1049117-203", "1049117-210",      "1104102-110", "1104102-111", "1104102-201", "1104102-202",      "1104102-203", "1104102-210", "1104102-211", "1420124-103",      "1420124-110", "1420124-111", "1420124-123", "1420124-201",      "1420124-202", "1420124-203", "1420124-210", "1420124-211",      "1420124-217", "1420133-103", "1420133-110", "1420133-111",      "1420133-123", "1420133-201", "1420133-202", "1420133-203",      "1420133-204", "1420133-210", "1420133-211", "1420133-217",      "1420133-300", "1420133-303")), .tsp = c(2015.03846153846,  2015.13461538462, 52), class = c("mts", "ts", "matrix")) 


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -