Learn R Programming

plm (version 1.6-5)

pFormula: pFormula: An extended Formula interface for panel data

Description

pFormula is a Formula object used in the plm package.

Usage

pFormula(object) "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").

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

Run this code
# First, make a pdata.frame
data(Grunfeld)
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")

Run the code above in your browser using DataLab