smooth
smooth copied to clipboard
no applicable method for 'smoothType' applied to an object of class "c('adam', 'smooth')"
When I run the example code from smoothCombine() i get the following error:
models <- list(es(BJsales), sma(BJsales)) smoothCombine(BJsales,models=models) Error in UseMethod("smoothType") : no applicable method for 'smoothType' applied to an object of class "c('adam', 'smooth')"
traceback() 4: FUN(X[[i]], ...) 3: lapply(models, smoothType) 2: unlist(lapply(models, smoothType)) 1: smoothCombine(BJsales, models = models)
I also get this error with my own data when i call smoothCombine() I tried detaching/removing and reinstalling the smooth package from CRAN but still the error persists.
I am on linux with R 4.3 and:
library(smooth) This is package "smooth", v3.2.0
If i look in the code for smoothCombine() there is a reference to a variable "smoothType" (on line 99) but it is never set:
if (is.null(names(models))) {
names(models) <- unlist(lapply(models, smoothType))
}
And i can confirm that there are no names in the models object:
models <- list(es(BJsales), sma(BJsales)) names(models) NULL
So if i run this code snippet manually i get the same error:
unlist(lapply(models, smoothType)) Error: object 'smoothType' not found
What should smoothType be? Do i have to set it manually before calling smoothCombine()?
Making the models named parameters does solve the smoothType error but throws another error:
models <- list(es=es(BJsales), sma=sma(BJsales)) smoothCombine(BJsales,models=models) Error in match.arg(interval[1], c("none", "simulated", "approximate", : 'arg' must be NULL or a character vector
traceback() 6: stop("'arg' must be NULL or a character vector") 5: match.arg(interval[1], c("none", "simulated", "approximate", "semiparametric", "nonparametric", "confidence", "parametric", "prediction", "empirical", "complete")) 4: forecast.adam(X[[i]], ...) 3: FUN(X[[i]], ...) 2: lapply(models, forecast, h = h, interval = interval, level = 0, holdout = holdout, cumulative = cumulative, xreg = xreg) 1: smoothCombine(BJsales, models = models)