# NOT RUN {
# }
# NOT RUN {
# Load necessary tools
data("fit_US_cities")
library(tidyverse)
## Comparing probabilites of power-law transformed transformed variables
prob <- fit_US_cities %>%
filter(!(dist %in% c(
"exp", "invpareto_exp_pareto", "exp_pareto", "invpareto_exp",
"gamma", "invpareto_gamma_pareto", "gamma_pareto", "invpareto_gamma"
))) %>%
group_by(dist, components, np, n) %>%
do(prob = pcombdist(q = 1.1, dist = .[["dist"]], prior = .[["prior"]][[1]],
coeff = .[["coefficients"]][[1]])) %>%
unnest(cols = c(prob))
fit_US_cities_plt <- fit_US_cities %>%
filter(!(dist %in% c(
"exp", "invpareto_exp_pareto", "exp_pareto", "invpareto_exp",
"gamma", "invpareto_gamma_pareto", "gamma_pareto", "invpareto_gamma"
))) %>%
group_by(dist, components, np, n, convergence) %>%
do(results = as_tibble(combdist_plt(dist = .[["dist"]], prior = .[["prior"]][[1]],
coeff = .[["coefficients"]][[1]], a = 2, b = 0.5, nested = TRUE))) %>%
unnest(cols = c(results))
prob$prob_plt <- fit_US_cities_plt %>%
group_by(dist, components, np, n) %>%
do(prob_plt = pcombdist(q = 2 * 1.1^0.5, dist = .[["dist"]], prior = .[["prior"]][[1]],
coeff = .[["coefficients"]][[1]])) %>%
unnest(cols = c(prob_plt)) %>%
.$prob_plt
prob <- prob %>%
mutate(check = abs(prob - prob_plt))
prob <- fit_US_cities %>%
filter(!(dist %in% c(
"exp", "invpareto_exp_pareto", "exp_pareto", "invpareto_exp",
"gamma", "invpareto_gamma_pareto", "gamma_pareto", "invpareto_gamma"
))) %>%
group_by(dist, components, np, n) %>%
do(prob = pcombdist(q = 2 * 1.1^0.5, dist = .[["dist"]], prior = .[["prior"]][[1]],
coeff = .[["coefficients"]][[1]])) %>%
unnest(cols = c(prob))
fit_US_cities_plt <- fit_US_cities %>%
filter(!(dist %in% c(
"exp", "invpareto_exp_pareto", "exp_pareto", "invpareto_exp",
"gamma", "invpareto_gamma_pareto", "gamma_pareto", "invpareto_gamma"
))) %>%
group_by(dist, components, np, n, convergence) %>%
do(results = as_tibble(combdist_plt(dist = .[["dist"]], prior = .[["prior"]][[1]],
coeff = .[["coefficients"]][[1]], a = 2, b = 0.5, nested = TRUE, inv = TRUE))) %>%
unnest(cols = c(results))
prob$prob_plt <- fit_US_cities_plt %>%
group_by(dist, components, np, n) %>%
do(prob_plt = pcombdist(q = 1.1, dist = .[["dist"]], prior = .[["prior"]][[1]],
coeff = .[["coefficients"]][[1]])) %>%
unnest(cols = c(prob_plt)) %>%
.$prob_plt
prob <- prob %>%
mutate(check = abs(prob - prob_plt))
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab