Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/simul.phenotype.r
Simulates observations from a field trial using an animal model. The field
trial consists of multiple locations and randomized complete block design
within locations. A single quantitative trait is simulated according to the
model Trait ~ id(A) + block + loc + e
.
1 2 3 4 5 6 7 8 | simul.phenotype(
pedigree = NULL,
A = NULL,
mu = 100,
vc = NULL,
Nloc = 1,
Nrepl = 1
)
|
pedigree |
object of class "pedigree" |
A |
object of class "relationshipMatrix" |
mu |
|
vc |
list containing the variance components. |
Nloc |
|
Nrepl |
|
Either pedigree
or A
must be specified. If pedigree
is
given, pedigree information is used to set up numerator relationship matrix
with function kinship
. If unrelated individuals should be used for
simulation, use identity matrix for A
. True breeding values for
N individuals is simulated according to following distribution
tbv = chol(A)*sigma2a*rnorm(N,0,1)
Observations are simulated according to
If no location or block effects should appear, use
sigma2l=0
and/or sigma2b=0
.
A data.frame
with containing the simulated values for trait
and the following variables
ID |
Factor identifying the individuals.
Names are extracted from |
Loc |
Factor for Location |
Block |
Factor for Block within Location |
Trait |
Trait observations |
TBV |
Simulated values for true breeding values of individuals |
Results are sorted for locations within individuals.
Valentin Wimmer
1 2 3 4 5 6 7 8 9 10 | ## Not run:
ped <- simul.pedigree(gener = 5)
varcom <- list(sigma2e = 25, sigma2a = 36, sigma2l = 9, sigma2b = 4)
# field trial with 3 locations and 2 blocks within locations
data.simul <- simul.phenotype(ped, mu = 10, vc = varcom, Nloc = 3, Nrepl = 2)
head(data.simul)
# analysis of variance
anova(lm(Trait ~ ID + Loc + Loc:Block, data = data.simul))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.