covML: Maximum likelihood covariance estimate

Description Usage Arguments Author(s) Examples

View source: R/f_convenience_covML.R

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

1
2
3
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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))

Example output

Registered S3 methods overwritten by 'huge':
  method    from   
  plot.sim  BDgraph
  print.sim BDgraph
This is psychonetrics 0.8! Note: this is BETA software! Please mind that the package may not be stable and report any bugs! For more information, please see psychonetrics.org, for questions and issues, please see github.com/SachaEpskamp/psychonetrics.

Attaching package:psychonetricsThe following object is masked frompackage:graphics:

    identify

[1] TRUE
[1] TRUE

psychonetrics documentation built on Oct. 26, 2021, 1:06 a.m.