WFD(N, M, t0, T, x0, gamma1, gamma2, sigma, output = FALSE)t0 (0 < x0 < 1).-gamma1 * X(t) + gamma2 * (1 - X(t)) :drift coefficient), (gamma1 >= 0).-gamma1 * X(t) + gamma2 * (1 - X(t)) :drift coefficient). (gamma2 >= 0)sigma * sqrt(X(t)*(1-X(t))) :diffusion coefficient).output = TRUE write a output to an Excel (.csv).dt = (T-t0)/N.
In population dynamics frequencies of genes or alleles are studied. It is assumed
for simplicity that the population size N is fixed and individuals are of
two types: A and a. If individuals of type A mutate to type a with the rate gamma1/N and individuals of type a mutate to type
A with the rate gamma2/N, then it is possible to approximate the frequency of type A individuals X(t) by the
Wright-Fisher diffusion, given by the stochastic equation :
$$dX(t) = (-gamma1 * X(t) + gamma2 * ( 1 - X(t)) ) * dt + sigma * sqrt(X(t)*(1-X(t))) *dW(t)$$ with (-gamma1 * X(t) + gamma2 * ( 1 - X(t)) ) :drift coefficient and sigma * sqrt(X(t)*(1-X(t))) :diffusion coefficient, W(t) is Wiener process.SLVM Stochastic Lotka-Volterra, FBD Feller Branching Diffusion.WFD(N=1000,M=1,t0=0,T=1,x0=0.5,gamma1=0,gamma2=0.5,sigma=0.2)Run the code above in your browser using DataLab