| model.matrix.fixest {fixest} | R Documentation |
fixest objectThis function creates the left-hand-side or the right-hand-side(s) of a femlm, feols or feglm estimation.
## S3 method for class 'fixest' model.matrix(object, data, type = "rhs", na.rm = TRUE, subset = FALSE, ...)
object |
A |
data |
If missing (default) then the original data is obtained by evaluating the |
type |
Character vector or one sided formula, default is "rhs". Contains the type of matrix/data.frame to be returned. Possible values are: "lhs", "rhs", "fixef", "iv.rhs1", "iv.rhs2". |
na.rm |
Default is |
subset |
Logical or character vector. Default is |
... |
Not currently used. |
It returns either a matrix or a data.frame. It returns a matrix for the "rhs", "iv.rhs1" and "iv.rhs2" parts. A data.frame for "lhs" and "fixef".
Laurent Berge
See also the main estimation functions femlm, feols or feglm. formula.fixest, update.fixest, summary.fixest, vcov.fixest.
base = iris
names(base) = c("y", "x1", "x2", "x3", "species")
est = feols(y ~ poly(x1, 2) + x2, base)
head(model.matrix(est))
# Illustration of subset
# subset => character vector
head(model.matrix(est, subset = "x1"))
# subset => TRUE, only works with data argument!!
head(model.matrix(est, data = base[, "x1", drop = FALSE], subset = TRUE))