pFormula {plm} | R Documentation |
pFormula is a Formula object used in the plm package.
pFormula(object) ## S3 method for class 'pFormula' as.Formula(x, ...)
object |
an object of class |
x |
an object of class |
... |
further arguments. |
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")
.
Yves Croissant
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
.
# 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")