【问题标题】:R shiny forecasting ARMAR闪亮预测ARMA
【发布时间】:2017-10-18 12:46:21
【问题描述】:

我想学习 ARMA 预测,我正在尝试使用从比特币下载的比特币数据集进行预测

我正在为以下代码苦苦挣扎。 图书馆(Quandl)

 library(forecast)
    library(tseries)
    library(shiny)


    ui <- shinyUI(fluidPage(
      titlePanel("Simple ARMA Bitcoin Forecasting"),
      sidebarLayout(
         sidebarPanel("Please choose the number of periods",
                     numericInput("num",h3("Numeric input"), value = 1)),

      mainPanel(plotOutput("plot")))
    )
    )

    server <- shinyServer(function(input,output) {

      output$plot <- plotOutput({

        bitcoin <- Quandl("BITSTAMP/USD",type = "xts")

        bitcoin_price <- bitcoin[,3]

        barplottest <- diff(log(bitcoin_price))

        fit <- auto.arima(dataInput)

        fit %>% forecast(h="input$num") %>% autoplot()
          })

    })

    shinyApp(ui,server)

这是我收到的错误:

 Warning: Error in as.ts: object 'dataInput' not found
Stack trace (innermost first):
    44: as.ts
    43: auto.arima
    42: imageOutput [#11]
    41: plotOutput
    40: server [#3]
     4: <Anonymous>
     3: do.call
     2: print.shiny.appobj
     1: <Promise>
Error in as.ts(x) : object 'dataInput' not found

【问题讨论】:

    标签: shiny arima


    【解决方案1】:

    我不确定dataInput 是什么

    这是highcharter 包的示例:

    library(shiny)
    library(Quandl)
    library(forecast)
    library(highcharter)
    
    bitcoin <- Quandl("BITSTAMP/USD",type = "xts")
    bitcoin_price <- bitcoin[,3]
    barplottest <- diff(log(bitcoin_price))
    fit <- auto.arima(barplottest )
    
    ui <- shinyUI(fluidPage(
      titlePanel("Simple ARMA Bitcoin Forecasting"),
      sidebarLayout(
        sidebarPanel("Please choose the number of periods",
                     numericInput("num",h3("Numeric input"), value = 1)),
    
        mainPanel(highchartOutput("hcontainer",height = "500px")))
    )
    )
    
    server <- shinyServer(function(input,output) {
    
      output$hcontainer <- renderHighchart({
        hchart(forecast(fit,h=input$num))
      })
    })
    
    shinyApp(ui,server)
    

    【讨论】:

    • 有没有办法在图表下方显示日期而不是观察次数?
    • 您需要确保您的数据集barplottest 是一个时间序列对象
    猜你喜欢
    • 2017-04-04
    • 2018-06-23
    • 1970-01-01
    • 2021-08-16
    • 1970-01-01
    • 1970-01-01
    • 2015-12-24
    • 1970-01-01
    • 2017-10-13
    相关资源
    最近更新 更多