Description Usage Arguments Value Examples
View source: R/sim.metapopgen.dioecious.R
Simulates the metapopulation genetics. The function will calculate automatically from its arguments the number of alleles l
, the number of genotypes m
, the number of demes n
and the number of age-classes z
. It is therefore important that all the arguments have the correct dimensions and size.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | res <- sim.metapopgen.dioecious(input.type,
demographic.data,
N1_M, N1_F,
sigma_M, sigma_F,
phi_F, phi_M,
fec.distr_F = "poisson", fec.distr_M = "poisson",
mu,
delta,
recr.dd="settlers", kappa0,
T_max,
save.res = F, save.res.T = seq(1,T_max),
verbose = F)
|
input.type |
Character vector defining whether the input data are giving as arrays ( |
demographic.data |
If the input is given as a data.frame ( |
N1_M |
Number of male individuals at the beginning of the simulation. 3-D array giving the number of individuals of each genotype in each deme and each age-class at the beginning of the simulation. The first dimension is the genotype, the second dimension is the deme and the third dimension is the age-class. To be used when |
N1_F |
Number of female individuals at the beginning of the simulation. The same as |
sigma_M |
Survival probabilities for males. 4-D array of length c(m,n,z,T_max). |
sigma_F |
Survival probabilities for females. The same as |
phi_F |
Mean female fecundity. 4-D array of length c(m,n,z,T_max). |
phi_M |
Mean male fecundity. 4-D array of length c(m,n,z,T_max). |
fec.distr_F, fec.distr_M |
The distribution used to set fecundities: one of |
mu |
Mutation rates. Square matrix of size |
delta |
Dispersal probabilities. Square matrix of size |
recr.dd |
Defines how population regulation is performed. Currently inactive. |
kappa0 |
2-D array of length c(n,T_max). Deme carrying capacity used to perform population regulation. |
T_max |
Number of years of simulations. |
save.res |
Boolean. If FALSE (default), the result of the simulation is stored in memory and returned to the user. If TRUE, the function does not return anything, but save the result in different files on disk. See "value" below. |
save.res.T |
Vector. If save.res=TRUE, this argument is used to define the time steps for which the state of the metapopulation will be saved on disk. It is used to save disk space in the case of long simulations with many demes or genotypes. It deafults to |
verbose |
Boolean. If TRUE, the function will print much information, mainly used for debugging purposes. Default to FALSE. |
If save.res
is FALSE: a named list with two elements, N_M
and N_F
, both 4-D arrays (ex: N_M[k,i,x,t] N_F[k,i,x,t]
) of length c(m,n,z,tmax) giving the number of male and female individuals of genotype k
, age x
in deme i
at time t
.
If save.res
is TRUE: the function does not return anything. Results are saved in files on disk. The function will create a folder named with the date and time of your simulation and create one RData file per year of simulation (but see argument save.res.T
for defining the time steps for which the results are saved). Each file will contain the variables N_M and N_F, both 3-D arrays (N_M[k,i,x] N_F[k,i,x]
) of length c(m,n,z) giving the number of male and fenale individuals of genotype k
, age x
in deme i
at that time.
1 2 3 4 5 6 7 8 9 | data(FourPopDioecious)
res <- sim.metapopgen.dioecious(input.type="array",N1_M=N1_M, N1_F=N1_F,
sigma_M=sigma_M, sigma_F=sigma_F, phi_F=phi_F, phi_M=phi_M, mu=mu,
delta=delta, kappa0=kappa0, T_max=T_max)
# This will save results on disk:
sim.metapopgen.dioecious(input.type="array",N1_M=N1_M, N1_F=N1_F,
sigma_M=sigma_M, sigma_F=sigma_F, phi_F=phi_F, phi_M=phi_M, mu=mu,
delta=delta, kappa0=kappa0, T_max=T_max, save.res=T)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.