View source: R/build_allowed.R
| build_allowed_function | R Documentation |
Converts an allowed interaction matrix into a function compatible with
the allowed parameter of earth::earth(). The function checks that
ALL pairwise combinations among the predictors in a proposed interaction
term are TRUE in the matrix.
build_allowed_function(allowed_matrix)
allowed_matrix |
A symmetric logical matrix as returned by
|
The returned function implements the standard earth() allowed function
contract. When earth proposes a new hinge function involving predictor
pred with existing parent predictors indicated by the parents logical
vector, the function checks that every pair of involved predictors is
allowed in the matrix.
For a 3-way interaction between X, Y, Z, the function verifies that (X,Y), (Y,Z), and (X,Z) are all TRUE in the matrix.
A function with signature
function(degree, pred, parents, namesx, first) suitable for the
allowed parameter of earth::earth().
mat <- build_allowed_matrix(c("sqft", "bedrooms", "pool"))
mat["sqft", "pool"] <- FALSE
mat["pool", "sqft"] <- FALSE
func <- build_allowed_function(mat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.