Learn R Programming

fixest (version 0.8.0)

model.matrix.fixest: Design matrix of a femlm model

Description

This function creates the left-hand-side or the right-hand-side(s) of a femlm, feols or feglm estimation.

Usage

# S3 method for fixest
model.matrix(object, data, type = "rhs", na.rm = TRUE, ...)

Arguments

object

A fixest object. Obtained using the functions femlm, feols or feglm.

data

If missing (default) then the original data is obtained by evaluating the call. Otherwise, it should be a data.frame.

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 TRUE. Should observations with NAs be removed from the matrix?

...

Not currently used.

Value

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".

See Also

See also the main estimation functions femlm, feols or feglm. formula.fixest, update.fixest, summary.fixest, vcov.fixest.

Examples

Run this code
# NOT RUN {
# simple estimation on iris data, using "Species" fixed-effects
res = femlm(Sepal.Length ~ Sepal.Width*Petal.Length +
            Petal.Width | Species, iris)

head(model.matrix(res))



# }

Run the code above in your browser using DataLab