View source: R/distance_all_pairwise.R
| distance_all_pairwise | R Documentation |
computing all within and between facet distances between quantile categories given quantile data
distance_all_pairwise( sim_panel_quantiles, quantile_prob = seq(0.01, 0.99, 0.01), dist_ordered = TRUE, lambda = 0.67 )
sim_panel_quantiles |
quantile data |
quantile_prob |
numeric vector of probabilities with value #'in [0,1] whose sample quantiles are wanted. Default is set to #' "decile" plot |
dist_ordered |
if categories are ordered |
lambda |
value of tuning parameter for computing weighted pairwise distances |
within and between facet distances
Sayani07
library(dplyr)
library(parallel)
library(ggplot2)
library(distributional)
library(tidyr)
sim_panel_data <- sim_panel(
nx = 2,
nfacet = 3,
ntimes = 5,
sim_dist = distributional
::dist_normal(5, 10)
) %>% tidyr::unnest(c(data))
sim_panel_quantiles <-
compute_quantiles(sim_panel_data)
distance_all_pairwise(sim_panel_quantiles, lambda = 0.5)
dist_data <- distance_all_pairwise(sim_panel_quantiles, lambda = 0.7)
# Plot raw distances
ggplot(dist_data, aes(x = 1:9, y = value, colour = dist_type)) +
geom_line() +
geom_point()
# Plot transformed distances
ggplot(dist_data, aes(
x = 1:9, y = trans_value, colour =
dist_type
)) +
geom_line() +
geom_point()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.