Searching online, seems like everyone is fitting a simple interaction between 2 variables in a GLM, such as:
- x1 * x2
- x1 + x2 + x1 : x2
x1 and x2 could be either type.
However, what if there is a need to fit a more complicated interaction? For example:
ifelse(x1=="A" ,1,0) +
ifelse(x1=="B",1,0) +
ifelse(x1=="C",1,0) +
ifelse(x2==0,1,0) +
pmin(x2,10000)+
ifelse(x2>10000,1,0)
What would be a correct way to fit a x1 and x2 interaction in the above equation?
Many thanks