Description Usage Arguments Details Value Examples
The causal_forest
algorithm requires inputs to be numeric
matrices. This function uses model.matrix
to create such
a matrix from a data frame of covariates.
1 | make_contrasts(X, vars)
|
X |
A data frame of covariates. May contain both numeric and categorical features together. |
vars |
A character vector of covariates to one-hot encode. |
No levels are dropped during the one-hot encodeing; a covariate with n levels will turn into n binary columns.
No intercept term is returned in the matrix.
A numeric matrix
1 2 3 4 5 | ## Not run:
Xdat <- subset(cfex, select = -c(W, Y))
make_contrasts(Xdat, 'fct')
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.