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

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.

Value

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

Details

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

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

Examples

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)
#> Min. 1st Qu. Median Mean 3rd Qu. Max. #> 0.0000017 0.0085017 0.0205287 0.0288081 0.0403540 0.3205529
hist(r_squared, col = "darkviolet")
detach(England_BA) # rm(list = ls())