Integral involving gamma density function

190 Views Asked by At

I am trying to numerically calculate the value of $I$ using R's "integrate" function.

$$ I = \int_{t_1}^{t_2}\frac{b^{a(t-t_1)}}{\Gamma(a(t-t_1))}(y_2-y_1)^{a(t-t_1)-1}e^{-b(y_2-y_1)}(t_2-t)dt $$ Note that, this is a gamma pdf multiplied with $(t_2-t)$ where $a(t-t_1)$ is the shape parameter. As per my understanding, I am multiplying the probability of jumping $(y_2-y_1)$ length in $(t-t_1)$ time period with $(t_2-t)$. I am expecting to get expected time between $t_1=0$ to $t_2$ that it jumps over $(y_2-y_1)$. Therefore my expectation is to get a result between $0$ to maximum $t_2$.

I used following parameters and got an answer 628.97 which does not make sense. It should be between $t_1$ and $t_2$.

  y1 <- 28
  y2 <- 30 
  b <- 1
  a <- .2
  t1 <- 0
  t2 <- 140

I am rather doubtful whether I am implementing the integration in R wrong or my formulation is wrong. Can you help me verify if my answer is correct. In that case, I can be sure that my formulation is wrong. Also any suggestion about formulation will be appreciated.

Edit:

Sketch of the problem

Here I have a stochastic process where the process makes jumps as time progresses. Any jump between a time interval follows a gamma distribution with shape parameter $a(t-t_1)$ and scale parameter $b$ as depicted in the sketch. I am trying to calculate the expected length of time the process spends over $y_2$.

1

There are 1 best solutions below

1
On

With the parameters you have given, the integrand is $$ \frac{2^{\frac{t}{5}-1} (140-t)}{e^2 \Gamma \left(\frac{t}{5}\right)} $$

Plotting that integrand,

Mathematica graphics

which area we can estimate to be aorund $20 \times 30 = 600$, compatible with your numerical result. Asking Mathematica to perform the integration, we obtain $628.9792121\dots$, which is compatible with your R calculation.

I note that the gamma distribution with shape parameter $a(t-t_1)$ and scale parameter $b$ (a guess, since you do not specify both parameters to your gamma distribution) gives PDF $$ \frac{e^{-\frac{t}{b}} t^{a (t-t_1)-1} b^{-a (t-t_1)}}{\Gamma (a(t-t_1))} \text{,} $$ which partially matches your integrand. The difference might be your choice of scale parameter or may be something else.