R/RcppExports.R

Defines functions cluster_HC0 cluster_HC1 robust_HC0 robust_HC1 robust_HC2 robust_HC3 robust_HC4

Documented in cluster_HC0 cluster_HC1 robust_HC0 robust_HC1 robust_HC2 robust_HC3 robust_HC4

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' Cluster-Robust Variance-Covariance Matrix Estimator (HC0)
#' 
#' @param X the model matrix. Can be obtained by applying the function \code{model.matrix} on a \code{lm} object.
#' @param e vector of residuals. Can be obtained by applying the function \code{resid} on a \code{lm} object.
#' @param clust a integer vector of cluster indicators.
#' @return returns a cluster-robust variance-covariance matrix of type HC0.
cluster_HC0 <- function(X, e, clust) {
    .Call('_jars_cluster_HC0', PACKAGE = 'jars', X, e, clust)
}

#' Cluster-Robust Variance-Covariance Matrix Estimator (HC1)
#' 
#' @param X the model matrix. Can be obtained by applying the function \code{model.matrix} on a \code{lm} object.
#' @param e vector of residuals. Can be obtained by applying the function \code{resid} on a \code{lm} object.
#' @param clust a integer vector of cluster indicators.
#' @return returns a cluster-robust variance-covariance matrix of type HC1.
cluster_HC1 <- function(X, e, clust) {
    .Call('_jars_cluster_HC1', PACKAGE = 'jars', X, e, clust)
}

#' Heteroskedasticity-Robust Variance-Covariance Matrix Estimator (HC0)
#' 
#' @param X the model matrix. Can be obtained by applying the function \code{model.matrix} on a \code{lm} object.
#' @param e vector of residuals. Can be obtained by applying the function \code{resid} on a \code{lm} object.
#' @return returns a heteroskedasticity-robust variance-covariance matrix of type HC0.
#' @details The different types of robust estimators differ in their degrees-of-freedom corrections for finite sample bias.
#'     In the case of HC0, no corrections are made, so that the diagonal entries of the "meat" matrix, \eqn{\omega_i} are given as
#'     \deqn{\omega_i^2 = \hat{e}_{i}^2}
#'     where \eqn{\hat e_i} are the residuals of the model.
robust_HC0 <- function(X, e) {
    .Call('_jars_robust_HC0', PACKAGE = 'jars', X, e)
}

#' Heteroskedasticity-Robust Variance-Covariance Matrix Estimator (HC1)
#' 
#' @param X the model matrix. Can be obtained by applying the function \code{model.matrix} on a \code{lm} object.
#' @param e vector of residuals. Can be obtained by applying the function \code{resid} on a \code{lm} object.
#' @return returns a heteroskedasticity-robust variance-covariance matrix of type HC1.
#' @details The different types of robust estimators differ in their degrees-of-freedom corrections for finite sample bias.
#'     In the case of HC1, the diagonal entries of the "meat" matrix, \eqn{\omega_i} are given as
#'     \deqn{\omega_{i}^2 = \hat{e}_{i}^2 \Bigg( \frac{n}{n - k} \Bigg)}
#'     where \eqn{\hat e_i} are the residuals of the model, \eqn{n} is the sample size, and \eqn{k} is the number of predictors in the model.
robust_HC1 <- function(X, e) {
    .Call('_jars_robust_HC1', PACKAGE = 'jars', X, e)
}

#' Robust Variance-Covariance Matrix Estimator (HC2)
#' 
#' @param X the model matrix. Can be obtained by applying the function \code{model.matrix} on a \code{lm} object.
#' @param e vector of residuals. Can be obtained by applying the function \code{resid} on a \code{lm} object.
#' @return returns a heteroskedasticity-robust variance-covariance matrix of type HC2.
#' @details The different types of robust estimators differ in their degrees-of-freedom corrections for finite sample bias.
#'     In the case of HC2, the diagonal entries of the "meat" matrix, \eqn{\omega_i} are given as
#'     \deqn{\omega_i^2 = \frac{\hat e_i^2}{1 - h_{ii}}}
#'     where \eqn{\hat e_i} are the residuals of the model and \eqn{h_{ii}} is the \eqn{i}th diagonal of the hat-matrix.
robust_HC2 <- function(X, e) {
    .Call('_jars_robust_HC2', PACKAGE = 'jars', X, e)
}

#' Heteroskedasticity-Robust Variance-Covariance Matrix Estimator (HC3)
#' 
#' @param X the model matrix. Can be obtained by applying the function \code{model.matrix} on a \code{lm} object.
#' @param e vector of residuals. Can be obtained by applying the function \code{resid} on a \code{lm} object.
#' @return returns a heteroskedasticity-robust variance-covariance matrix of type HC3.
#' @details The different types of robust estimators differ in their degrees-of-freedom corrections for finite sample bias.
#'     In the case of HC3, the diagonal entries of the "meat" matrix, \eqn{\omega_i} are given as
#'     \deqn{\omega_i^2 = \frac{\hat e_i^2}{(1 - h_{ii})^2}}
#'     where \eqn{\hat e_i} are the residuals of the model and \eqn{h_{ii}} is the \eqn{i}th diagonal of the hat-matrix.
robust_HC3 <- function(X, e) {
    .Call('_jars_robust_HC3', PACKAGE = 'jars', X, e)
}

#' Heteroskedasticity-Robust Variance-Covariance Matrix Estimator (HC4)
#' 
#' @param X the model matrix. Can be obtained by applying the function \code{model.matrix} on a \code{lm} object.
#' @param e vector of residuals. Can be obtained by applying the function \code{resid} on a \code{lm} object.
#' @return returns a heteroskedasticity-robust variance-covariance matrix of type HC4.
#' @details The different types of robust estimators differ in their degrees-of-freedom corrections for finite sample bias.
#'     In the case of HC4, the diagonal entries of the "meat" matrix, \eqn{\omega_i} are given as
#'     \deqn{\omega_i^2 = \frac{\hat e_i^2}{(1 - h_{ii})^{\delta_i}}}
#'     where \eqn{\hat e_i} are the residuals of the model, \eqn{h_{ii}} is the \eqn{i}th diagonal of the hat-matrix, and
#'     \deqn{\delta_i = min(4, h_{ii}/\bar{h}),}
#'     where \eqn{\bar{h} = n^{-1}\sum_{i=1}^n h_{ii}}.
robust_HC4 <- function(X, e) {
    .Call('_jars_robust_HC4', PACKAGE = 'jars', X, e)
}
baruuum/jars documentation built on Nov. 3, 2019, 2:06 p.m.