Description Usage Arguments Details Value Author(s) See Also

Simulates the time of the first jump given that we know whether it's up or down and have observed the chain at some point.

1 2 3 | ```
sampleJumpTime2(T, a, b, up = TRUE, L, m, nu)
p.i(T, a, b, up, L, m, nu, n.fft = 1024, subdivisions = 100)
f.i(t, T, a, b, up, L, m, nu, n.fft = 1024)
``` |

`T` |
Time of (First) observation; i.e. time at which we know the state of the chain. |

`t` |
time between 0 and T at which to get the density of tau for f.i. |

`a` |
Starting state of the chain at time 0 (X_0=a). a>=0. |

`b` |
Given State of the chain at time T. (X_T=a). b>=0. |

`up` |
Boolean, telling whether the first jump is up (TRUE) or down (FALSE). |

`L` |
Linear birth rate. |

`m` |
Linear death rate. |

`nu` |
Immigration rate. |

`subdivisions` |
Parameter for numerical integration ("integrate" R function). |

`n.fft` |
Parameter for numerical riemann integration ("by hand"). |

Let tau be the time of the first jump (after time 0) and X_t is the chain at time t.

Function sampleJumpTime2 simulates the value of the first jump of a BDMC, conditional on some data. What is given is the state of the BDMC at the beginning and end, where the end is time T, as well as whether the first jump is up or down. (To simulate the chain over the time from 0 to T, repeatedly call this function alternatively with p.i)

The Function p.i simulates whether the first jump is up or down, given the data. i.e. if up==true then this returns the probability [tau < T AND X_tau = a+1] and if up==false then it's [tau < T AND X_tau = a-1].

The function f.i returns the "density" at t of tau, ie
"P([tau ==t AND X_tau = a+1] | X0=a, Xt=b)"
and if up==false then it's
"P([tau ==t AND X_tau = a-1] | X0=a, Xt=b)".
Note that it doesn't actually integrate to 1. p.i(T) is the integral
of f.i to time T. f.i(.)/p.i(T) is actually a density on [0,T].
If X_T != X_0 then we know the first jump is before time T.
However, keep in mind the event of interest is that the first jump is
up (down) and at time t; even if we know there will be a first jump
down, that doesn't prove the first jump won't be up.
In general, we have
*\int^T_0 f.i(up) + \int^T_0 f.i(down) + P(first jump is after
time T) = 1*.
That is, *\int_0^t f.i(up)(s) ds* is the probability the first
jump is before time t _and_ it is up (given that the chain starts at a
and ends at b).

A time (real number) between 0 and T.

Charles Doss

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.