pFormula {plm} | R Documentation

## pFormula: An extended Formula interface for panel data

### Description

pFormula is a Formula object used in the plm package.

### Usage

    pFormula(object)
    ## S3 method for class 'pFormula'
    as.Formula(x, ...)

### Arguments

`object` | an object of class `"formula"`, the formula to be coerced to class `"pFormula"`,
`x` | an object of class `"pFormula"`, to be coerced to `class{"Formula"}`,
`...` | further arguments.

### Value

For `pFormula`, the return value is an object of class `c("pFormula", "Formula", "formula")`.
For `as.Formula`, the return value is an object of class `c("Formula", "formula")`.

### Author(s)

Yves Croissant

### See Also

`plm`'s `model.frame` and `model.matrix` to create a model frame for panel data and a model matrix with data transformations applied, respectively.
`plm`'s `pmodel.response` for (transformed) response variable.
`Formula` from package `Formula`.

### Examples

    # First, make a pdata.frame
    data("Grunfeld", package = "plm")
    pGrunfeld <- pdata.frame(Grunfeld)

    # then make a model frame from a pFormula and a pdata.frame
    pform <- pFormula(inv ~ value + capital)
    mf <- model.frame(pform, data = pGrunfeld)

    # then construct the (transformed) model matrix (design matrix)
    # from formula and model frame
    modmat <- model.matrix(pform, data = mf, model = "within")

[Package plm version 1.6-6 Index]