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

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

View source: R/gammaMatrix-gammacap_ols_generic.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
12
13
14
gammacap_ols_generic(
  x,
  beta,
  sigmacap,
  sigmasq,
  ke,
  type = "gen",
  adf_unbiased = TRUE,
  bcap = 5000L,
  seed = NULL,
  yc = FALSE,
  names = TRUE,
  sep = "."
)

Arguments

x

Numeric matrix, data frame, or vector. Values for regressor variables.

beta

Numeric vector. Partial regression slopes.

sigmacap

Numeric matrix. Covariance matrix \boldsymbol{Σ} of \{y, x_1, \cdots, x_p \}^{\prime}.

sigmasq

Numeric. Error variance σ^2.

ke

Numeric. Kurtosis of errors.

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".

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.

Dependencies

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_hc_generic(), gammacap_ols_hc_qcap_generic(), gammacap_ols_hc_qcap(), gammacap_ols_hc(), gammacap_ols(), gammacapnames(), gammacap()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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)
beta <- coef(obj)[-1]
sigmacap <- cov(x)
sigmasq <- summary(obj)$sigma^2
ke <- 3

gammacap_ols_generic(
  x[, -1],
  beta = beta,
  sigmacap = sigmacap,
  sigmasq = sigmasq,
  ke = ke
)

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