gammacap_ols_hc_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_hc_generic.R

Description

Asymptotic Covariance Matrix for Ordinary Least Squares Regression with Sandwich Type Adjustments - Generic

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
gammacap_ols_hc_generic(
  x,
  h = NULL,
  type = "hc5",
  g1 = 1,
  g2 = 1.5,
  constant = 0.7,
  names = TRUE,
  sep = "."
)

Arguments

x

Numeric matrix or data frame. Data matrix for \{ y, x_1, \cdots, x_p \}.

h

Numeric vector. Leverage values.

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.

g1

Numeric. g1 value for type = "hc4m" or type = "hc5".

g2

Numeric. g2 value for type = "hc4m".

constant

Numeric. Constant for type = "hc5"

names

Logical. Add names.

sep

Character string. Separator for variable names.

Value

A matrix

Dependencies

Author(s)

Ivan Jacob Agaloos Pesigan

References

Dudgeon, P. (2017). Some improvements in confidence intervals for standardized regression coefficients. Psychometrika, 82, 928-951. doi:10.1007/s11336-017-9563-z.

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_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
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)
h <- hatvalues(obj)

gammacap_ols_hc_generic(x, h = h)

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