get_x_all: a unique combinations of model vars, coeff vars and raw vars

Description Usage Arguments Details Value Examples

View source: R/linear.tools.R

Description

a unique combinations of model vars, coeff vars and raw vars

Usage

1
get_x_all(model, data = NULL)

Arguments

model

lm or glm

data

NULL (default) or data.frame, a new dataset to evaluate the categorical variables. If NULL, then use the data used in model itself.

Details

For the differences between raw var, model var, and coeff var: see get_x

Value

a data.frame, a unique combinations of model vars, coeff vars and raw vars See get_x for the meaning of model var, coeff var or raw var.

The column 'n_raw_in_model' is a numeric field showing how many raw variables are in the corresponding model variables. For example, the model variable 'I(carat*table)' contains two raw variables: 'carat' and 'table'. See example code for details.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
get_x_all(model = price~  I(carat^   2) + cut  + I(carat*table),data = ggplot2::diamonds)


#________ irregular formulas
model_dirty = lm(price~  I(carat^   2) + cut  - carat:table - cut ,ggplot2::diamonds)
test = get_x_all(model_dirty)

test
test$coeff
# ______  errors _______________

tryCatch(get_x_all(model = price~  I(carat^   2) + cut  + I(carat*table)),
         error = function(x){
           print(x)
         })

linear.tools documentation built on May 2, 2019, 3:17 a.m.