Description Usage Arguments Value Examples
Coefficients of a power-law transformed combined distribution
1 2 3 4 5 6 7 8 9 | combdist_plt(
dist,
prior = NULL,
coeff,
a = 1,
b = 1,
inv = FALSE,
nested = FALSE
)
|
dist |
character vector denoting the distribution(s). |
prior |
Numeric vector of prior coefficients, defaults to single vector with value one. |
coeff |
list of parameters for the distribution(s). |
a, b |
constant and power of power-law transformation, defaults to 1 and 1 respectively. |
inv |
logical indicating whether coefficients of the outcome variable of the power-law transformation should be returned (FALSE) or whether coefficients of the input variable being power-law transformed should be returned (TRUE). Defaults to FALSE. |
nested |
logical indicating whether results should be returned in a nested list or flat list, defaults to FALSE. |
Returns a nested or flat list containing
Named vector of coefficients
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | # 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))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.