# How to report intercept iterm in FixedEffectModels?

**URL:** <https://discourse.julialang.org/t/how-to-report-intercept-iterm-in-fixedeffectmodels/83386>\
**Category:** General Usage\
**Created:** [June 27, 2022, 8:42am UTC](https://discourse.julialang.org/t/how-to-report-intercept-iterm-in-fixedeffectmodels/83386 "2022-06-27T08:42:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raymond](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raymond/32/36557_2.png) [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Post date:** [June 27, 2022, 8:42am UTC](https://discourse.julialang.org/t/how-to-report-intercept-iterm-in-fixedeffectmodels/83386/1 "2022-06-27T08:42:19Z")

</div>

Dear all,

In `FixedEffectModels` with `fe`, the result doesn’t report intercept term. Anyone knows how to report constant term?

```julia
julia> df = dataset("plm", "GrunFeld")
julia> reg(df, @formula(Inv ~ Value + Capital + Year + fe(Firm)))
                        Fixed Effect Model
==================================================================
Number of obs: 200 Degrees of freedom: 13
R2: 0.947 R2 Adjusted: 0.943
F-Stat: 219.159 p-value: 0.000
R2 within: 0.779 Iterations: 1
==================================================================
Inv | Estimate Std.Error t value Pr(>|t|) Lower 95% Upper 95%
------------------------------------------------------------------
Value | 0.110721 0.0115852 9.5571 0.000 0.0878662 0.133575
Capital | 0.353577 0.0218494 16.1824 0.000 0.310474 0.39668
Year | -2.66422 0.843852 -3.15721 0.002 -4.32891 -0.999525
==================================================================

```

In Stata, it always report intercept term.

```julia
. xtreg inv mv ks c.year, fe

Fixed-effects (within) regression Number of obs = 200
Group variable: company Number of groups = 10

R-squared: Obs per group:
     Within = 0.7786 min = 20
     Between = 0.8108 avg = 20.0
     Overall = 0.8010 max = 20

                                                F(3,187) = 219.16
corr(u_i, Xb) = -0.2367 Prob > F = 0.0000

------------------------------------------------------------------------------
      invest | Coefficient Std. err. t P>|t| [95% conf. interval]
-------------+----------------------------------------------------------------
      mvalue | 0.1107 0.0116 9.56 0.000 0.0879 0.1336
      kstock | 0.3536 0.0218 16.18 0.000 0.3105 0.3967
        year | -2.6642 0.8439 -3.16 0.002 -4.3289 -0.9995
       _cons | 5109.1716 1636.9071 3.12 0.002 1879.9942 8338.3489
-------------+----------------------------------------------------------------
     sigma_u | 89.64192
     sigma_e | 51.552705
         rho | .75146422 (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0: F(9, 187) = 52.51 Prob > F = 0.0000

```

In econometrics, we often need to report intercept term.

---

<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:** [June 27, 2022, 9:01am UTC](https://discourse.julialang.org/t/how-to-report-intercept-iterm-in-fixedeffectmodels/83386/2 "2022-06-27T09:01:06Z")

</div>

I’d say Stata is the odd one out here, it’s common not to report an intercept in fixed effect models (as it would be collinear with the fixed effects).

See here for what Stata does, you should be able to replicate this with FixedEffectModels:

> **[FAQ: Interpreting the intercept in the fixed-effects model | Stata](https://www.stata.com/support/faqs/statistics/intercept-in-fixed-effects-model/)**
>
> How can there be an intercept in the fixed-effects model estimated by xtreg, fe?

---

<div class="post-metadata">

**Author:** ![Raymond](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raymond/32/36557_2.png) [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Post date:** [June 27, 2022, 9:02am UTC](https://discourse.julialang.org/t/how-to-report-intercept-iterm-in-fixedeffectmodels/83386/3 "2022-06-27T09:02:17Z")

</div>

I try to use `Econometrics`, Then I can get the constant term. But it can not be reported by `RegressionTables`.

```julia
julia> using Econometrics
[Info: Precompiling Econometrics [4d6a76a9-bfbc-5492-8924-cf6ed7875f06]

help?> Econometrics
search: Econometrics EconometricsMLJModel EconometricModel

  Econometrics

  Econometrics in Julia.

julia> model = fit(EconometricModel, @formula(Inv ~ Value + Capital + Year + absorb(Firm)), df)
Continuous Response Model
Number of observations: 200
Null Loglikelihood: -1359.15
Loglikelihood: -1065.81
R-squared: 0.9469
Wald: 219.16 ∼ F(3, 187) ⟹ Pr > F = 0.0000
Formula: Inv ~ 1 + Value + Capital + Year + absorb(Firm)
Variance Covariance Estimator: OIM
─────────────────────────────────────────────────────────────────────────────────────
                   PE SE t-value Pr > |t| 2.50% 97.50%
─────────────────────────────────────────────────────────────────────────────────────
(Intercept) 5109.17 1636.91 3.12124 0.0021 1879.99 8338.35
Value 0.110721 0.0115852 9.5571 <1e-17 0.0878662 0.133575
Capital 0.353577 0.0218494 16.1824 <1e-36 0.310474 0.39668
Year -2.66422 0.843852 -3.15721 0.0019 -4.32891 -0.999525
─────────────────────────────────────────────────────────────────────────────────────

julia> using RegressionTables

julia> regtable(model)
ERROR: MethodError: Cannot `convert` an object of type Vector{String} to an object of type String
Closest candidates are:
  convert(::Type{S}, ::CategoricalValue) where S<:Union{AbstractChar, AbstractString, Number} at ~/.julia/packages/CategoricalArrays/Fr04b/src/value.jl:79
  convert(::Type{String}, ::FilePathsBase.AbstractPath) at ~/.julia/packages/FilePathsBase/dVWLK/src/path.jl:117
  convert(::Type{String}, ::WeakRefStrings.WeakRefString) at ~/.julia/packages/WeakRefStrings/31nkb/src/WeakRefStrings.jl:81

```

---

<div class="post-metadata">

**Author:** ![Raymond](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raymond/32/36557_2.png) [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Post date:** [June 27, 2022, 9:21am UTC](https://discourse.julialang.org/t/how-to-report-intercept-iterm-in-fixedeffectmodels/83386/4 "2022-06-27T09:21:18Z")

</div>

But `Econometrics.jl` also report intercept term.
