BayesianCalculateMatrix {evolqg} | R Documentation |
Calculate Covariance Matrix from a linear model fitted with lm() using different estimators
Description
Calculates covariance matrix using the maximum likelihood estimator, the maximum a posteriori (MAP) estimator under a regularized Wishart prior, and if the sample is large enough can give samples from the posterior and the median posterior estimator.
Usage
BayesianCalculateMatrix(linear.m, samples = NULL, ..., nu = NULL, S_0 = NULL)
Arguments
linear.m |
Linear model adjusted for original data |
samples |
number os samples to be generated from the posterior. Requires sample size to be at least as large as the number of dimensions |
... |
additional arguments, currently ignored |
nu |
degrees of freedom in prior distribution, defaults to the number of traits (this can be a too strong prior) |
S_0 |
cross product matrix of the prior. Default is to use the observed variances and zero covariance |
Value
Estimated covariance matrices and posterior samples
Author(s)
Diogo Melo, Fabio Machado
References
Murphy, K. P. (2012). Machine learning: a probabilistic perspective. MIT press.
Schafer, J., e Strimmer, K. (2005). A shrinkage approach to large-scale covariance matrix estimation and implications for functional genomics. Statistical applications in genetics and molecular biology, 4(1).
Examples
data(iris)
iris.lm = lm(as.matrix(iris[,1:4])~iris[,5])
matrices <- BayesianCalculateMatrix(iris.lm, nu = 0.1, samples = 100)