View source: R/summarizePhases.R
summarizePhases | R Documentation |
Takes a phase list and obtains a tidy table of point estimates of relevant parameters,
summarizePhases(phaselist)
phaselist |
a phase list (output of |
table of start and end times and point estimates of relevant parameters for each phase
library(smoove) library(magrittr) data(simSweep, package="smoove") simCP.table <- simSweep %>% findCandidateChangePoints(clusterwidth = 4, verbose = FALSE) %>% getCPtable(modelset = c("UCVM", "ACVM"), criterion = "AIC") simPhaselist <- estimatePhases(simCP.table) Z <- attributes(simPhaselist)$Z T <- attributes(simPhaselist)$time if (requireNamespace('gplots', quietly = TRUE)) warning("package \"gplots\" is needed for this example. Please install it first and then run this example", call. = FALSE) cols <- gplots::rich.colors(length(simPhaselist)) T.cuts <- c(T[1], simCP.table$CP, T[length(T)]) Z.cols <- cols[cut(T, T.cuts, include.lowest = TRUE)] phaseTable <- summarizePhases(simPhaselist) plot(Z, asp=1, type="l", xpd=FALSE) points(Z, col=Z.cols, pch=21, bg = scales::alpha(Z.cols, 0.5), cex=0.8) legend("top", legend = paste0(phaseTable$phase, ": ", phaseTable$model), fill=cols, ncol=3, bty="n", title = "Phase: model")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.