I would like to specify a regression in R that would estimate coefficients on x that are conditional on a third variable, z, being greater than 0. For example
y ~ a + x*1(z>0) + x*1(z<=0)
What is the correct way to do this in R using formulas?
The “:” (colon) operator is used to construct conditional interactions (when used with disjoint predictors constructed with
I). Should be used with predictMight help to look at its model matrix: