# Getting an error for FixedEffectModels

**URL:** <https://discourse.julialang.org/t/getting-an-error-for-fixedeffectmodels/76498>\
**Category:** General Usage\
**Created:** [February 15, 2022, 5:35pm UTC](https://discourse.julialang.org/t/getting-an-error-for-fixedeffectmodels/76498 "2022-02-15T17:35:43Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![rubaiyat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rubaiyat/32/27423_2.png) [@rubaiyat](https://discourse.julialang.org/u/rubaiyat)\
**Post date:** [February 15, 2022, 5:35pm UTC](https://discourse.julialang.org/t/getting-an-error-for-fixedeffectmodels/76498/1 "2022-02-15T17:35:43Z")

</div>

Hello everyone,

Recently I updated all my packages on Julia 1.6 via Pkg.update() and also ]up, and since then the regressions I had previously been running using FixedEffectModels.reg are not working anymore.

Here’s a minimum working example:

```julia
using CSV, DataFrames

using FixedEffectModels

using DataFramesMeta

df = DataFrame(var1 = rand(9), var2 = rand(9), var3 = rand(9), var4 = rand(9) )

FixedEffectModels.reg(df, @formula(var1 ~ var2 + var3 + var4))

```

And here’s the error I get:

```julia
Error showing value of type FixedEffectModel:
ERROR: MethodError: no method matching stderror(::FixedEffectModel)
Closest candidates are:
  stderror(::Union{StatsModels.TableRegressionModel, StatsModels.TableStatisticalModel}, ::Any...; kwargs...) at /home/rubaiyat/.julia/packages/StatsModels/m1jYD/src/statsmodel.jl:28
Stacktrace:
  [1] show(io::IOContext{Base.TTY}, x::FixedEffectModel)
    @ FixedEffectModels ~/.julia/packages/FixedEffectModels/0oavj/src/FixedEffectModel.jl:204
  [2] show(io::IOContext{Base.TTY}, #unused#::MIME{Symbol("text/plain")}, x::FixedEffectModel)
    @ Base.Multimedia ./multimedia.jl:47
  [3] (::REPL.var"#38#39"{REPL.REPLDisplay{REPL.LineEditREPL}, MIME{Symbol("text/plain")}, Base.RefValue{Any}})(io::Any)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:220
  [4] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:462
  [5] display(d::REPL.REPLDisplay, mime::MIME{Symbol("text/plain")}, x::Any)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:213
  [6] display(d::REPL.REPLDisplay, x::Any)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:225
  [7] display(x::Any)
    @ Base.Multimedia ./multimedia.jl:328
  [8] #invokelatest#2
    @ ./essentials.jl:708 [inlined]
  [9] invokelatest
    @ ./essentials.jl:706 [inlined]
 [10] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay})
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:247
 [11] (::REPL.var"#40#41"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:231
 [12] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:462
 [13] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:229
 [14] (::REPL.var"#do_respond#61"{Bool, Bool, REPL.var"#72#82"{REPL.LineEditREPL, REPL.REPLHistoryProvider}, REPL.LineEditREPL, REPL.LineEdit.Prompt})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:798
 [15] #invokelatest#2
    @ ./essentials.jl:708 [inlined]
 [16] invokelatest
    @ ./essentials.jl:706 [inlined]
 [17] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/LineEdit.jl:2441
 [18] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:1126
 [19] (::REPL.var"#44#49"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL ./task.jl:411

```

Any help on what could be causing this? I just used ]up right now and here’s my output, in case it helps.

```julia
(@v1.6) pkg> up
    Updating registry at `~/.julia/registries/General`
    Updating registry at `~/.julia/registries/JuliaComputingRegistry`
   Installed GR_jll ──────────── v0.64.0+0
   Installed FiniteDifferences ─ v0.12.23
   Installed StaticArrays ────── v1.3.5
   Installed Plots ───────────── v1.25.10
   Installed GR ──────────────── v0.64.0
  Downloaded artifact: GR
    Updating `~/.julia/environments/v1.6/Project.toml`
  [26cc04aa] ↑ FiniteDifferences v0.12.22 ⇒ v0.12.23
  [91a5bcdd] ↑ Plots v1.25.9 ⇒ v1.25.10
    Updating `~/.julia/environments/v1.6/Manifest.toml`
  [26cc04aa] ↑ FiniteDifferences v0.12.22 ⇒ v0.12.23
  [28b8d3ca] ↑ GR v0.63.1 ⇒ v0.64.0
  [91a5bcdd] ↑ Plots v1.25.9 ⇒ v1.25.10
  [90137ffa] ↑ StaticArrays v1.3.4 ⇒ v1.3.5
  [d2c73de3] ↑ GR_jll v0.63.1+0 ⇒ v0.64.0+0
    Building GR → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/9f836fb62492f4b0f0d3b06f55983f2704ed0883/build.log`
Precompiling project...
  ? FixedEffects
  ? Vcov
  ? StatsFuns
  ? Distributions
  ? StatsModels
  ? FixedEffectModels
  ? BlackBoxOptim
  ? GLM
  ? ForwardDiff
  ? JuMP
  ? NLSolversBase
  ? LineSearches
  ? Plots
  ? Optim
  14 dependencies successfully precompiled in 28 seconds (216 already precompiled, 1 skipped during auto due to previous errors)
  14 dependencies failed but may be precompilable after restarting julia

```

As I mentioned I haven’t updated to Julia 1.7 yet, could that be causing the issue?

Thanks!

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [February 15, 2022, 6:02pm UTC](https://discourse.julialang.org/t/getting-an-error-for-fixedeffectmodels/76498/2 "2022-02-15T18:02:32Z")

</div>

I can’t replicate. This does not mean that your error doesn’t exist or that there is nothing to be fixed.

Try everything in a new environment. In a new session, run

```julia
] activate --temp
] add DataFramesMeta, CSV, FixedEffectModels
df = DataFrame(var1 = rand(9), var2 = rand(9), var3 = rand(9), var4 = rand(9) )

FixedEffectModels.reg(df, @formula(var1 ~ var2 + var3 + var4))

```

and see if the error persists.

---

<div class="post-metadata">

**Author:** ![rubaiyat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rubaiyat/32/27423_2.png) [@rubaiyat](https://discourse.julialang.org/u/rubaiyat)\
**Post date:** [February 15, 2022, 6:10pm UTC](https://discourse.julialang.org/t/getting-an-error-for-fixedeffectmodels/76498/3 "2022-02-15T18:10:58Z")

</div>

Still getting the same error unfortunately.

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [February 15, 2022, 7:16pm UTC](https://discourse.julialang.org/t/getting-an-error-for-fixedeffectmodels/76498/4 "2022-02-15T19:16:22Z")

</div>

Darn.

What’s the ouptut of `] status`? There is [this commit](https://github.com/FixedEffects/FixedEffectModels.jl/commit/608bf2858956eb7127e2a3180e2bc0adc83d2aad) from a long time ago about `stderr` vs `stderror`. Maybe you have a super super old version?

---

<div class="post-metadata">

**Author:** ![rubaiyat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rubaiyat/32/27423_2.png) [@rubaiyat](https://discourse.julialang.org/u/rubaiyat)\
**Post date:** [February 15, 2022, 7:27pm UTC](https://discourse.julialang.org/t/getting-an-error-for-fixedeffectmodels/76498/5 "2022-02-15T19:27:32Z")

</div>

Here’s the output

```julia
   Status `/tmp/jl_lvLqni/Project.toml`
  [336ed68f] CSV v0.10.2
  [1313f7d8] DataFramesMeta v0.10.0
  [9d5cd8c9] FixedEffectModels v1.6.4

```

Looks like I’m on the latest version of FixedEffectModels.

---

<div class="post-metadata">

**Author:** ![rubaiyat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rubaiyat/32/27423_2.png) [@rubaiyat](https://discourse.julialang.org/u/rubaiyat)\
**Post date:** [February 15, 2022, 7:28pm UTC](https://discourse.julialang.org/t/getting-an-error-for-fixedeffectmodels/76498/6 "2022-02-15T19:28:26Z")

</div>

In the output for ]up that I posted above, there are ?s after FixedEffectModels and says there is a failure to precompile. Could that mean something?

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [February 15, 2022, 7:47pm UTC](https://discourse.julialang.org/t/getting-an-error-for-fixedeffectmodels/76498/7 "2022-02-15T19:47:08Z")

</div>

yeah probably. Please file an issue with FixedEffectModels.jl.

@nilshg and @matthieu might have something to say in the meantime.

I’m on 1.7.2 with the following versions which help. Maybe you can try pinning those versions

```julia
pkg> st
      Status `/tmp/jl_OLasno/Project.toml`
  [336ed68f] CSV v0.10.2
  [1313f7d8] DataFramesMeta v0.10.0
  [9d5cd8c9] FixedEffectModels v1.6.4

```

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [February 15, 2022, 8:11pm UTC](https://discourse.julialang.org/t/getting-an-error-for-fixedeffectmodels/76498/8 "2022-02-15T20:11:53Z")

</div>

I can reproduce this on 1.7.2 and FixedEffectModels v.1.6.4. Tests fail locally as well, which is odd given that the package hasn’t been changed since August last year.

No idea what’s going on unfortunately and currently no time to investigate, but definitely worth filing an issue!

---

<div class="post-metadata">

**Author:** ![junder873](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@junder873](https://discourse.julialang.org/u/junder873)\
**Post date:** [February 15, 2022, 8:45pm UTC](https://discourse.julialang.org/t/getting-an-error-for-fixedeffectmodels/76498/9 "2022-02-15T20:45:35Z")

</div>

I did a little digging on this. the `stderror` function was defined by [StatsBase.jl](https://github.com/JuliaStats/StatsBase.jl), the most recent release release moved that and some other functions to [StatsAPI.jl](https://github.com/JuliaStats/StatsAPI.jl) and did not define the same function. In StatsBase, it was:

```julia
stderror(model::StatisticalModel) = sqrt.(diag(vcov(model)))

```

In StatsAPI it is now:

```julia
function stderror end

```

I don’t know if there was a reason that function was skipped or if it was just overlooked (since most of the other functions that StatsBase defined in that section would just result in an error).

As a temporary fix, I think you can just add a function for FixedEffectModels:

```julia
FixedEffectModels.stderror(model::StatisticalModel) = sqrt.(diag(vcov(model)))

```

---

<div class="post-metadata">

**Author:** ![nalimilan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nalimilan/32/147_2.png) [@nalimilan](https://discourse.julialang.org/u/nalimilan)\
**Post date:** [February 15, 2022, 9:23pm UTC](https://discourse.julialang.org/t/getting-an-error-for-fixedeffectmodels/76498/10 "2022-02-15T21:23:59Z")

</div>

I just realized the same. See [https://github.com/JuliaStats/StatsAPI.jl/pull/9](https://github.com/JuliaStats/StatsAPI.jl/pull/9).

---

<div class="post-metadata">

**Author:** ![nalimilan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nalimilan/32/147_2.png) [@nalimilan](https://discourse.julialang.org/u/nalimilan)\
**Post date:** [February 15, 2022, 10:08pm UTC](https://discourse.julialang.org/t/getting-an-error-for-fixedeffectmodels/76498/11 "2022-02-15T22:08:51Z")

</div>

OK, it should be fixed now if you upgrade to StatsAPI 1.2.1.

---

<div class="post-metadata">

**Author:** ![rubaiyat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rubaiyat/32/27423_2.png) [@rubaiyat](https://discourse.julialang.org/u/rubaiyat)\
**Post date:** [February 16, 2022, 3:02pm UTC](https://discourse.julialang.org/t/getting-an-error-for-fixedeffectmodels/76498/12 "2022-02-16T15:02:37Z")

</div>

It works, thanks for the help everyone!

---

<div class="post-metadata">

**Author:** ![matthieu](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@matthieu](https://discourse.julialang.org/u/matthieu)\
**Post date:** [February 18, 2022, 6:58pm UTC](https://discourse.julialang.org/t/getting-an-error-for-fixedeffectmodels/76498/13 "2022-02-18T18:58:59Z")

</div>

Thanks everyone for fixing the issue!
