in Education by
I am using the packages "fpp" and "fpp2". The homework question (question 11(f)) is located at https://otexts.org/fpp2/expsmooth-exercises.html I've tried to run the following code for tsCV on the ETS model (the same results occur for other models as stated in 11(d)): convert visitors to time series tvis <- ts(visitors) run tsCV on tvis e2 <- tsCV(tvis, forecast(ets(tvis),h=24), h=24) However, when I run e2, all I get are NA values. [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [1,] NA NA NA NA NA NA NA NA NA NA NA NA NA [2,] NA NA NA NA NA NA NA NA NA NA NA NA NA [3,] NA NA NA NA NA NA NA NA NA NA NA NA NA Why is this so? It works if I used another forecast function instead (e.g. rwf): e2 <- tsCV(tvis, rwf, h=24) Thanks in advance. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
The key word is "function": for its second argument, tsCV expect a function that returns a forecast, not actually a forecast. Try this: f <- function(y, h) forecast(ets(y), h = h) e2 <- tsCV(tvis, f, h)

Related questions

0 votes
    What is the function used to test objects (returns a logical operator) if they are NA? (a) is.na() ... Started of R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    How to replace the values of NA with zeros in some column and data frame I have? Select the correct answer from above options...
asked Jan 20, 2022 in Education by JackTerrance
0 votes
    What will be the class of the vector if you concatenate a number and NA? (a) Number (b) Character (c ... and Debugging of R Programming Select the correct answer from above options...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    system.time function returns an object of class _______ which contains two useful bits of information. (a) ... of R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    The _________ function returns a list of densities (y) corresponding to bin values (x). (a) Spline (b) ... Out of R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    If the function in a console is.matrix(X) returns true then X can be considered as a _______ (a) Matrix ... Debugging of R Programming Select the correct answer from above options...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    What is the function used to test objects (returns a logical operator) if they are NaN? (a) as.nan() ... Started of R Programming Select the correct answer from above options...
asked Feb 12, 2022 in Education by JackTerrance
0 votes
    Is it possible to change the default values of formal parameters in an R function at runtime? Let's assume, we have the function f...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    Which function helps you perform sorting in R language? (a) Order (b) Inorder (c) Simple (d) Library ... Debugging of R Programming Select the correct answer from above options...
asked Feb 16, 2022 in Education by JackTerrance
0 votes
    ______________ function will measure the probability of the binary response variable in R language. (a) Glm() (b) ... of R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    You can check to see whether an R object is NULL with the _________ function. (a) is.null() (b) is. ... and Debugging of R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    ________ function can be used to add datasets in R provided with the columns in the datasets should be the same ... of R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    Individual R objects can be saved to a file using the _____ function. (a) save (b) put (c) save_image ... Operations of R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    The benefit of the _____ function is that it is the only way to perfectly repressed an R object in an ... Operations of R Programming Select the correct answer from above options...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    Which function is used to create a histogram for visualisation in R programming language? (a) Library (b) Hist ... of R Programming Select the correct answer from above options...
asked Feb 13, 2022 in Education by JackTerrance
...