Description Usage Arguments Value Examples
View source: R/sim.metapopgen.monoecious.multilocus.R
Simulates the metapopulation genetics. The function will calculate automatically from its arguments the number of gamete types 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. See also the help of sim.metapopgen.monocious for more information.
1 2 3 4 5 6 | sim.metapopgen.dioecious(input.type, demographic.data,
N1, sigma_M, sigma_F,
phi_M, phi_F, List_gene, mu, r=0.5,
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 |
Number of 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 |
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). |
List_gene |
Vector giving the number of alleles at each locus. |
mu |
Vector giving the mutation rate at each locus. Mutation follows a K-allele mutation model where the probability that an allele |
r |
Recombination probability in simulations with two loci. |
delta |
Dispersal probabilities. Square matrix of size |
recr.dd |
Defines how settler survival probabilities depend on density. If "settlers" (default), settler survival probabilities depends on the number of settlers, through the function |
kappa0 |
2-D array of length c(n,T_max). Carrying capacity used to calculate the density-dependent settler survival probabilities. If the argument |
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 |
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 one element, N
a 4-D array (ex: N[k,i,x,t])
of length c(m,n,z,tmax) giving the number 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 variable N, 3-D arrays (N[k,i,x]
) of length c(m,n,z) giving the number of individuals of genotype k
, age x
in deme i
at that time.
1 2 3 4 5 6 7 8 9 10 11 12 | # Example for a population with 10 demes, 2 age-classes and 5 time-steps.
# Two independent loci
data("MultiMonoecious")
N<-sim.metapopgen.monoecious.multilocus(input.type="array",N1=N1,sigma=sigma,phi_F=phi_F,phi_M=phi_M,List_gene=List_gene,mu=mu,r=r,delta=delta,kappa0=kappa0,T_max=5)
# This will save results on disk:
sim.metapopgen.monoecious.multilocus(input.type="array",N1=N1,sigma=sigma,phi_F=phi_F,phi_M=phi_M,List_gene=List_gene,List_mu=List_mu,r=r,delta=delta,kappa0=kappa0,T_max=5,save.res=T)
# This will use a data frame input type
data("DataFrameMonociousMulti")
sim.metapopgen.monoecious.multilocus(input.type="data.frame",demographic.data=demographic.data, List_gene=List_gene, List_mu=List_mu,r=r,delta=delta, kappa0=kappa0,T_max=5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.