| ld.sim {ldDesign} | R Documentation |
For a bi-allelic marker and QTL, with given allele frequencies, linkage disequilibrium, and QTL heritability, multiple replicate populations with marker, QTL, and trait values are simulated and tested for a marker-trait association. Results can be used to estimate the power of an experimental design for detecting linkage disequilibrium.
ld.sim(nsim, n, p, q, D, h2, Vp, phi, missclass.rate = 0, sim.chunk = 100,
method = 1, print.it = TRUE, data.only=FALSE)
ld.sim1(n, p, q, D, d, h, sig2.error, missclass.rate = 0, nreps = 1,
method = 2, print.it = TRUE, data.only=FALSE)
nsim |
Number of replicate simulations to do |
n |
The sample size, i.e. number of individuals genotyped and tested for the trait of interest |
p |
Bi-allelic marker allele frequency |
q |
Bi-allelic QTL allele frequency |
D |
Linkage disequilibrium coefficient |
h2 |
QTL `heritability', i.e. proportion of total or phenotypic variance explained by the QTL |
Vp |
ld.sim: Total or phenotypic variance: an arbitrary value may be used |
phi |
ld.sim: Dominance ratio: phi = 0 denotes purely additive
gene action, phi = 1 denotes completely dominant gene action |
d |
ld.sim1: Expected value for trait when QTL genotype is QQ,qq respectively is d,-d |
h |
ld.sim1: Expected value for trait when QTL genotype is Qq is h |
sig2.error |
ld.sim1: Error variance when QTL genotype known and modelled |
missclass.rate |
Proportion of marker values which are missclassified, i.e. incorrect |
sim.chunk |
ld.sim: Number of replicates to do in a
`chunk' in each call to ld.sim1 |
nreps |
ld.sim1: Number of replicate simulations to do for
the given set of marker genotypes |
method |
If method=1 simulate random QTL genotypes
conditional on marker values in ld.sim1; if method=2
simulate markers and QTL directly from table of joint probabilities.
With method=1, a common set of marker values are used for each of
the nreps replicates per call to ld.sim1, enabling MANOVA to be used. |
print.it |
if TRUE, print results |
data.only |
if TRUE, just return the simulated trait and
marker genotype data |
Marker, QTL, and trait values are simulated according to the genetic
model with normal errors. In ld.sim, QTL parameters d,h are determined from the
parameters h2,q,phi, and Vq, and the main simulation done for each
chunk of replicates by a call to ld.sim1. Marker-trait association is tested by
a one-way analysis of variance of trait values in terms of marker classes.
The proportion of results with P-value over a given threshold gives a stochastic estimate
of the power calculated by luo.ld.power.
If data.only=FALSE, an array with 1 row per simulation run,
and 4 columns with values for each run:
MS.beta |
Between marker classes mean square |
MS.within |
Within marker classes mean square |
F.value |
F value |
P.value |
P value |
marker |
Marker genotype indicator with values {1,2,3}, corresponding to genotypes {MM,Mm,mm} |
y |
trait values |
replicate |
Replicate population indicator. Each blocks of rows with a given replicate number is a simulated population with the given parameters |
Rod Ball rod.ball@forestresearch.co.nz www.forestresearch.co.nz
Luo, Z.W. 1988 Detecting linkage disequilibrium between a polymorphic marker locus and a trait locus in natural populations. Heredity 80, 198–208.
# Power from stochastic simulation for Luo's population 12
data(luo.ld.populations)
luo.pop12.sim <- ld.sim(nsim=3000,
n=luo.ld.populations[12,"n"],
p=luo.ld.populations[12,"p"],
q=luo.ld.populations[12,"q"],
D=luo.ld.populations[12,"D"],
h2=luo.ld.populations[12,"h2"],
phi=luo.ld.populations[12,"phi"],
Vp=100)
# power
table(luo.pop12.sim[,4] < 0.05)[2]/sum(table(luo.pop12.sim[,4] < 0.05))
# Cf power from deterministic calculation
luo.ld.power(n=luo.ld.populations[12,"n"],
p=luo.ld.populations[12,"p"],
q=luo.ld.populations[12,"q"],
D=luo.ld.populations[12,"D"],
h2=luo.ld.populations[12,"h2"],
phi=luo.ld.populations[12,"phi"],
Vp=100,
alpha=0.05)