Learn R Programming

cbcTools (version 0.7.1)

int_spec: Create an interaction specification for fixed parameters

Description

Create an interaction specification for fixed parameters

Usage

int_spec(between, value, level = NULL, with_level = NULL)

Value

An interaction specification list

Arguments

between

Character vector of length 2 specifying the two attributes to interact

value

Numeric. Interaction coefficient value

level

Character. For categorical variables, specific level of first attribute

with_level

Character. For categorical variables, specific level of second attribute

Examples

Run this code
# Continuous * continuous interaction
int_spec(between = c("price", "weight"), value = 0.1)

# Continuous * categorical interactions (must specify categorical level)
int_spec(between = c("price", "type"), with_level = "Fuji", value = 0.15)
int_spec(between = c("price", "type"), with_level = "Gala", value = 0.05)

# Categorical * categorical interactions (must specify both levels)
int_spec(between = c("type", "freshness"),
         level = "Fuji", with_level = "Poor", value = -0.2)

Run the code above in your browser using DataLab