nathanesau - 1 year ago 111

R Question

The following functions are available in R:

- to compute gamma function
`gamma`

- to compute derivative of log gamma function
`digamma`

- to compute incomplete gamma function
`pgamma`

- ? to compute derivative of log incomplete gamma function

I'm wonder what function can compute the derivative of log incomplete gamma function. I noticed the

`gsl`

`gamma_inc`

If no function exists, is there a simple way to approximate this derivative in

`R`

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

Answer Source

In fact, my comment and Ben Bolker's together give the answer.

I suggested the use of chain rule of derivation:

```
log(u(x))' = u'(x) / u(x)
```

then Ben pointed out that the derivative of `pgamma`

(CDF) is just `dgamma`

(PDF). So, we have

```
dgamma(x) / pgamma(x)
```

A properly defined function would be

```
f <- function (x, shape, rate) dgamma(x, shape, rate) / pgamma(x, shape, rate)
```

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**