Skip to content

Commit

Permalink
updates for CRAN
Browse files Browse the repository at this point in the history
Fixes #169
Fixes #170
  • Loading branch information
spsanderson committed May 5, 2022
1 parent 27d1b95 commit 61e52b0
Show file tree
Hide file tree
Showing 37 changed files with 64 additions and 36 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ will no produce the correct probability chart from the auto plot functions.
output of `tidy_multi_single_dist()`
6. Fix #166 - Change in all plotting functions `ggplot2::xlim(0, max_dy)` to
`ggplot2::ylim(0, max_dy)`
7. Fix #169 - Fix the computation of the `q` column
8. Fix #170 - Fix the graphing of the quantile chart due to #169

# TidyDensity 1.0.1

Expand Down
12 changes: 11 additions & 1 deletion R/autoplot-combined-dist.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,21 @@ tidy_combined_autoplot <- function(.data, .plot_type = "density", .line_size = .
) +
ggplot2::theme(legend.position = leg_pos)
} else if (plot_type == "quantile") {
## EDIT
data_tbl <- data_tbl %>%
dplyr::select(sim_number, dist_type, q) %>%
dplyr::group_by(sim_number, dist_type) %>%
dplyr::arrange(q) %>%
dplyr::mutate(x = 1:dplyr::n() %>%
tidy_scale_zero_one_vec()) %>%
dplyr::ungroup()
## End EDIT
plt <- data_tbl %>%
dplyr::filter(q > -Inf, q < Inf) %>%
ggplot2::ggplot(
ggplot2::aes(
x = tidy_scale_zero_one_vec(dx),
#x = tidy_scale_zero_one_vec(dx),
x = x,
y = tidy_scale_zero_one_vec(q),
group = interaction(dist_type, sim_number),
color = dist_type
Expand Down
10 changes: 9 additions & 1 deletion R/autoplot-density.R
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,18 @@ tidy_autoplot <- function(.data, .plot_type = "density", .line_size = .5,
) +
ggplot2::theme(legend.position = leg_pos)
} else if (plot_type == "quantile") {
## EDIT
data_tbl <- data_tbl %>%
dplyr::select(sim_number, q) %>%
dplyr::group_by(sim_number) %>%
dplyr::arrange(q) %>%
dplyr::mutate(x = 1:dplyr::n()) %>%
dplyr::ungroup()
## End EDIT
plt <- data_tbl %>%
ggplot2::ggplot(
ggplot2::aes(
x = qs, y = q, group = sim_number, color = sim_number
x = x, y = q, group = sim_number, color = sim_number
)
) +
ggplot2::geom_line(size = line_size) +
Expand Down
10 changes: 9 additions & 1 deletion R/autoplot-multi-dist.R
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,18 @@ tidy_multi_dist_autoplot <- function(.data, .plot_type = "density", .line_size =
) +
ggplot2::theme(legend.position = leg_pos)
} else if (plot_type == "quantile") {
## EDIT
data_tbl <- data_tbl %>%
dplyr::select(sim_number, q) %>%
dplyr::group_by(sim_number) %>%
dplyr::arrange(q) %>%
dplyr::mutate(x = 1:dplyr::n()) %>%
dplyr::ungroup()
## End EDIT
plt <- data_tbl %>%
ggplot2::ggplot(
ggplot2::aes(
x = qs, y = q, group = interaction(dist_name, sim_number), color = dist_name
x = x, y = q, group = interaction(dist_name, sim_number), color = dist_name
)
) +
ggplot2::geom_line(size = line_size) +
Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-beta.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ tidy_beta <- function(.n = 50, .shape1 = 1, .shape2 = 1, .ncp = 0, .num_sims = 1
purrr::set_names("dx", "dy") %>%
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(stats::pbeta(ps, shape1 = shape1, shape2 = shape2, ncp = ncp))) %>%
dplyr::mutate(q = list(stats::qbeta(qs, shape1 = shape1, shape2 = shape2, ncp = ncp))) %>%
dplyr::mutate(q = list(stats::qbeta(tidy_scale_zero_one_vec(unlist(y)), shape1 = shape1, shape2 = shape2, ncp = ncp))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()

Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-binomial.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ tidy_binomial <- function(.n = 50, .size = 0, .prob = 1, .num_sims = 1) {
purrr::set_names("dx", "dy") %>%
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(stats::pbinom(ps, size = size, prob = prob))) %>%
dplyr::mutate(q = list(stats::qbinom(qs, size = size, prob = prob))) %>%
dplyr::mutate(q = list(stats::qbinom(tidy_scale_zero_one_vec(unlist(y)), size = size, prob = prob))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()

Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-burr-inverse.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ tidy_inverse_burr <- function(.n = 50, .shape1 = 1, .shape2 = 1, .rate = 1,
dplyr::mutate(p = list(actuar::pinvburr(ps, shape1 = shape1,
shape2 = shape2, rate = rate,
scale = scale))) %>%
dplyr::mutate(q = list(actuar::qinvburr(qs, shape1 = shape1,
dplyr::mutate(q = list(actuar::qinvburr(tidy_scale_zero_one_vec(unlist(y)), shape1 = shape1,
shape2 = shape2, rate = rate,
scale = scale))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-burr.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ tidy_burr <- function(.n = 50, .shape1 = 1, .shape2 = 1, .rate = 1,
dplyr::mutate(p = list(actuar::pburr(ps, shape1 = shape1,
shape2 = shape2, rate = rate,
scale = scale))) %>%
dplyr::mutate(q = list(actuar::qburr(qs, shape1 = shape1,
dplyr::mutate(q = list(actuar::qburr(tidy_scale_zero_one_vec(unlist(y)), shape1 = shape1,
shape2 = shape2, rate = rate,
scale = scale))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-cauchy.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ tidy_cauchy <- function(.n = 50, .location = 0, .scale = 1, .num_sims = 1) {
purrr::set_names("dx", "dy") %>%
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(stats::pcauchy(ps, location = location, scale = scale))) %>%
dplyr::mutate(q = list(stats::qcauchy(qs, location = location, scale = scale))) %>%
dplyr::mutate(q = list(stats::qcauchy(tidy_scale_zero_one_vec(unlist(y)), location = location, scale = scale))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()

Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-chisquare.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ tidy_chisquare <- function(.n = 50, .df = 1, .ncp = 1, .num_sims = 1) {
purrr::set_names("dx", "dy") %>%
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(stats::pchisq(ps, df = df, ncp = ncp))) %>%
dplyr::mutate(q = list(stats::qchisq(qs, df = df, ncp = ncp))) %>%
dplyr::mutate(q = list(stats::qchisq(tidy_scale_zero_one_vec(unlist(y)), df = df, ncp = ncp))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()

Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-exponential-inverse.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ tidy_inverse_exponential <- function(.n = 50, .rate = 1, .scale = 1/.rate, .num_
purrr::set_names("dx", "dy") %>%
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(actuar::pinvexp(ps, rate = rate, scale = scale))) %>%
dplyr::mutate(q = list(actuar::qinvexp(qs, rate = rate, scale = scale))) %>%
dplyr::mutate(q = list(actuar::qinvexp(tidy_scale_zero_one_vec(unlist(y)), rate = rate, scale = scale))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()

Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-exponential.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ tidy_exponential <- function(.n = 50, .rate = 1, .num_sims = 1) {
purrr::set_names("dx", "dy") %>%
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(stats::pexp(ps, rate = rate))) %>%
dplyr::mutate(q = list(stats::qexp(qs, rate = rate))) %>%
dplyr::mutate(q = list(stats::qexp(tidy_scale_zero_one_vec(unlist(y)), rate = rate))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()

Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-f.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ tidy_f <- function(.n = 50, .df1 = 1, .df2 = 1, .ncp = 0, .num_sims = 1) {
purrr::set_names("dx", "dy") %>%
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(stats::pf(ps, df1 = df1, df2 = df2, ncp = ncp))) %>%
dplyr::mutate(q = list(stats::qf(qs, df1 = df1, df2 = df2, ncp = ncp))) %>%
dplyr::mutate(q = list(stats::qf(tidy_scale_zero_one_vec(unlist(y)), df1 = df1, df2 = df2, ncp = ncp))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()

Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-gamma-inverse.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ tidy_inverse_gamma <- function(.n = 50, .shape = 1, .rate = 1, .scale = 1/.rate,
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(actuar::pinvgamma(ps, shape = shape,
rate = rate, scale = scl))) %>%
dplyr::mutate(q = list(actuar::qinvgamma(qs, shape = shape,
dplyr::mutate(q = list(actuar::qinvgamma(tidy_scale_zero_one_vec(unlist(y)), shape = shape,
rate = rate, scale = scl))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()
Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-gamma.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ tidy_gamma <- function(.n = 50, .shape = 1, .scale = 0.3, .num_sims = 1) {
purrr::set_names("dx", "dy") %>%
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(stats::pgamma(ps, shape = shp, scale = scle))) %>%
dplyr::mutate(q = list(stats::qgamma(qs, shape = shp, scale = scle))) %>%
dplyr::mutate(q = list(stats::qgamma(tidy_scale_zero_one_vec(unlist(y)), shape = shp, scale = scle))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()

Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-general-beta.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ tidy_generalized_beta <- function(.n = 50, .shape1 = 1, .shape2 = 1,
shape2 = shape2,
shape3 = shape3,
rate = rate, scale = scl))) %>%
dplyr::mutate(q = list(actuar::qgenbeta(qs, shape1 = shape1,
dplyr::mutate(q = list(actuar::qgenbeta(tidy_scale_zero_one_vec(unlist(y)), shape1 = shape1,
shape2 = shape2,
shape3 = shape3,
rate = rate, scale = scl))) %>%
Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-general-pareto.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ tidy_generalized_pareto <- function(.n = 50, .shape1 = 1, .shape2 = 1,
shape2 = shape2, rate = rate,
scale = scale
))) %>%
dplyr::mutate(q = list(actuar::qgenpareto(qs,
dplyr::mutate(q = list(actuar::qgenpareto(tidy_scale_zero_one_vec(unlist(y)),
shape1 = shape1,
shape2 = shape2, rate = rate,
scale = scale
Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-geom.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ tidy_geometric <- function(.n = 50, .prob = 1, .num_sims = 1) {
purrr::set_names("dx", "dy") %>%
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(stats::pgeom(ps, prob = prob))) %>%
dplyr::mutate(q = list(stats::qgeom(qs, prob = prob))) %>%
dplyr::mutate(q = list(stats::qgeom(tidy_scale_zero_one_vec(unlist(y)), prob = prob))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()

Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-hypergeometric.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ tidy_hypergeometric <- function(.n = 50, .m = 0, .nn = 0, .k = 0, .num_sims = 1)
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(stats::phyper(ps, m = m, n = nn, k = k))) %>%
#dplyr::mutate(p = list(stats::phyper(unlist(x), m = m, n = nn, k = k))) %>%
dplyr::mutate(q = list(stats::qhyper(qs, m = m, n = nn, k = k))) %>%
dplyr::mutate(q = list(stats::qhyper(tidy_scale_zero_one_vec(unlist(y)), m = m, n = nn, k = k))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()

Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-logistic.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ tidy_logistic <- function(.n = 50, .location = 0, .scale = 1, .num_sims = 1) {
purrr::set_names("dx", "dy") %>%
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(stats::plogis(ps, location = location, scale = scale))) %>%
dplyr::mutate(q = list(stats::qlogis(qs, location = location, scale = scale))) %>%
dplyr::mutate(q = list(stats::qlogis(tidy_scale_zero_one_vec(unlist(y)), location = location, scale = scale))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()

Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-lognormal.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ tidy_lognormal <- function(.n = 50, .meanlog = 0, .sdlog = 1, .num_sims = 1) {
purrr::set_names("dx", "dy") %>%
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(stats::plnorm(ps, meanlog = meanlog, sdlog = sdlog))) %>%
dplyr::mutate(q = list(stats::qlnorm(qs, meanlog = meanlog, sdlog = sdlog))) %>%
dplyr::mutate(q = list(stats::qlnorm(tidy_scale_zero_one_vec(unlist(y)), meanlog = meanlog, sdlog = sdlog))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()

Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-negative-binomial.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ tidy_negative_binomial <- function(.n = 50, .size = 1, .prob = .1, .num_sims = 1
purrr::set_names("dx", "dy") %>%
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(stats::pnbinom(ps, size = size, prob = prob))) %>%
dplyr::mutate(q = list(stats::qnbinom(qs, size = size, prob = prob))) %>%
dplyr::mutate(q = list(stats::qnbinom(tidy_scale_zero_one_vec(unlist(y)), size = size, prob = prob))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()

Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-normal-inverse.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ tidy_inverse_normal <- function(.n = 50, .mean = 1, .shape = 1, .dispersion = 1/
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(actuar::pinvgauss(ps, mean = mu, shape = shape
, dispersion = dispers))) %>%
dplyr::mutate(q = list(actuar::qinvgauss(qs, mean = mu, shape = shape
dplyr::mutate(q = list(actuar::qinvgauss(tidy_scale_zero_one_vec(unlist(y)), mean = mu, shape = shape
, dispersion = dispers))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()
Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-normal.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ tidy_normal <- function(.n = 50, .mean = 0, .sd = 1, .num_sims = 1) {
purrr::set_names("dx", "dy") %>%
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(stats::pnorm(ps, mu, std))) %>%
dplyr::mutate(q = list(stats::qnorm(qs, mu, std))) %>%
dplyr::mutate(q = list(stats::qnorm(tidy_scale_zero_one_vec(unlist(y)), mu, std))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()

Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-paralogistic.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ tidy_paralogistic <- function(.n = 50, .shape = 1, .rate = 1, .scale = 1/.rate,
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(actuar::pparalogis(ps, shape = shape, rate = rate,
scale = scale))) %>%
dplyr::mutate(q = list(actuar::qparalogis(qs, shape = shape, rate = rate,
dplyr::mutate(q = list(actuar::qparalogis(tidy_scale_zero_one_vec(unlist(y)), shape = shape, rate = rate,
scale = scale))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()
Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-pareto-inverse.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ tidy_inverse_pareto <- function(.n = 50, .shape = 1, .scale = 1, .num_sims = 1)
purrr::set_names("dx", "dy") %>%
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(actuar::pinvpareto(ps, shape = shape, scale = scale))) %>%
dplyr::mutate(q = list(actuar::qinvpareto(qs, shape = shape, scale = scale))) %>%
dplyr::mutate(q = list(actuar::qinvpareto(tidy_scale_zero_one_vec(unlist(y)), shape = shape, scale = scale))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()

Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-pareto-single-param.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ tidy_pareto1 <- function(.n = 50, .shape = 1, .min = 1, .num_sims = 1) {
purrr::set_names("dx", "dy") %>%
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(actuar::ppareto1(ps, shape = shape, min = min))) %>%
dplyr::mutate(q = list(actuar::qpareto1(qs, shape = shape, min = min))) %>%
dplyr::mutate(q = list(actuar::qpareto1(tidy_scale_zero_one_vec(unlist(y)), shape = shape, min = min))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()

Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-pareto.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ tidy_pareto <- function(.n = 50, .shape = 10, .scale = 0.1, .num_sims = 1) {
purrr::set_names("dx", "dy") %>%
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(actuar::ppareto(ps, shape = shape, scale = scale))) %>%
dplyr::mutate(q = list(actuar::qpareto(qs, shape = shape, scale = scale))) %>%
dplyr::mutate(q = list(actuar::qpareto(tidy_scale_zero_one_vec(unlist(y)), shape = shape, scale = scale))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()

Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-poisson.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ tidy_poisson <- function(.n = 50, .lambda = 1, .num_sims = 1) {
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(stats::ppois(ps, lambda = lambda))) %>%
#dplyr::mutate(p = list(stats::ppois(unlist(x), lambda = lambda))) %>%
dplyr::mutate(q = list(stats::qpois(qs, lambda = lambda))) %>%
dplyr::mutate(q = list(stats::qpois(tidy_scale_zero_one_vec(unlist(y)), lambda = lambda))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()

Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-t.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ tidy_t <- function(.n = 50, .df = 1, .ncp = 0, .num_sims = 1) {
purrr::set_names("dx", "dy") %>%
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(stats::pt(ps, df = df, ncp = ncp))) %>%
dplyr::mutate(q = list(stats::qt(qs, df = df, ncp = ncp))) %>%
dplyr::mutate(q = list(stats::qt(tidy_scale_zero_one_vec(unlist(y)), df = df, ncp = ncp))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()

Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-uniform.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ tidy_uniform <- function(.n = 50, .min = 0, .max = 1, .num_sims = 1) {
purrr::set_names("dx", "dy") %>%
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(stats::punif(ps, min = min_val, max = max_val))) %>%
dplyr::mutate(q = list(stats::qunif(qs, min = min_val, max = max_val))) %>%
dplyr::mutate(q = list(stats::qunif(tidy_scale_zero_one_vec(unlist(y)), min = min_val, max = max_val))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()

Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-weibull-inverse.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ tidy_inverse_weibull <- function(.n = 50, .shape = 1, .rate = 1,
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(actuar::pinvweibull(ps, shape = shape,
scale = scale, rate = rate))) %>%
dplyr::mutate(q = list(actuar::qinvweibull(qs, shape = shape,
dplyr::mutate(q = list(actuar::qinvweibull(tidy_scale_zero_one_vec(unlist(y)), shape = shape,
scale = scale, rate = rate))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()
Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-weibull.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ tidy_weibull <- function(.n = 50, .shape = 1, .scale = 1, .num_sims = 1) {
purrr::set_names("dx", "dy") %>%
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(stats::pweibull(ps, shape = shape, scale = scale))) %>%
dplyr::mutate(q = list(stats::qweibull(qs, shape = shape, scale = scale))) %>%
dplyr::mutate(q = list(stats::qweibull(tidy_scale_zero_one_vec(unlist(y)), shape = shape, scale = scale))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()

Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-zero-truc-poisson.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ tidy_zero_truncated_poisson <- function(.n = 50, .lambda = 1, .num_sims = 1) {
purrr::set_names("dx", "dy") %>%
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(actuar::pztpois(ps, lambda = lambda))) %>%
dplyr::mutate(q = list(actuar::qztpois(qs, lambda = lambda))) %>%
dplyr::mutate(q = list(actuar::qztpois(tidy_scale_zero_one_vec(unlist(y)), lambda = lambda))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()

Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-zero-trunc-geometric.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ tidy_zero_truncated_geometric <- function(.n = 50, .prob = 1, .num_sims = 1) {
purrr::set_names("dx", "dy") %>%
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(actuar::pztgeom(ps, prob = prob))) %>%
dplyr::mutate(q = list(actuar::qztgeom(qs, prob = prob))) %>%
dplyr::mutate(q = list(actuar::qztgeom(tidy_scale_zero_one_vec(unlist(y)), prob = prob))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()

Expand Down
2 changes: 1 addition & 1 deletion R/random-tidy-zero-truncated-binomial.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ tidy_zero_truncated_binomial <- function(.n = 50, .size = 0, .prob = 1, .num_sim
purrr::set_names("dx", "dy") %>%
dplyr::as_tibble())) %>%
dplyr::mutate(p = list(actuar::pztbinom(ps, size = size, prob = prob))) %>%
dplyr::mutate(q = list(actuar::qztbinom(qs, size = size, prob = prob))) %>%
dplyr::mutate(q = list(actuar::qztbinom(tidy_scale_zero_one_vec(unlist(y)), size = size, prob = prob))) %>%
tidyr::unnest(cols = c(x, y, d, p, q)) %>%
dplyr::ungroup()

Expand Down

0 comments on commit 61e52b0

Please sign in to comment.