R: Inference and model selection under the assumption of...
MLCVGauss
R Documentation
Inference and model selection under the assumption of Gaussian distribution of
allele counts
Description
Inference and model selection for analysis of geographical
genetic variation under the assumption of Gaussian distribution of
allele counts for bi-allelic loci. Parameter estimation by maximization of the likelihood.
A matrix with dimensions (n,l) n: number of geographical locations, l:
number of loci.
D_G
A matrix of geograpical distances
D_E
A matrix of environmental distances
theta.max
Upper bounds for the vector of parameters in theta. Note that
in theta, the parameters are assumed to be in this order:
(alpha,beta_G, beta_E, gamma, delta)
theta.min
Lower bounds for the vector of parameters in theta. Note that
in theta, the parameters are assumed to be in this order:
(alpha,beta_G, beta_E, gamma, delta)
ntrain
Number of sites used for training. An integer smaller
than nrow(gen). If ntrain is equal to the number of
sampling sites, the function estimates parameters on the whole
dataset and does not perform cross-validation.
nresamp
Number of resamplings. An integer larger than 1.
Value
A list with either a component named mod.lik (containing likelihoods on
the validation set for the various models compared) or a vector of
estimated parameters (if ntrain is equal to the number of
sampling sites).
Author(s)
Gilles Guillot
Examples
## Not run:
nsite <- 200
nloc <- 1000
hap.pop.size <- 100
theta <- c(runif(n=1,.5,10),
runif(n=1,.01,10),
runif(n=1,.01,10),
runif(n=1,.5,1),
runif(n=1,.01,.1)
)
mod <- 'G+E'
dat <- SimSunderData(mod=mod,
theta=theta,
nsite=nsite,
nloc=nloc,
hap.pop.size=hap.pop.size,
nalM=2,nalm=2, #bi-allelic loci
var.par=1,
scale.par=3)
gen <- dat$gen[,,1]
D_G <- dat$D_G
D_E <- dat$D_E
res <- MLCVGauss(gen,D_G,D_E,
ntrain=nrow(gen)/2,
nresamp=3)
which.max(res$mod.lik)
## End(Not run)