gen_freq: generating the start values for PROSPER models

Description Usage Arguments Details Value See Also Examples

View source: R/gen_freq.R

Description

gen_freq generates the numbers of genotypes at the beginning of the first simulated year.

Usage

1
2
3
4
5
6
7
gen_freq(
  af,
  n_seeds,
  result = "initialSB",
  distribution = NA,
  max_vec_length = 1e+07
)

Arguments

af

initial frequency of resistance alleles in the population. numeric vector with length of ng (number of genes) and elements in [0,1].

n_seeds

initial number of weed seeds. They will be allocated to the genotypes. integer.

result

names of the results columns. character.

distribution

defines the proportion with n_seeds is distributed among multiple cloumns, if result defines multiple columns. Has to be of the same length as result. numeric between 0 and 1 or "equal". See details.

max_vec_length

used internally, a technical term, defining the maximum length of vectors to be used.

Details

The start values for a model include the initial frequencies of alleles and the initial seedbank, i.e. the number of seeds in the soil. gen_freq allocates the n_seeds individuals to the different genotypes as provided by dfgenotype, which is created by struc_preparation2(). If af == NULL the function gives all seed to the only "genotype". The distribution can be splitted to multiple cohorts using distribution. If distribution is "equal", n_seeds are distributed equaly amoung the cohorts defindes with result.

Value

Returns a data.frame containing the genotypes and their frequencies provided by dfgenotype.

See Also

sel_resist struc_preparation2

Examples

1
2
3
4
5
6
# generate a 'dfgenotype' data.frame:
struc_preparation2(Rmx=10, af=c(0.01,0.8), epis=0, dom=1)
#Distribute 10000 individuals of the starting population across the genotypes. 
#The two gene loci have initial frequencies of 0.01 and 0.8.
gen_freq(af=c(0.01,0.8), n_seeds=10000)
rm(dfgenotype, mf, xprobab)

PROSPER documentation built on July 2, 2020, 3:25 a.m.

Related to gen_freq in PROSPER...