Description Usage Arguments Details Value Author(s) References See Also Examples
choose_lambda
runs temporal factor analyses for drift parameters in a specified
range, and ouputs the percentage of variance of sample time explained by all factors for each value.
1 2 | choose_lambda(model, Y, min_range = -5, max_range = 1, grid_size = 10,
plot_res = TRUE, detail_axis = FALSE)
|
model |
an object of class 'tfa' adjusted with |
Y |
an nxp numeric matrix containing genetic information for n individuals recorded in p columns. Genetic information could be encoded by any numeric value, not necessarily an integer value. Missing data are not allowed. |
min_range |
a numeric value for the minimal range of drift parameter tested. Log 10 scale.
The default value is |
max_range |
a numeric value for the maximal range of drift parameter tested. Log 10 scale.
The default value is |
grid_size |
an integer value for the number of drift parameter tested. The default is
|
plot_res |
a logical indicating whether the results should be displayed graphically or not. The
default value is |
detail_axis |
a logical indicating whether the results should also be
displayed for each factor independently. The default value is |
This function requires that a preliminary model has been adjusted with K factors, where K is the number of source populations. The curve exhibits a drop for some value in the range, and the heuristic consists of choosing the largest values corresponding to removing time variation in factor K.
A vector of percentages of variance of sample time explained by factors for each value of the drift parameter in the specified range.
Olivier Francois, olivier.francois@univ-grenoble-alpes.fr
François, O., Liégeois, S., Demaille, B., Jay, F. (2019). Inference of population genetic structure from temporal samples of DNA. bioRxiv, 801324. https://www.biorxiv.org/content/10.1101/801324v3
François, O., Jay, F. (2020). Factor analysis of ancient population genomic samples. Under review.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | library(tfa)
# Ancient DNA from Bronze Age Great Britain samples
data(england_ba)
attach(England_BA)
coverage <- meta$Coverage
geno <- coverage_adjust(genotype, coverage, K = 4, log = TRUE)
# Adjust an FA model
mod <- tfa(age,
geno,
k = 3,
lambda = 5e-1,
center = TRUE,
coverage = coverage,
log = TRUE)
r_2 <- choose_lambda(mod,
geno,
min_range = -4,
max_range = 3)
abline(v=log10(5e-1), col = "orange", lty = 2)
# Remove HG from Serbia to keep k = 2 ancestral populations
age2 <- age[meta$Group.ID != "Serbia_HG"]
geno2 <- geno[meta$Group.ID != "Serbia_HG",]
# Adjust an FA model
mod <- tfa(age2,
geno2,
k = 2,
lambda = 5e-2,
center = TRUE)
r_2 <- choose_lambda(mod,
geno2,
min_range = -3,
max_range = 2)
abline(v=log10(5e-2), col = "orange", lty = 2)
detach(England_BA)
# rm(list = ls())
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.