Skip to content

A bug that happens to multi-FE models with clustered SE when missing is allowed #3

@caibengbu

Description

@caibengbu

Hi all,

Thanks a lot for the great package!

I am running into a small bug while working with your package, however. My FixedEffectModels.jl version is v1.6.5 and I am running on Mac OS. Here is a minimal reproducible example:

df = DataFrame(Y=rand(10),X=rand(10),cat1=repeat([1,2],inner=5),cat2=repeat([1,2],outer=5))
allowmissing!(df)
reg(df,@formula(Y~X+fe(cat1)+fe(cat2)),Vcov.cluster(:cat1,:cat2))

I got ERROR: BoundsError: attempt to access 3-element GroupedArrays.GroupedRefPool{Union{Missing, Int64}} with indices 0:2 at index [3]. I briefly looked into what happened, it seems like function refpool_and_array at /src/utils.jl:138 generated a vector refpool that equals to [missing, 1, 2] with index [0:2] and findfirst can't deal with it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions