Overall Intercept for Within Models Along its Standard Error

This function gives an overall intercept for within models and its accompanying standard error

within_intercept(object, ...)

# S3 method for plm within_intercept(object, vcov = NULL, ...)


object of class plm which must be a within model (fixed effects model),

further arguments (currently none).


if not NULL (default), a function to calculate a user defined variance--covariance matrix (function for robust vcov),


The (somewhat artificial) intercept for within models (fixed effects models) was made popular by Stata of StataCorp @see @GOUL:13plm, EViews of IHS, and gretl @gretl p. 160-161, example 18.1plm, see for treatment in the literature, e.g. GREE:12;textualplm, Ch. 11.4.4, p. 364. It can be considered an overall intercept in the within model framework and is the weighted mean of fixed effects (see Examples for the relationship).

within_intercept estimates a new model which is computationally more demanding than just taking the weighted mean. However, with within_intercept one also gets the associated standard error and it is possible to get an overall intercept for twoway fixed effect models.

Users can set argument vcov to a function to calculate a specific (robust) variance--covariance matrix and get the respective (robust) standard error for the overall intercept, e.g. the function vcovHC(), see examples for usage. Note: The argument vcov must be a function, not a matrix, because the model to calculate the overall intercept for the within model is different from the within model itself.


A named numeric of length one: The overall intercept for the estimated within model along attribute "se" which contains the standard error for the intercept.


See Also

fixef() to extract the fixed effects of a within model.

  • within_intercept
  • within_intercept.plm
data("Hedonic", package = "plm")
mod_fe <- plm(mv ~ age + crim, data = Hedonic, index = "townid")
overallint <- within_intercept(mod_fe)
attr(overallint, "se") # standard error

# overall intercept is the weighted mean of fixed effects in the
# one-way case
weighted.mean(fixef(mod_fe), as.numeric(table(index(mod_fe)[[1]])))

# relationship of type="dmean", "level" and within_intercept in the
# one-way case
data("Grunfeld", package = "plm")
gi <- plm(inv ~ value + capital, data = Grunfeld, model = "within")
fx_level <- fixef(gi, type = "level")
fx_dmean <- fixef(gi, type = "dmean")
overallint <- within_intercept(gi)
all.equal(overallint + fx_dmean, fx_level, check.attributes = FALSE) # TRUE

# overall intercept with robust standard error
within_intercept(gi, vcov = function(x) vcovHC(x, method="arellano", type="HC0"))

# }
Documentation reproduced from package plm, version 2.2-5, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.