Closed davidtedfordholt closed 4 years ago
Thanks for this, sounds like a bug as the xreg() special should be available for calling directly if it is defined in the list of specials. I will do some testing of this tonight.
On Tue., 25 Feb. 2020, 14:07 David, notifications@github.com wrote:
The xreg special can be called implicitly using a variable name, but cannot be called explicitly. Because of this, the additional arguments for xreg (type, prior_scale and standardize) are unavailable, as best I can tell.
I only discovered this because I can't get it to work in fable.bsts https://github.com/davidtedfordholt/fable.bsts/issues/4. I'm not sure if this is about the specific implementation in fable.prophet or the general implementation in fabletools.
library(tsibbledata) library(tsibble) library(fable.prophet) library(dplyr) data <- vic_elec %>% index_by(Date) %>% summarise(Demand = sum(Demand), Temperature = mean(Temperature))
model(data, prophet = prophet(Demand ~ Temperature)) model(data, prophet = prophet(Demand ~ xreg(Temperature, prior_scale = .1)))
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mitchelloharawild/fable.prophet/issues/19?email_source=notifications&email_token=AD3BJF5YG6IU36J3DC2LRX3RESRSJA5CNFSM4K24YSZKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IP6KI3Q, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD3BJF5PLKHMCEZ3FW2KT63RESRSJANCNFSM4K24YSZA .
I can confirm that this was not working as it should in fable.prophet
, and that it should work as you expect now (https://github.com/tidyverts/fabletools/commit/8b93a03a104948daee1a7e73b9cd887091bb0558). This change will be included in the next release.
Thank you! If the next release will be a little bit, I'll go ahead and work on fable.bsts
using a github-installed fabletools
.
The next release will coincide with the release of dplyr 1.0.0, so ~1-2 months. I recommend pulling from the fabletools@xreg branch which is closest to the CRAN version (with only this fix).
Will do, and thanks again. If you need help at any point with the extension vignette, @bradisbrad and I are happy to help. If we get to a point where we can do it, anyone can.
Closing as this has been fixed in the latest {fabletools} CRAN release.
library(tsibbledata)
#> Warning: package 'tsibbledata' was built under R version 3.6.3
library(tsibble)
library(fable.prophet)
#> Loading required package: Rcpp
#> Loading required package: fabletools
library(dplyr)
#>
#> 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
data <- vic_elec %>%
index_by(Date) %>%
summarise(Demand = sum(Demand), Temperature = mean(Temperature))
model(data, prophet = prophet(Demand ~ Temperature))
#> # A mable: 1 x 1
#> prophet
#> <model>
#> 1 <prophet>
model(data, prophet = prophet(Demand ~ xreg(Temperature, prior_scale = .1)))
#> # A mable: 1 x 1
#> prophet
#> <model>
#> 1 <prophet>
Created on 2020-07-16 by the reprex package (v0.3.0)
The
xreg
special can be called implicitly using a variable name, but cannot be called explicitly. Because of this, the additional arguments forxreg
(type
,prior_scale
andstandardize
) are unavailable, as best I can tell.I only discovered this because I can't get it to work in fable.bsts. I'm not sure if this is about the specific implementation in
fable.prophet
or the general implementation infabletools
.