fixef.plm {plm} | R Documentation

## Extract the Fixed Effects

### Description

This function extracts the fixed effects from a `plm` object.

### Usage

    ## S3 method for class 'plm'
    fixef(object, effect = NULL,
                          type = c("level", "dfirst", "dmean"), ...)
    ## 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"),...)

### Arguments

`x,object` | an object of class `"plm"`, an object of class `"fixef"` for the `print` and the `summary` method,
`effect` | one of `"individual"` or `"time"`, only relevant in case of two–ways effects models,
`type` | one of `"level"`, `"dfirst"`, or `"dmean"`,
`digits` | digits,
`width` | the maximum length of the lines in the print output,
`...` | further arguments.

### Details

The summary method prints the fixed effects in deviation from the overall intercept, the standard errors and the t–values.

### Value

An object of class `"fixef"`. It is a numeric vector containing the fixed effects with two attributes: `se` which contains the standard errors and `intercept` which is the overall intercept. With 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"`).

### Author(s)

Yves Croissant

### See Also

`plm`

### Examples

    data("Grunfeld", package = "plm")
    gi <- plm(inv ~ value + capital, data = Grunfeld, model = "within")
    fixef(gi)
    summary(fixef(gi))

    # 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")

    # calc. fitted values of
    # oneway within model using fixef:
    fixefs <- merge(Grunfeld, data.frame(firm = names(fixef(gi)),
                                       fixef = as.numeric(fixef(gi))),
                                       all.x = TRUE, by = c("firm"))[ , 6]
    fitted_by_hand <- fixefs + gi$coefficients["value"] * Grunfeld$value +
                               gi$coefficients["capital"] * Grunfeld$capital

[Package plm version 1.5-12 Index]