runKrzSubspace: Run the Krzanowski subspace comparison

Description Usage Arguments Value References Examples

Description

Compares the H matrix eigenvalues between observed and randomized datasets, using simulated beeding values from the pedigree.

Usage

1
2
runKrzSubspace(matrix_array = NULL, models = NULL, type = c("P", "G"),
  ped = NULL, IDs, prob = 0.95)

Arguments

matrix_array

array of posterior matrices with dimensions traits x traits x populations x MCMCsamples

models

list of models, like ratones_models. Ignored if matrix_array is present.

type

use P or G matrices from the models list. Ignored if matrix_array is present.

ped

pedigree for null model simulation

IDs

list of IDs for the individuals in each population. Each element must correspond to a populations, and IDs must be in the pedigree.

prob

A numeric scalar in the interval (0,1) giving the target probability content of the posterior intervals for the eigenvalues of H.

Value

A data.frame with the observed and randomized intervals for the eigenvalues of H

References

Aguirre, J. D., E. Hine, K. McGuigan, and M. W. Blows. 2014. "Comparing G: Multivariate Analysis of Genetic Variation in Multiple Populations." Heredity 112 (1): 21-29. Melo, D., G. Garcia, A. Hubbe, A. P. Assis, and G. Marroig. 2016. "EvolQG - An R Package for Evolutionary Quantitative Genetics [version 3; Referees: 2 Approved, 1 Approved with Reservations]." F1000Research 4: 925.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 
out = runKrzSubspace(models = ratones_models, type = "P",
                     ped = ratones_ped$ped,
                     IDs = llply(ratones, function(x) x$info$ID))
#figure 2, Panel A:
krz_subspace_plot = ggplot(out, aes(x = rank, y = mean, linetype = type, color = type)) +
  geom_point(position = position_dodge(width = 0.5)) +
  geom_linerange(aes(ymin = lower, ymax = upper), position = position_dodge(width = 0.5)) +
  labs(y = "Eigenvalues of H", x = "Eigenvectors of H") +
  background_grid(major = 'x', minor = "none") +
  panel_border() +
  theme(panel.grid.minor = element_line(colour = "grey", linetype = "dotted", size =0.2)) +
  theme(legend.position = c(0.75, 0.9), text = element_text(size = 18)) +
  scale_colour_grey("", start = 0, end = 0.6) + scale_linetype(guide = "none")
#Panel B can be created in evolqg (but will take a long time!!):
matrix_array = laply(ratones_models, function(x) x$Ps)
matrix_array = aperm(matrix_array, c(3, 4, 1, 2))
dimnames(matrix_array)[[3]] = names(ratones_models)
rs_projection = RSProjection(matrix_array)
PlotRSprojection(rs_proj = rs_projection, cov.matrix.array = matrix_array)

## End(Not run)

diogro/ratones documentation built on May 24, 2019, 4:01 a.m.