covML function

Maximum likelihood covariance estimate

Maximum likelihood covariance estimate

These functions complement the base R cov function by simplifying obtaining maximum likelihood (ML) covariance estimates (denominator n) instead of unbiased (UB) covariance estimates (denominator n-1). The function covML can be used to obtain ML estimates, the function covUBtoML transforms from UB to ML estimates, and the function covMLtoUB transforms from UB to ML estimates.

covML(x, ...) covUBtoML(x, n, ...) covMLtoUB(x, n, ...)

Arguments

  • x: A dataset
  • n: The sample size
  • ...: Arguments sent to the cov function.

Author(s)

Sacha Epskamp mail@sachaepskamp.com

Examples

data("StarWars") Y <- StarWars[,1:10] # Unbiased estimate: UB <- cov(Y) # ML Estimate: ML <- covML(Y) # Check: all(abs(UB - covMLtoUB(ML, nrow(Y))) < sqrt(.Machine$double.eps)) all(abs(ML - covUBtoML(UB, nrow(Y))) < sqrt(.Machine$double.eps))
  • Maintainer: Sacha Epskamp
  • License: GPL-2
  • Last published: 2024-06-20