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.1735372
ppois(5, 5)
#> [1] 0.6159607
fittedDists$ppois(5)
#> [1] 0.5565234
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]  9  6  8  6  7  4  8  6  6  4  3 12  4  2  9  7  6  4  9  7  3  8  5  4  5
#>  [26]  5  5  2  5  9  3  1  4  7  3 10  3  8  5  5  4  5  8  5  3  4  5  7  8  5
#>  [51]  4  1  6  8  4  5  7  5  4  5  3  2 11  9  3  4  5  6  9  7  5  2  6  5  3
#>  [76]  5  6  3  3 10  9  6  5  9  6  6  4  6  6  3  6  7 11  3  5  6  3  8  2  7
fittedDists$parameters
#> lambda 
#>   5.34