combdist_plt {distributionsrd} | R Documentation |
Combined coefficients of power-law transformed combined distribution
Description
Coefficients of a power-law transformed combined distribution
Usage
combdist_plt(
dist,
prior = NULL,
coeff,
a = 1,
b = 1,
inv = FALSE,
nested = FALSE
)
Arguments
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. |
Value
Returns a nested or flat list containing
- coefficients
Named vector of coefficients
Examples
# 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))
[Package distributionsrd version 0.0.6 Index]