collinearity_check: Checking for Perfect Multicollinearity

View source: R/utils.R

collinearity_checkR Documentation

Checking for Perfect Multicollinearity

Description

collinearity_check checks for perfect multicollinearity in a model with high-dimensional fixed effects. It calls lfe::demeanlist in order to partial out the fixed effects, and then uses stats::lm.wfit to discard linearly dependent variables.

Usage

collinearity_check(
  y,
  x = NULL,
  fes = NULL,
  hdfetol,
  colcheck_x_fes = TRUE,
  colcheck_x = TRUE
)

Arguments

y

Dependent variable (a numeric vector).

x

Regressor matrix.

fes

List of fixed effects.

hdfetol

Tolerance for the centering, passed on to lfe::demeanlist.

colcheck_x_fes

Logical. If TRUE, this checks whether the independent variables are perfectly explained by the fixed effects drops those that are perfectly explained.

colcheck_x

Logical. If TRUE, this checks collinearity between the independent variables and drops the collinear variables.

Value

A numeric vector containing the variables that pass the collinearity check.


penppml documentation built on Sept. 8, 2023, 5:58 p.m.