covML {psychonetrics} | R Documentation |
Maximum likelihood covariance estimate
Description
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.
Usage
covML(x, ...)
covUBtoML(x, n, ...)
covMLtoUB(x, n, ...)
Arguments
x |
A dataset |
n |
The sample size |
... |
Arguments sent to the |
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))
[Package psychonetrics version 0.13 Index]