Skip to content

Ignore rows with Infs? #214

@jmboehm

Description

@jmboehm

The following seems like a 'classic' trap:

using FixedEffectModels, RDatasets
df = dataset("plm", "Cigar")
# assume some entries are Inf
df.Sales[1] = 0.0
df.logsales = log.(df.Sales)
reg(df, @formula(logsales ~ NDI + fe(State) + fe(Year)), Vcov.cluster(:State), weights = :Pop)

gives

ERROR: "Some observations for the dependent variable are infinite"
Stacktrace:
 [1] reg(df::Any, formula::FormulaTerm, vcov::StatsBase.CovarianceEstimator; contrasts::Dict, weights::Union{Nothing, Symbol}, save::Union{Bool, Symbol}, method::Symbol, nthreads::Integer, double_precision::Bool, tol::Real, maxiter::Integer, drop_singletons::Bool, progress_bar::Bool, dof_add::Integer, subset::Union{Nothing, AbstractVector}, first_stage::Bool)
   @ FixedEffectModels ~/.julia/packages/FixedEffectModels/kJPKw/src/fit.jl:176
 [2] top-level scope
   @ REPL[9]:1

I feel the package could automatically drop rows where the regressand or one of the regressors is infinite, similarly to how it does with missings. What's the argument against that?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions