Simulate a Stochastic Birth-Death Process
sim_stochastic_exponential.Rd
Simulates a stochastic birth-death process over multiple time steps. The process models population dynamics where both birth and death rates can vary over time.
Arguments
- n0
Numeric value indicating the initial population size. Must be a non-negative integer.
- lambda
Numeric vector of birth rates. This can be a single value (constant birth rate) or a vector of length
steps
specifying the birth rate at each time step.- mu
Numeric vector of death rates. This can be a single value (constant death rate) or a vector of length
steps
specifying the death rate at each time step.- steps
Integer value specifying the number of time steps to simulate. Must be a non-negative integer.
- delta_t
Numeric vector of time step sizes. This can be a single value (constant time step) or a vector of length
steps
. If a single value is provided, it is replicated for each time step.