Learn R Programming

Sunder (version 0.0.4)

MLCVGauss: 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.

Usage

MLCVGauss(gen, D_G, D_E,theta.max,theta.min,ntrain,nresamp)

Arguments

gen
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

the validation set for the various models compared) or a vector of estimated parameters (if ntrain is equal to the number of sampling sites).

Examples

Run this code
## 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)

Run the code above in your browser using DataLab