covML {psychonetrics} | R Documentation |
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, ...)
x |
A dataset |
n |
The sample size |
... |
Arguments sent to the |
Sacha Epskamp <mail@sachaepskamp.com>
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))