Problem to forecast

Hi, I'm trying to forecast with my data, but I got the following error:

Error in meanf(object, h = h, level = level, fan = fan, lambda = lambda, :
unused argument (new_data = tsibble(data_planejada = seq(as.Date("2020-08-06"), to = as.Date("2020-12-25"), by = "week"), index = data_planejad

Here is my reprex:

library(tsibble)
#> Warning: package 'tsibble' was built under R version 3.6.2
library(lubridate)
#> Warning: package 'lubridate' was built under R version 3.6.2
#> 
#> Attaching package: 'lubridate'
#> The following object is masked from 'package:tsibble':
#> 
#>     interval
#> The following objects are masked from 'package:base':
#> 
#>     date, intersect, setdiff, union
library(dplyr)
#> Warning: package 'dplyr' was built under R version 3.6.2
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(tidyverse)
#> Warning: package 'ggplot2' was built under R version 3.6.2
#> Warning: package 'tibble' was built under R version 3.6.2
#> Warning: package 'tidyr' was built under R version 3.6.2
#> Warning: package 'readr' was built under R version 3.6.2
#> Warning: package 'purrr' was built under R version 3.6.2
library(tidyquant)
#> Warning: package 'tidyquant' was built under R version 3.6.2
#> Carregando pacotes exigidos: PerformanceAnalytics
#> Carregando pacotes exigidos: xts
#> Warning: package 'xts' was built under R version 3.6.2
#> Carregando pacotes exigidos: zoo
#> Warning: package 'zoo' was built under R version 3.6.2
#> 
#> Attaching package: 'zoo'
#> The following object is masked from 'package:tsibble':
#> 
#>     index
#> The following objects are masked from 'package:base':
#> 
#>     as.Date, as.Date.numeric
#> 
#> Attaching package: 'xts'
#> The following objects are masked from 'package:dplyr':
#> 
#>     first, last
#> 
#> Attaching package: 'PerformanceAnalytics'
#> The following object is masked from 'package:graphics':
#> 
#>     legend
#> Carregando pacotes exigidos: quantmod
#> Warning: package 'quantmod' was built under R version 3.6.2
#> Carregando pacotes exigidos: TTR
#> Warning: package 'TTR' was built under R version 3.6.2
#> Registered S3 method overwritten by 'quantmod':
#>   method            from
#>   as.zoo.data.frame zoo
#> Version 0.4-0 included new data defaults. See ?getSymbols.
#> ══ Need to Learn tidyquant? ════════════════════════════════════════════════════
#> Business Science offers a 1-hour course - Learning Lab #9: Performance Analysis & Portfolio Optimization with tidyquant!
#> </> Learn more at: https://university.business-science.io/p/learning-labs-pro </>
library(imputeTS)
#> Warning: package 'imputeTS' was built under R version 3.6.2
#> 
#> Attaching package: 'imputeTS'
#> The following object is masked from 'package:zoo':
#> 
#>     na.locf
library(feasts)
#> Warning: package 'feasts' was built under R version 3.6.2
#> Carregando pacotes exigidos: fabletools
#> Warning: package 'fabletools' was built under R version 3.6.2
library(fable)
#> Warning: package 'fable' was built under R version 3.6.2
#> 
#> Attaching package: 'fable'
#> The following object is masked from 'package:tidyquant':
#> 
#>     VAR



iniciativa <- tibble(
    data_planejada = sample(seq(as.Date("2020-01-01"), length=40, by="week"), size=40),
    n = sample(seq(40), size=40)
) %>% as_tsibble()
#> Using `data_planejada` as index variable.


train <- iniciativa %>% 
    filter_index("2020-08-05")


arima_fit <- train %>%  
    model(
        arima = ARIMA(n))


arima_fit %>%
    # Apply to all data up to 9 July 2020 without re-estimating parameters
    refit(new_data = iniciativa) %>%
    # Forecast to end of August 2020
    forecast(
        new_data=tsibble(data_planejada = seq(as.Date("2020-08-06"),
                                    to = as.Date("2020-12-25"),
                                    by = "week"),
                         index=data_planejada))
#> # A fable: 21 x 4 [7D]
#> # Key:     .model [1]
#>    .model data_planejada          n .mean
#>    <chr>  <date>             <dist> <dbl>
#>  1 arima  2020-08-06     N(20, 137)  20.5
#>  2 arima  2020-08-13     N(20, 137)  20.5
#>  3 arima  2020-08-20     N(20, 137)  20.5
#>  4 arima  2020-08-27     N(20, 137)  20.5
#>  5 arima  2020-09-03     N(20, 137)  20.5
#>  6 arima  2020-09-10     N(20, 137)  20.5
#>  7 arima  2020-09-17     N(20, 137)  20.5
#>  8 arima  2020-09-24     N(20, 137)  20.5
#>  9 arima  2020-10-01     N(20, 137)  20.5
#> 10 arima  2020-10-08     N(20, 137)  20.5
#> # … with 11 more rows

Created on 2020-11-16 by the reprex package (v0.3.0)

Any help would be appreciated,

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.