File: summary_stats_sampler.R

package info (click to toggle)
r-cran-shinystan 2.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 3,172 kB
  • sloc: sh: 15; makefile: 7
file content (35 lines) | stat: -rw-r--r-- 931 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# summary statistics for sampler parameters -------------------------------
summary_stats_sampler <- reactive({
  validate(
    need(STAN_ALGORITHM %in% c("NUTS", "HMC"), message = "Only available for algorithm = NUTS or HMC"),
    need(input$sampler_warmup, message = "Loading...")
  )
  sp <- if (input$sampler_warmup == "include")
    SAMPLER_PARAMS else SAMPLER_PARAMS_post_warmup
  
  do.call(
    ".sampler_summary",
    args = list(
      sampler_params  = sp,
      warmup_val      = N_WARMUP,
      report          = input$sampler_report,
      digits          = input$sampler_digits
    )
  )
})

output$sampler_summary <- DT::renderDataTable({
  DT::datatable({
    summary_stats_sampler()
  }, options = list(
    # rownames = FALSE,
    processing = TRUE,
    deferRender = TRUE,
    scrollX = TRUE,
    scrollY = "200px",
    scrollCollapse = TRUE,
    paging = FALSE,
    searching = FALSE,
    info = FALSE
  ))
})