Creating fts object in R

后端 未结 1 1097
渐次进展
渐次进展 2021-01-25 07:02

I\'m aware that this question already exists here: Creating an fts object in R with ftsa to functional data analysis of a time series

but reproducible example and answer

相关标签:
1条回答
  • 2021-01-25 07:24

    There are different packages that define a class "fts" and you are using the wrong one.

    library(ftsa)
    
    #see the link in the documentation for the correct constructor
    fts1 <- rainbow::fts(x = data$date, y = as.matrix(data[,-1]))
    
    #apparently colnames must be numbers of the given frequency
    #this appears to be at least an documentation bug
    #but I know nothing about this kind of analysis
    colnames(fts1$y) <- seq_along(colnames(fts1$y))
    
    ftsm(fts1, order=3)
    #Functional time series model
    #
    #Call: ftsm(y = fts1, order = 3) 
    #
    #Main effects: Mean 
    #Order of interaction: 3
    #   y: as.matrix(data[, -1]) 
    #   x: data$date 
    
    0 讨论(0)
提交回复
热议问题