View source: R/sparse_model_matrix.R
| sparse_model_matrix | R Documentation |
fixest object returned in sparse formatThis function creates the left-hand-side or the right-hand-side(s) of a femlm, feols or feglm estimation.
sparse_model_matrix(
object,
data,
type = "rhs",
sample = "estimation",
na.rm = FALSE,
collin.rm = NULL,
combine = TRUE,
...
)
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" (1st stage RHS), "iv.rhs2" (2nd stage RHS), "iv.endo" (endogenous vars.), "iv.exo" (exogenous vars), "iv.inst" (instruments). |
sample |
Character scalar equal to "estimation" (default) or "original". Only
used when If |
na.rm |
Default is |
collin.rm |
Logical scalar. Whether to remove variables that were
found to be collinear during the estimation. Beware: it does not perform a
collinearity check and bases on the |
combine |
Logical scalar, default is |
... |
Not currently used. |
It returns either a single sparse matrix a list of matrices,
depending whether combine is TRUE or FALSE.
The sparse matrix is of class dgCMatrix from the Matrix package.
Laurent Berge, Kyle Butts
See also the main estimation functions femlm, feols or feglm. formula.fixest, update.fixest, summary.fixest, vcov.fixest.
est = feols(wt ~ i(vs) + hp | cyl, mtcars)
sparse_model_matrix(est)
sparse_model_matrix(wt ~ i(vs) + hp | cyl, mtcars)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.