-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
High level description
reg ignores contrasts base setting for a particular categorical variable if this variable is interacted with some other regressor.
MWE
df = DataFrame(y = rand(100), x1 = categorical(rand(1:3, 100)), x2 = categorical(rand(1:3, 100)))
# Regression of y ~ x1 using x1 = 2 as base
reg(df, @formula(y ~ x1); contrasts = Dict(:x1 => DummyCoding(base = 2)))
# Regression of y ~ x1&x2 using x1 = 2 as base
reg(df, @formula(y ~ x1&x2); contrasts = Dict(:x1 => DummyCoding(base = 2)))
The first regression does set x1=2 as the base level, as expected. However, the second regression just sets the interaction of the highest value for each each x1 and x2 as the base level. One could always re-normalize to the desired based level but shouldn't be an easy way to set a base level in the latter case too?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels