jmboehm / GLFixedEffectModels.jl

Fast estimation of generalized linear models with high dimensional categorical variables in Julia
Other
33 stars 6 forks source link

Error when running PPML with clustering #62

Open TilmanGraff opened 2 months ago

TilmanGraff commented 2 months ago

When running PPML with clustered standard errors via nlreg(..., Poission(), LogLink(), GLFixedEffectModels.Vcov.cluster(:xyz)), I occasionally get a new error: ERROR: ArgumentError: matrix contains Infs or NaNs. This error did not appear when running the same code a few months back. The underlying dataset itself contains no Inf or NaN entries.

Is this a known issue? Any hints very much appreciated! I am also happy to provide a MWE with the underlying data if helpful. Full error message below.

I am using Julia v1.9.2 on Mac OS X 14.4.1. I am also posting my ] status below.

Thank you!

[ Info: 888 observations detected as singletons. Dropping them ...
ERROR: ArgumentError: matrix contains Infs or NaNs
Stacktrace:
  [1] chkuplofinite(A::Matrix{Float64}, uplo::Char)
    @ LinearAlgebra.LAPACK ~/.julia/juliaup/julia-1.9.2+0.x64.apple.darwin14/share/julia/stdlib/v1.9/LinearAlgebra/src/lapack.jl:98
  [2] syevr!(jobz::Char, range::Char, uplo::Char, A::Matrix{Float64}, vl::Float64, vu::Float64, il::Int64, iu::Int64, abstol::Float64)
    @ LinearAlgebra.LAPACK ~/.julia/juliaup/julia-1.9.2+0.x64.apple.darwin14/share/julia/stdlib/v1.9/LinearAlgebra/src/lapack.jl:5082
  [3] #eigen!#204
    @ ~/.julia/juliaup/julia-1.9.2+0.x64.apple.darwin14/share/julia/stdlib/v1.9/LinearAlgebra/src/symmetriceigen.jl:8 [inlined]
  [4] eigen!
    @ ~/.julia/juliaup/julia-1.9.2+0.x64.apple.darwin14/share/julia/stdlib/v1.9/LinearAlgebra/src/symmetriceigen.jl:8 [inlined]
  [5] eigen(A::Symmetric{Float64, Matrix{Float64}}; sortby::Nothing)
    @ LinearAlgebra ~/.julia/juliaup/julia-1.9.2+0.x64.apple.darwin14/share/julia/stdlib/v1.9/LinearAlgebra/src/symmetriceigen.jl:13
  [6] eigen
    @ ~/.julia/juliaup/julia-1.9.2+0.x64.apple.darwin14/share/julia/stdlib/v1.9/LinearAlgebra/src/symmetriceigen.jl:11 [inlined]
  [7] pinvertible(A::Symmetric{Float64, Matrix{Float64}}, tol::Float64)
    @ Vcov ~/.julia/packages/Vcov/MUQ52/src/utils.jl:2
  [8] pinvertible
    @ ~/.julia/packages/Vcov/MUQ52/src/utils.jl:2 [inlined]
  [9] vcov(x::GLFixedEffectModels.VcovDataGLM{Cholesky{Float64, Matrix{Float64}}, Matrix{Float64}, 1}, v::Vcov.ClusterCovariance)
    @ GLFixedEffectModels ~/.julia/packages/GLFixedEffectModels/EYMkw/src/utils/vcov.jl:29
 [10] nlreg(df::Any, formula::FormulaTerm, distribution::Poisson{Float64}, link::LogLink, vcov::CovarianceEstimator; weights::Union{Nothing, Symbol}, subset::Union{Nothing, AbstractVector}, start::Union{Nothing, AbstractVector}, maxiter_center::Int64, maxiter::Int64, contrasts::Dict{Symbol, Any}, dof_add::Int64, save::Vector{Symbol}, method::Symbol, drop_singletons::Bool, double_precision::Bool, dev_tol::Float64, rho_tol::Float64, step_tol::Float64, center_tol::Float64, separation::Vector{Symbol}, separation_mu_lbound::Float64, separation_mu_ubound::Float64, separation_ReLU_tol::Float64, separation_ReLU_maxiter::Int64, vcovformula::Union{Nothing, Expr, Symbol}, subsetformula::Union{Nothing, Expr, Symbol}, verbose::Bool)
    @ GLFixedEffectModels ~/.julia/packages/GLFixedEffectModels/EYMkw/src/fit.jl:553
 [11] nlreg
    @ ~/.julia/packages/GLFixedEffectModels/EYMkw/src/fit.jl:40 [inlined]

] status
 [69666777] Arrow v2.7.2
  [6e4b80f9] BenchmarkTools v1.5.0
  [deae81f5] Binscatters v0.2.2
  [336ed68f] CSV v0.10.14
  [861a8166] Combinatorics v1.0.2
  [a93c6f00] DataFrames v1.6.1
  [1313f7d8] DataFramesMeta v0.15.2
  [8bb1440f] DelimitedFiles v1.9.1
  [31c24e10] Distributions v0.25.109
  [26cc04aa] FiniteDifferences v0.12.32
  [9d5cd8c9] FixedEffectModels v1.11.0
  [c8885935] FixedEffects v2.4.0
  [197bc772] FloatingTableView v0.2.0
  [59287772] Formatting v0.4.3
  [da1fdf0e] FreqTables v0.4.6
  [bafb0ae5] GLFixedEffectModels v0.5.4
  [38e38edf] GLM v1.9.0
  [a7eae07c] GMMTools v0.1.0 `https://github.com/Gkreindler/GMMTools.jl#cmd`
  [033835bb] JLD2 v0.4.48
  [682c06a0] JSON v0.21.4
  [d3d80556] LineSearches v7.2.0
  [e1d29d7a] Missings v1.2.0
  [86f7a689] NamedArrays v0.10.2
  [429524aa] Optim v1.9.4
  [626c502c] Parquet v0.8.4
  [91a5bcdd] Plots v1.40.4
  [8162dcfd] PrettyPrint v0.2.0
  [ce6b1742] RDatasets v0.7.7
  [d519eb52] RegressionTables v0.7.5
  [295af30f] Revise v3.5.14
  [f2b01f46] Roots v2.1.5
  [1463e38c] StatFiles v0.8.0
  [2913bbd2] StatsBase v0.34.3
  [3eaba693] StatsModels v0.7.3
  [40c74d1a] TableView v0.7.2
  [a759f4b9] TimerOutputs v0.5.24
  [770da0de] UpdateJulia v0.4.4
  [9a3f8284] Random
  [10745b16] Statistics v1.9.0