plot_arc_var.Rd
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)
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
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)#> Error in generate_arc(arc_coord = list(c(5, 0), c(-10, 15), c(-30, -20)), mean = 0, sd = 1, N_dim = 2): unused argument (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)#> Error in fit_pch(data = data[data_dim, ], noc = k, ..., check_installed = FALSE, var_in_dims = var_in_dims, normalise_var = normalise_var): unused argument (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()#> Error in is(arc_data, "pch_fit"): object 'arc_data' not found# 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()#> Error in is(arc_data, "k_pch_fit"): object 'arc_data' not found