gammacap_ols: Asymptotic Covariance Matrix for Ordinary Least Squares...

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/gammaMatrix-gammacap_ols.R

Description

Calculates the asymptotic covariance matrix of the unique elements of the covariance matrix using ordinary least squares estimates.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
gammacap_ols(
  x,
  type = "gen",
  adf_unbiased = TRUE,
  bcap = 1000L,
  seed = NULL,
  ke_unbiased = FALSE,
  yc = FALSE,
  names = TRUE,
  sep = "."
)

Arguments

x

Object of class lm.

type

Character string. Type of asymptotic covariance matrix of the regressors 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.

adf_unbiased

Logical. If adf_unbiased = TRUE, use unbiased asymptotic distribution-free covariance matrix. If adf_unbiased = FALSE, use consistent asymptotic distribution-free covariance matrix.

bcap

Integer. Number of bootstrap samples when type = "gen" and type = "adfnb".

seed

Integer. Random number generation seed when type = "gen" and type = "adfnb".

ke_unbiased

Logical. If ke_unbiased = TRUE, use estimator \frac{ \frac{1}{n} ∑_{i=1}^{n} \hat{\varepsilon}_{i}^{4} }{ ≤ft( \frac{1}{n - p - 1} ∑_{i=1}^{n} \hat{\varepsilon}_{i}^{2} \right)^2 } where the denominator is the square of the unbiased estimator of the error variance. If ke_unbiased = FALSE, use estimator \frac{ \frac{1}{n} ∑_{i=1}^{n} \hat{\varepsilon}_{i}^{4} }{ ≤ft( \frac{1}{n} ∑_{i=1}^{n} \hat{\varepsilon}_{i}^{2} \right)^2 } where the denominator is the square of the consistent estimator of the error variance.

yc

Logical. If yc = TRUE, order the output following Yuan and Chan (2011) page 674. If yc = FALSE, the order of the output following \mathrm{vech} ≤ft( Σ \right).

names

Logical. Add names.

sep

Character string. Separator for variable names.

Value

A matrix.

Author(s)

Ivan Jacob Agaloos Pesigan

References

Yuan, K.-H., & Chan, W. (2011). Biases and standard errors of standardized regression coefficients. Psychometrika, 76, 670–690. doi:10.1007/S11336-011-9224-6.

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(), gammacapnames(), gammacap()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
set.seed(42)
n <- 1000
k <- 2
z <- matrix(
  data = rnorm(n = n * k), nrow = n, ncol = k
)
q <- chol(
  matrix(
    data = c(1.0, 0.5, 0.5, 1.0),
    nrow = k, ncol = k
  )
)
x <- as.data.frame(z %*% q)
colnames(x) <- c("y", "x")
obj <- lm(y ~ x, data = x)

gammacap_ols(obj)

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