library(knitr)
library(plotly)
library(DT)

Single-chain diagnostics

results <- params$input
chains <- params$chain.names

# This bit seems weird but what it's actually doing is
# dynamically generating headers for each chain.  The
# arrangement of spaces and newlines is touchy as hell
# so don't mess with it unless you've got a super good reason

template <- "
## %s


" # dont't forget the newline

for (i in chains) {
  cat(sprintf(template, i))
  thisplot <- results[[paste0(i, ".correlations")]]
  print(thisplot)
  cat("\n\n")
}



Multi-chain diagnostics

Likelihood

ggplotly(results$LnL.trace$trace.plot)



ggplotly(results$LnL.trace$density.plot)



Topology

Distance from reference tree

ggplotly(results$topology.trace.plot$trace.plot)



ggplotly(results$topology.trace.plot$density.plot)



Autocorrelation

ggplotly(results$autocorr.plot)



Split frequencies

ggplotly(results$splitfreqs.sliding.plot)



ggplotly(results$acsf.sliding.plot)



ggplotly(results$splitfreqs.cumulative.plot)



ggplotly(results$acsf.cumulative.plot)



Agreement between chains

ggplotly(results$splitfreq.matrix)



ggplotly(results$asdsf.plot)



print(results$asdsf.tree)



Treespace plots

ggplotly(results$treespace.heatmap)



ggplotly(results$treespace.points.plot)



Parameters

# Here we're going to create a subheading for each parameter
# that has a trace plot associated with it

# Get names of all "trace" plots
traces <- names(results)[grep(names(results), pattern = "trace")]

# Take out just the ones that aren't already plotted elsewhere
traces <- traces[which(!traces %in% c("LnL.trace", "topology.trace.plot"))]

# As above, this bit is super touchy so don't mess with it
# unless you have a compelling reason and several hours to kill

template <- "
### %s


" # dont't forget the newline

for (i in traces) {
  shortname <- sub(i, pattern = ".trace$", replacement = "", perl = TRUE)
  cat(sprintf(template, shortname))
  trace.plot <- results[[i]]
  print(trace.plot$trace.plot)
  print(trace.plot$density.plot)
  cat("\n\n")
}



ESS table

datatable(results$ess.table, extensions = 'Buttons',
            options = list(dom = 'Blfrtip',
                           buttons = c('copy', 'csv', 
                                       'excel', 'pdf', 'print'),
                           lengthMenu = list(c(10,25,50,-1),
                                             c(10,25,50,"All"))))


danlwarren/RWTY documentation built on Sept. 5, 2021, 8:35 p.m.