View source: R/simulate_plots.R
simulate_plots | R Documentation |
Simulate a multi-environment breeding trial
simulate_plots( X, snps = 1000, inds = 100, qtls = 20, n_envs = 4, n_reps = 2, var_phen = 10, h2 = 0.75, var_env = 5, var_rep = 0.5, beta_ab = 5, return_scaled = FALSE )
X |
A Marker matrix in minor-allele dosage format, with individuals in rows and SNPs in columns |
snps |
Either an integer n, in which case n SNPs are randomly sampled out of X, or a vector of SNP indices, or a vector of SNP names. Setting to "all" will use all SNPs |
inds |
Either an integer n, in which case n individuals are randomly sampled out of X, or a vector of individual indices, or a vector of individual names. Setting to "all" will use all individuals |
qtls |
Either an integer n, in which case n evenly-spaced SNPs will be chosen as QTLs, or a vector of SNP indices to assign as QTLs, or vector of SNP names to assign as QTLs |
n_envs |
Integer - number of environments to simulate |
n_reps |
Integer - number of replicates within each environment to simulate |
var_phen |
Positive float - Phenotypic variance within each environment |
h2 |
Proper fraction - Within-environment narrow-sense heritability value |
var_env |
Positive float - Variance between environments |
var_rep |
Positive float - Variance between replications within same environment |
beta_ab |
Improper fraction - Beta distribution shape parameter to control GxE effect. See details. |
return_scaled |
Logical - Indicates whether to scale the genetic signal and the error by the phenotypic standard deviation before returning the outputted plots data |
QTL effects are allowed to vary across environments by sampling out
of a symmetric beta distribution. This implies that genotype-by-environment
(GxE) interaction decreases as the α and β shape parameters of the
distribution increase. At the limits, setting α = β = 1 makes the
beta distribution equivalent to a uniform distribution - QTL effects may vary
without any central tendency. Alternatively, setting α = β = Inf
will set QTL effects constant across environments.
Setting n_reps to 1 will simulate within-environment means. In this
case, the var_rep value will have no effect.
A list containing the following elements:
plots_data - Dataframe containing data for individual plots in each environment
qtl_effects - Dataframe containing QTL effects in each environment
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.