Probability Density Function
density.Rd
Access a copula's probability density function (pdf).
Usage
eval_density(copula, u, v, strict = TRUE)
enframe_density(..., u, v, fn_prefix = "density", sep = "_", strict = TRUE)
Arguments
- copula, ...
A copula, or possibly multiple copulas in the case of
...
.- u, v
Vectors of values to evaluate the copula at.
- strict
Only evaluate when the density exists?
TRUE
if so; ifFALSE
, evaluates the derivative of the cdf.- fn_prefix
For
enframe_
, name of the function to appear in the column(s).- sep
When
enframe
'ing more than one copula, the character that will be separating thefn_name
and the copula name.
Value
The evaluated density in vector form (for eval_
) and data frame
or tibble form (for enframe_
).
See also
Other distributional representations:
eval_cdf()
,
eval_pmf()
,
eval_survival()
Examples
d1 <- cop_ig(20, 4)
d2 <- cop_igl(1.1)
eval_density(d1, u = 0.4, v = 1:9 / 10)
#> [1] 0.9690656 1.0757272 1.1908119 1.2939665 1.3688790 1.3790318 1.2426071
#> [8] 0.8194615 0.1685303
enframe_density(d1, u = 0.4, v = 1:9 / 10)
#> # A tibble: 9 × 3
#> .u .v density
#> <dbl> <dbl> <dbl>
#> 1 0.4 0.1 0.969
#> 2 0.4 0.2 1.08
#> 3 0.4 0.3 1.19
#> 4 0.4 0.4 1.29
#> 5 0.4 0.5 1.37
#> 6 0.4 0.6 1.38
#> 7 0.4 0.7 1.24
#> 8 0.4 0.8 0.819
#> 9 0.4 0.9 0.169
enframe_density(d1, d2, u = 1:9 / 10, v = 1:9 / 10)
#> # A tibble: 9 × 4
#> .u .v density_d1 density_d2
#> <dbl> <dbl> <dbl> <dbl>
#> 1 0.1 0.1 1.80 1.76
#> 2 0.2 0.2 1.62 1.52
#> 3 0.3 0.3 1.42 1.36
#> 4 0.4 0.4 1.29 1.26
#> 5 0.5 0.5 1.25 1.23
#> 6 0.6 0.6 1.27 1.28
#> 7 0.7 0.7 1.39 1.47
#> 8 0.8 0.8 1.66 2.00
#> 9 0.9 0.9 2.37 3.89