fixef.plm {plm} | R Documentation |
Function to extract the fixed effects from a plm
object and associated summary method.
## S3 method for class 'plm' fixef(object, effect = NULL, type = c("level", "dfirst", "dmean"), vcov = NULL, ...) ## S3 method for class 'fixef' print(x, digits = max(3, getOption("digits") - 2), width = getOption("width"), ...) ## S3 method for class 'fixef' summary(object, ...) ## S3 method for class 'summary.fixef' print(x, digits = max(3, getOption("digits") -2), width = getOption("width"), ...)
x,object |
an object of class |
effect |
one of |
vcov |
a variance–covariance matrix furnished by the user or a function to calculate one (see Examples), |
type |
one of |
digits |
digits, |
width |
the maximum length of the lines in the print output, |
... |
further arguments. |
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., Greene (2012), Ch. 11.4.4, p. 364, formulae (11-25); Wooldridge (2010), Ch. 10.5.3, pp. 308-309, formula (10.58).
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.
Yves Croissant
Greene, W.H. (2012), Econometric Analysis, 7th ed., Prentice Hall, Ch. 11.4.4.
Wooldridge, J.M. (2010) Econometric Analysis of Cross Section and Panel Data, 2nd ed., MIT Press, Ch. 10.5.3.
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.
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