A wrapper for building function families given a numeric vector and the distribution

build_dist(x, distribution)

Arguments

x

numeric vector

distribution

distribution character name

Value

list of distribution functions for d, p, q, r, and parameters

Examples

fittedDists <- build_dist(rpois(100,5), 'pois') dpois(x = 5, lambda = 5)
#> [1] 0.1754674
fittedDists$dpois(5)
#> [1] 0.175009
ppois(5, 5)
#> [1] 0.6159607
fittedDists$ppois(5)
#> [1] 0.6440111
qpois(.5, 5)
#> [1] 5
fittedDists$qpois(.5)
#> [1] 5
set.seed(8257) rpois(100, 5)
#> [1] 9 5 8 5 6 4 8 6 6 3 3 12 4 2 8 6 6 3 9 7 3 8 4 4 4 #> [26] 5 5 2 5 8 3 1 4 6 2 9 3 8 5 5 3 4 7 4 3 4 4 6 7 5 #> [51] 4 1 6 7 3 5 7 5 4 4 3 2 11 9 2 4 5 6 9 6 5 2 6 5 3 #> [76] 5 6 3 3 10 8 6 5 9 5 6 4 6 6 2 6 6 10 3 5 5 3 7 2 7
set.seed(8257) fittedDists$rpois(100)
#> [1] 8 5 8 5 6 4 7 6 6 3 3 12 4 2 8 6 6 3 8 6 3 8 4 3 4 #> [26] 5 5 2 5 8 3 1 4 6 2 9 3 7 5 4 3 4 7 4 3 4 4 6 7 5 #> [51] 3 1 5 7 3 5 6 5 4 4 3 2 10 9 2 4 5 6 8 6 4 1 6 4 3 #> [76] 5 6 3 3 10 8 5 4 8 5 5 4 6 5 2 6 6 10 2 5 5 2 7 1 7
fittedDists$parameters
#> lambda #> 4.84