gammacap: Asymptotic Covariance Matrix

Description Usage Arguments Value Author(s) See Also Examples

View source: R/gammaMatrix-gammacap.R

Description

Calculates the covariance matrix of the unique elements of the covariance matrix.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
gammacap(
  x,
  type = "mvn",
  sigmacap = NULL,
  unbiased = TRUE,
  bcap = 1000L,
  seed = NULL,
  missing = FALSE,
  ml_cov = TRUE,
  names = TRUE,
  sep = "."
)

Arguments

x

Numeric matrix, data frame, or vector.

type

Character string. If type = "adf", calculate asymptotic distribution-free covariance matrix. If type = "adfnb", calculate nonparametric bootstrapped asymptotic distribution-free covariance matrix. If type = "gen", calculate covariance matrix using the general formula. If type = "mvn", calculate covariance matrix with multivariate normal data. If type = "mvnadj1", calculate covariance matrix with adjustment variant 1. If type = "mvnadj2", calculate covariance matrix with adjustment variant 2. If type = "nb", calculate covariance matrix from nonparametric bootstrapped covariances.

sigmacap

Numeric matrix. The argument is used when type = "mvn". Optional argument. Sample covariance matrix.

unbiased

Logical. The argument is used when type = "adf". If unbiased = TRUE, returns unbiased asymptotic distribution-free covariance matrix. If unbiased = FALSE, returns consistent asymptotic distribution-free covariance matrix.

bcap

Integer. The argument is used when type = "adfnb" or type = "nb". Number of bootstrap samples.

seed

Integer. The argument is used when type = "adfnb" or type = "nb". Random number generation seed.

missing

Logical. The argument is used when type = "mvnadj2". If missing = TRUE, the mean vector and the covariance matrix will be estimated using the EM algorithm. If missing = FALSE, all missing values will be dropped and the mean vector and covariance matrix will be estimated using x.

ml_cov

Logical. The argument is used when type = "mvnadj2". If missing = FALSE and ml_cov = TRUE, use maximum likelihood estimator of the covariance matrix.

names

Logical. Add names.

sep

Character string. Separator for variable names.

Value

A matrix.

Author(s)

Ivan Jacob Agaloos Pesigan

See Also

Other Gamma Matrix Functions: gammacap_adfnb(), gammacap_adf(), gammacap_gen(), gammacap_mvnadj1(), gammacap_mvnadj2(), gammacap_mvn(), gammacap_nb(), gammacap_ols_generic(), gammacap_ols_hc_generic(), gammacap_ols_hc_qcap_generic(), gammacap_ols_hc_qcap(), gammacap_ols_hc(), gammacap_ols(), gammacapnames()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
set.seed(42)
n <- 1000
k <- 2
q <- chol(
  matrix(
    data = c(1.0, 0.5, 0.5, 1.0),
    nrow = k, ncol = k
  )
)
z <- matrix(
  data = rnorm(n = n * k), nrow = n, ncol = k
)
x <- z %*% q

gammacap(x, type = "adf")
gammacap(x, type = "adfnb")
gammacap(x, type = "gen")
gammacap(x, type = "mvn")
gammacap(x, type = "mvnadj1")
gammacap(x, type = "mvnadj2")
gammacap(x, type = "nb")
gammacap(sigmacap = cov(x), type = "mvn")

jeksterslab/gammaMatrix documentation built on Dec. 20, 2021, 10:10 p.m.