Description Usage Arguments Value Author(s) See Also Examples
plot_arc_var()
shows variance in positions (total_var), t-ratios, SSE and variance explained (cumulative - varexpl, each vertex - res_varexpl) by polytope models with different number of vertices (k)
1 2 3 | plot_arc_var(arc_data, type = c("varexpl", "SSE", "res_varexpl",
"total_var", "t_ratio", "dim")[1], point_size = 2, line_size = 1.5,
reorder = FALSE)
|
arc_data |
object of class "k_pch_fit", storing the position of vertices of best fit polytopes with different k, and other data from |
type |
which measure to plot as a function of k, one of "varexpl", "SSE", "res_varexpl", "total_var", "t_ratio, "dim". Use dim to plot variance in position in each dimension. |
line_size |
width of lines connecting archetypes |
reorder |
reorder dimensions based on variance in position (type = "dim). |
arch_size |
size of archetype point |
plot_arc_var()
ggplot2 (2D) plot
Vitalii Kleshchevnikov
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | library(ParetoTI)
library(ggplot2)
# Random data that fits into the triangle (2D)
set.seed(4355)
archetypes = generate_arc(arc_coord = list(c(5, 0), c(-10, 15), c(-30, -20)),
mean = 0, sd = 1, N_dim = 2)
data = generate_data(archetypes$XC, N_examples = 1e4, jiiter = 0.04, size = 0.9)
arc_data = k_fit_pch(data, ks = 1:4, check_installed = T, delta=0.1, order_by_side = F)
# Show polytopes and the data
plot_arc(arc_data = arc_data, data = data,
which_dimensions = 1:2, type = "all", arch_size = 2,
colors = c("#D62728", "#1F77B4", "#2CA02C", "#17BED0", "grey")) +
theme_bw()
# Show variance explained by a polytope with each k
plot_arc_var(arc_data, type = c("varexpl", "SSE", "res_varexpl")[1],
point_size = 2, line_size = 1.5) + theme_bw()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.