prop_variance: Compute proportions of variance explained by temporal...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/tfa.R

Description

prop_variance returns a vector of squared correlation coefficients representing the proportion of variation captured by the specified covariance model at each locus.

Usage

1
prop_variance(model, Y)

Arguments

model

an object of class 'tfa' adjusted with tfa().

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. The matrix should have the same number of rows as in the adjusted model.

Details

This function requires that a preliminary model has been adjusted with K factors, where K is the number of source populations.

Value

A vector of probabilities representing the proportion of variation captured the specified covariance model at each locus.

Author(s)

Olivier Francois, olivier.francois@univ-grenoble-alpes.fr

References

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.

See Also

England_BA, tfa

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
library(tfa)

# Ancient DNA from Bronze Age Great Britain samples
data(england_ba)

attach(England_BA)

# Remove HG from Serbia to keep k = 2 ancestral populations
age2 <- age[meta$Group.ID != "Serbia_HG"]
geno2 <- genotype[meta$Group.ID != "Serbia_HG",]

# Adjust an FA model
mod  <- tfa(age2,
            geno2,
            k = 2,
            lambda = 5e-2,
            center = TRUE)

r_squared <- prop_variance(mod, geno2)
summary(r_squared)
hist(r_squared, col = "darkviolet")
detach(England_BA)
# rm(list = ls())

bcm-uga/tfa documentation built on Aug. 28, 2020, 2:46 p.m.