Variance-Covariance Matrix of Estimates of Regression Coefficients (from \(\hat{\sigma}_{\varepsilon \ \textrm{biased}}^{2}\))

vcovhatbetahatbiased(X, y)

Arguments

X

n by k numeric matrix. The data matrix \(\mathbf{X}\) (also known as design matrix, model matrix or regressor matrix) is an \(n \times k\) matrix of \(n\) observations of \(k\) regressors, which includes a regressor whose value is 1 for each observation on the first column.

y

Numeric vector of length n or n by 1 matrix. The vector \(\mathbf{y}\) is an \(n \times 1\) vector of observations on the regressand variable.

References

Wikipedia: Linear Regression

Wikipedia: Ordinary Least Squares

See also

Other variance-covariance of estimates of regression coefficients functions: .vcovhatbetahatbiased(), .vcovhatbetahat(), vcovhatbetahat()

Author

Ivan Jacob Agaloos Pesigan

Examples

# Simple regression------------------------------------------------ X <- jeksterslabRdatarepo::wages.matrix[["X"]] X <- X[, c(1, ncol(X))] y <- jeksterslabRdatarepo::wages.matrix[["y"]] vcovhatbetahatbiased(X = X, y = y)
#> [,1] [,2] #> [1,] 0.52768142 -0.0127413411 #> [2,] -0.01274134 0.0003358744
# Multiple regression---------------------------------------------- X <- jeksterslabRdatarepo::wages.matrix[["X"]] # age is removed X <- X[, -ncol(X)] vcovhatbetahatbiased(X = X, y = y)
#> [,1] [,2] [,3] [,4] [,5] #> [1,] 1.027022064 -7.735991e-02 -0.0846131979 -0.003602315 -0.0611951523 #> [2,] -0.077359906 1.323261e-01 -0.0087482453 0.016412105 0.0006846205 #> [3,] -0.084613198 -8.748245e-03 0.2580651020 -0.024393100 0.0032580499 #> [4,] -0.003602315 1.641211e-02 -0.0243930997 0.254922876 -0.0012844045 #> [5,] -0.061195152 6.846205e-04 0.0032580499 -0.001284404 0.0043231481 #> [6,] -0.007340509 6.831423e-05 0.0005628159 -0.001303368 0.0001986687 #> [,6] #> [1,] -7.340509e-03 #> [2,] 6.831423e-05 #> [3,] 5.628159e-04 #> [4,] -1.303368e-03 #> [5,] 1.986687e-04 #> [6,] 2.563254e-04