Learn R Programming

evolqg (version 0.3-4)

BayesianCalculateMatrix: 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)

Value

Estimated covariance matrices and posterior samples

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

Author

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

Run this code
data(iris)
iris.lm = lm(as.matrix(iris[,1:4])~iris[,5])
matrices <- BayesianCalculateMatrix(iris.lm, nu = 0.1, samples = 100)

Run the code above in your browser using DataLab