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

ets() print method splits the call object representation #956

Closed
cgiachalis opened this issue Apr 17, 2024 · 1 comment
Closed

ets() print method splits the call object representation #956

cgiachalis opened this issue Apr 17, 2024 · 1 comment

Comments

@cgiachalis
Copy link

Notice the Call: when printing the ets object.

fit <- forecast::ets(USAccDeaths, damped = TRUE, additive.only = FALSE,  model = "ZZZ", opt.crit = "lik", ic = "aicc")

fit
#> ETS(M,Ad,M) 
#> 
#> Call:
#>  forecast::ets(y = USAccDeaths, model = "ZZZ", damped = TRUE,   <-------HERE
#> 
#>  Call:
#>      additive.only = FALSE, opt.crit = "lik", ic = "aicc")   <-------HERE
#> 
#>   Smoothing parameters:
#>     alpha = 0.4912 
#>     beta  = 0.0069 
#>     gamma = 1e-04 
#>     phi   = 0.9757 
#> 
#>   Initial states:
#>     l = 9957.0912 
#>     b = -51.0211 
#>     s = 0.9981 0.9707 1.0266 0.9919 1.1116 1.1912
#>            1.0897 1.0388 0.9384 0.9123 0.8233 0.9074
#> 
#>   sigma:  0.0331
#> 
#>      AIC     AICc      BIC 
#> 1140.126 1153.031 1181.106

This is due to this code line

forecast/R/ets.R

Line 1104 in e565f31

cat(paste("Call:\n", deparse(x$call), "\n\n"))

An one-liner fix would be:

cat("Call:", deparse(fit$call), sep = "\n")
#> Call:
#> forecast::ets(y = USAccDeaths, model = "ZZZ", damped = TRUE, 
#>     additive.only = FALSE, opt.crit = "lik", ic = "aicc")

Other objects don't have this issue as they're both concatenating and printing:

forecast/R/bats.R

Lines 359 to 360 in e565f31

cat("\nCall: ")
print(x$call)

@robjhyndman
Copy link
Owner

Thanks. Fixed in 1f537eb

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

2 participants