Skip to content

Commit

Permalink
Fix 2SLS drop linearly dependent check fix (#82)
Browse files Browse the repository at this point in the history
Fixes #78.
  • Loading branch information
Nosferican authored Dec 5, 2022
1 parent 0146365 commit 1e0fb4d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/solvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ end
bkr = count(x -> abs(x) eps(), F.D)
if bkr < size(F, 2)
lin_ind = sort!(invperm(F.p)[1:bkr])
count(x -> lin_ind > size(X, 2) + 1) size(z, 2) ||
F₀ = bunchkaufman(Hermitian(X' * Diagonal(w) * X), true, check = false)
num_of_linear_independent_exogenous_vars = count(x -> abs(x) eps(), F₀.D)
(length(lin_ind) - num_of_linear_independent_exogenous_vars) size(z, 2) ||
throw(ArgumentError("Insufficient number of instruments."))
= Z̃[:,lin_ind]
F = bunchkaufman(Hermitian(Z̃' * Diagonal(w) * Z̃), true)
Expand Down

0 comments on commit 1e0fb4d

Please sign in to comment.