-
Notifications
You must be signed in to change notification settings - Fork 5
/
InverseGamma.R
42 lines (35 loc) · 1.76 KB
/
InverseGamma.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
### actuar: Actuarial Functions and Heavy Tailed Distributions
###
### Definition of the {d,p,q,r,m,lev,mgf}invgamma functions to compute
### characteristics of the Inverse Gamma distribution. The version
### used in these functions has cumulative distribution function
###
### Pr[X <= x] = 1 - pgamma(scale/x, shape, scale = 1)
###
### or, equivalently,
###
### Pr[X <= x] = 1 - pgamma(1/x, shape1, scale = 1/scale).
###
### See Appendix A of Klugman, Panjer & Willmot, Loss Models, Second
### Edition, Wiley, 2004 and
### <https://en.wikipedia.org/wiki/Inverse-gamma_distribution>
###
### AUTHORS: Mathieu Pigeon, Christophe Dutang and
### Vincent Goulet <[email protected]>
dinvgamma <- function (x, shape, rate = 1, scale = 1/rate, log = FALSE)
.External(C_actuar_do_dpq, "dinvgamma", x, shape, scale, log)
pinvgamma <- function(q, shape, rate = 1, scale = 1/rate,
lower.tail = TRUE, log.p = FALSE)
.External(C_actuar_do_dpq, "pinvgamma", q, shape, scale, lower.tail, log.p)
qinvgamma <- function(p, shape, rate = 1, scale = 1/rate,
lower.tail = TRUE, log.p = FALSE)
.External(C_actuar_do_dpq, "qinvgamma", p, shape, scale, lower.tail, log.p)
rinvgamma <- function(n, shape, rate = 1, scale = 1/rate)
.External(C_actuar_do_random, "rinvgamma", n, shape, scale)
minvgamma <- function(order, shape, rate = 1, scale = 1/rate)
.External(C_actuar_do_dpq, "minvgamma", order, shape, scale, FALSE)
levinvgamma <- function(limit, shape, rate = 1, scale = 1/rate,
order = 1)
.External(C_actuar_do_dpq, "levinvgamma", limit, shape, scale, order, FALSE)
mgfinvgamma <- function(t, shape, rate = 1, scale = 1/rate, log = FALSE)
.External(C_actuar_do_dpq, "mgfinvgamma", t, shape, scale, log)