Check if main effects for all interaction effects are included in the model

var_check(ev, cn, intv = c())

Arguments

ev

List of explanatory variables provided to regress or logistic

cn

Column names for all explanatory variables in the dataset

intv

Interaction terms specified

Value

vars is a vector of right-hand side variables, possibly with interactions, iv is the list of explanatory variables, and intv are interaction terms

Details

If ':' is used to select a range evar is updated. See https://radiant-rstats.github.io/docs/model/regress.html for an example in Radiant

Examples

var_check("a:d", c("a","b","c","d"))
#> $vars #> [1] "a" "b" "c" "d" #> #> $ev #> [1] "a" "b" "c" "d" #> #> $intv #> NULL #>
var_check(c("a", "b"), c("a", "b"), "a:c")
#> Interaction terms contain variables not selected as main effects. #> Removing interactions from the estimation
#> $vars #> [1] "a" "b" #> #> $ev #> [1] "a" "b" #> #> $intv #> character(0) #>
var_check(c("a", "b"), c("a", "b"), "a:c")
#> Interaction terms contain variables not selected as main effects. #> Removing interactions from the estimation
#> $vars #> [1] "a" "b" #> #> $ev #> [1] "a" "b" #> #> $intv #> character(0) #>
var_check(c("a", "b"), c("a", "b"), c("a:c", "I(b^2)"))
#> Interaction terms contain variables not selected as main effects. #> Removing interactions from the estimation
#> $vars #> [1] "a" "b" #> #> $ev #> [1] "a" "b" #> #> $intv #> [1] "I(b^2)" #>