# fixef.plm

##### Extract the Fixed Effects

Function to extract the fixed effects from a `plm`

object and
associated summary method.

- Keywords
- regression

##### Usage

```
# S3 method for plm
fixef(
object,
effect = NULL,
type = c("level", "dfirst", "dmean"),
vcov = NULL,
...
)
```# S3 method for fixef
print(
x,
digits = max(3, getOption("digits") - 2),
width = getOption("width"),
...
)

# S3 method for fixef
summary(object, ...)

# S3 method for summary.fixef
print(
x,
digits = max(3, getOption("digits") - 2),
width = getOption("width"),
...
)

# S3 method for pggls
fixef(
object,
effect = NULL,
type = c("level", "dfirst", "dmean"),
vcov = NULL,
...
)

##### Arguments

- effect
one of

`"individual"`

or`"time"`

, only relevant in case of two--ways effects models,- type
one of

`"level"`

,`"dfirst"`

, or`"dmean"`

,- vcov
a variance--covariance matrix furnished by the user or a function to calculate one (see

**Examples**),- …
further arguments.

- x, object
an object of class

`"plm"`

, an object of class`"fixef"`

for the`print`

and the`summary`

method,- digits
digits,

- width
the maximum length of the lines in the print output,

##### Details

Function `fixef`

calculates the fixed effects and returns an object
of class `c("fixef", "numeric")`

. By setting the `type`

argument,
the fixed effects may be returned in levels (`"level"`

), as
deviations from the first value of the index (`"dfirst"`

), or as
deviations from the overall mean (`"dmean"`

). If the argument
`vcov`

was specified, the standard errors (stored as attribute "se"
in the return value) are the respective robust standard errors.

The associated `summary`

method returns an extended object of class
`c("summary.fixef", "matrix")`

with more information (see sections
**Value** and **Examples**).

References with formulae (except for the two-ways unbalanced case) are, e.g., GREE:12;textualplm, Ch. 11.4.4, p. 364, formulae (11-25); WOOL:10;textualplm, Ch. 10.5.3, pp. 308-309, formula (10.58).

##### Value

For function `fixef`

an object of class `c("fixef", "numeric")`

is returned: It is a numeric vector containing
the fixed effects with attribute `se`

which contains the
standard errors. There are two further attributes: attribute
`type`

contains the chosen type (the value of argument `type`

as a character); attribute `df.residual`

holds the residual
degrees of freedom (integer) from the fixed effects model (plm
object) on which `fixef`

was run.

For function `summary.fixef`

an object of class `c("summary.fixef", "matrix")`

is returned: It is a matrix with four columns in this
order: the estimated fixed effects, their standard errors and
associated t--values and p--values. The type of the fixed effects
and the standard errors in the summary.fixef objects correspond to
was requested in the `fixef`

function by arguments `type`

and
`vcov`

, respectively.

##### References

##### See Also

`within_intercept()`

for the overall intercept of fixed
effect models along its standard error, `plm()`

for plm objects
and within models (= fixed effects models) in general. See
`ranef()`

to extract the random effects from a random effects
model.

##### Examples

```
# NOT RUN {
data("Grunfeld", package = "plm")
gi <- plm(inv ~ value + capital, data = Grunfeld, model = "within")
fixef(gi)
summary(fixef(gi))
summary(fixef(gi))[ , c("Estimate", "Pr(>|t|)")] # only estimates and p-values
# relationship of type = "dmean" and "level" and overall intercept
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
# extract time effects in a twoways effects model
gi_tw <- plm(inv ~ value + capital, data = Grunfeld,
model = "within", effect = "twoways")
fixef(gi_tw, effect = "time")
# with supplied variance-covariance matrix as matrix, function,
# and function with additional arguments
fx_level_robust1 <- fixef(gi, vcov = vcovHC(gi))
fx_level_robust2 <- fixef(gi, vcov = vcovHC)
fx_level_robust3 <- fixef(gi, vcov = function(x) vcovHC(x, method = "white2"))
summary(fx_level_robust1) # gives fixed effects, robust SEs, t- and p-values
# calc. fitted values of oneway within model:
fixefs <- fixef(gi)[index(gi, which = "id")]
fitted_by_hand <- fixefs + gi$coefficients["value"] * gi$model$value +
gi$coefficients["capital"] * gi$model$capital
# }
```

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