Description Usage Arguments Value Author(s) Examples
View source: R/distance_all_pairwise.R
computing all within and between facet distances between quantile categories given quantile data
1 2 3 4 5 6 | 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | library(tidyverse)
library(gravitas)
library(parallel)
library(ggplot2)
library(distributional)
sim_panel_data <- sim_panel(
nx = 2,
nfacet = 3,
ntimes = 5,
sim_dist = distributional
::dist_normal(5, 10)
) %>%
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.