Skip to content
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

Problems with na.action #295

Open
christophsax opened this issue Sep 25, 2022 · 0 comments
Open

Problems with na.action #295

christophsax opened this issue Sep 25, 2022 · 0 comments

Comments

@christophsax
Copy link
Owner

christophsax commented Sep 25, 2022

Via email from Jens:

I wanted to highlight two issues I found, however, with the seasonal package for your kind consideration – that is, in relation to the rarely used argument na.action.

  • If one uses na.action = na.exclude or na.action = na.x13 and update() is invoked, either directly, or through running predict() with the newdata argument or e.g., calling out(), na.action defaults back to na.omit. You can see this in the attached code in line 21, where there are no NA in the final series and, even worse, in lines 28 and 29, where the updated adjustment no longer handles NA by substituting them with -99999.

  • If one uses na.action = na.exclude and returns output with series(), there is no NA action handled, unlike in predict() or final() with extract_w_na_action() – see line 20. I have to admit, though, that it is not clear to me either what actually should be reported back here for instance when seats.appendfcst = "yes" is applied. In fact, doing so leads to predict() and final() crashing. Note that series() and output after update() do not crash only because of 1. Maybe this combination of options should be disallowed?

I hope this helps.

library(seasonal)

AirPassengersNA <- window(AirPassengers, end = 1962, extend = TRUE)

seas.omit <- seas(AirPassengersNA, na.action = na.omit)
seas.exclude <- seas(AirPassengersNA, na.action = na.exclude) # seats.appendfcst = "yes"
# AirPassengersNA[20] <- NA # not run for comparability
seas.x13 <- seas(AirPassengersNA, na.action = na.x13)

# na.omit
final(seas.omit) # NA omitted
predict(seas.omit) # calls final()
series(seas.omit, 's11') # no NA handler - not needed
predict(seas.omit, AirPassengersNA) # newdata to invoke update()
out(seas.omit) # invokes update()

# na.exclude
final(seas.exclude) # with NA handler: extract_w_na_action()
predict(seas.exclude) # calls final()
series(seas.exclude, 's11') # no NA handler - inconsistent
predict(seas.exclude, AirPassengersNA) # newdata to invoke update()
out(seas.exclude) # invokes update()

# na.x13
final(seas.x13) # no NA
predict(seas.x13) # calls final()
series(seas.x13, 's11') # no NA handler - not needed
predict(seas.x13, AirPassengersNA) # newdata to invoke update()
out(seas.x13) # invokes update()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant