-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add check_residuals() function #105
Comments
Or maybe this should be called |
Certainly possible, this would also require models to add the dof to the glance output or similar (much like I think the interface needs more thought to ensure that a consistent and general interface is preserved throughout the package.
|
Adding dof to the glance output seems like a good idea in any case. |
This would be great for mables where each model has a different dof. |
I've now added (experimentally) library(fpp3)
tourism %>%
model(TSLM(Trips ~ trend() + season())) %>%
hypothesize(tests = lst(breusch_godfrey), order = 24)
#> # A tibble: 304 x 9
#> Region State Purpose .model .test statistic order null_dist p.value
#> <chr> <chr> <chr> <chr> <chr> <dbl> <int> <dist> <dbl>
#> 1 Adelaide South A… Busine… TSLM(Trip… breus… 23.3 24 ᵪ²(24) 0.500
#> 2 Adelaide South A… Holiday TSLM(Trip… breus… 26.1 24 ᵪ²(24) 0.346
#> 3 Adelaide South A… Other TSLM(Trip… breus… 34.7 24 ᵪ²(24) 0.0732
#> 4 Adelaide South A… Visiti… TSLM(Trip… breus… 29.7 24 ᵪ²(24) 0.194
#> 5 Adelaid… South A… Busine… TSLM(Trip… breus… 24.8 24 ᵪ²(24) 0.414
#> 6 Adelaid… South A… Holiday TSLM(Trip… breus… 24.1 24 ᵪ²(24) 0.458
#> 7 Adelaid… South A… Other TSLM(Trip… breus… 25.5 24 ᵪ²(24) 0.377
#> 8 Adelaid… South A… Visiti… TSLM(Trip… breus… 12.1 24 ᵪ²(24) 0.979
#> 9 Alice S… Norther… Busine… TSLM(Trip… breus… 26.5 24 ᵪ²(24) 0.327
#> 10 Alice S… Norther… Holiday TSLM(Trip… breus… 30.7 24 ᵪ²(24) 0.163
#> # … with 294 more rows Created on 2021-04-08 by the reprex package (v1.0.0) I do think that it should be easy to compute both Ljung-Box and Breusch-Godfrey tests on regression models, and at most it should hint toward Breusch-Godfrey for regression models in the documentation. |
Thanks, that looks great. I assume we'll also need new Ljung-Box and Breusch-Godfrey methods for ARIMA that can pick up the dof from each model? |
Ljung-Box and Box-Pierce tests will be written to work with any model that makes the degrees of freedom available. This will be the next one to add, however it will require some migration of |
@mitchelloharawild I've updated my fabletools package and am unable to run the breusch_godfrey on my TSLM. remotes::install_github("tidyverts/fabletools")
I've tried: and: Any guidance would be appreciated. |
Looks like you haven't yet loaded the development version. Try restarting R to unload the CRAN version of fabletools so that next time you load the |
Thank you. I'd loaded but not restarted. This code works:
But this one doesn't...
Could you confirm that I've correctly used the hypothesize option given that my model is a regression not an ARIMA? |
Yes, the first code snippet is the current interface for running the test. |
An alternative generic function is needed for computing values from distributions, such as Newey-West (tidyverts/fable#332). The function could/would act very similarly to what we have described here. |
Essentially a wrapper to
The text was updated successfully, but these errors were encountered: