Page 1 of 1

interactions and dummy variables

PostPosted: Tue Dec 12, 2023 9:38 pm
by mpburton
There may be a very short answer to this, but....

I am running a design with an interaction between a dummy variable and a continuous variable, and i get

Error: An interaction term is associated with a dummy or effects coded parameter. Interactions of dummy or effects coded attributes are not currently supported. 'mb.dummy[-1|-0.75|-0.5|-0.25]*m[1,0.75,0.5,0.25,0]*time[1,2,3]'

I am hoping there might be a beta version where this is supported, but as I said....

Michael

Re: interactions and dummy variables

PostPosted: Wed Dec 13, 2023 9:13 am
by Michiel Bliemer
Yes this can be done with the right syntax.

Instead of writing

mb.dummy[-1|-0.75|-0.5|-0.25]*m[1,0.75,0.5,0.25,0]*time[1,2,3]

you need to write

mb1[-1] * m.dummy[1] * time[1,2,3] +
mb2[-0.75] * m.dummy[0.75] * time[1,2,3] +
mb3[-0.5] * m.dummy[-0.5] * time[1,2,3] +
mb4[-0.25] * m.dummy[-0.25] * time[1,2,3]

This syntax assumes that you are using m[1,0.75,0.5,0.25,0] as a main effect as well in the utility function, such that the levels are already defined.

Ngene also supports interactions of dummy variables with dummy variables, for example

mb1[-1] * m.dummy[1] * time.dummy[1] +
mb2[-0.75] * m.dummy[0.75] * time.dummy[1] +
mb3[-0.5] * m.dummy[-0.5] * time.dummy[1] +
mb4[-0.25] * m.dummy[-0.25] * time.dummy[1] +
mb5[-1] * m.dummy[1] * time.dummy[2] +
mb6[-0.75] * m.dummy[0.75] * time.dummy[2] +
mb7[-0.5] * m.dummy[-0.5] * time.dummy[2] +
mb8[-0.25] * m.dummy[-0.25] * time.dummy[2]

Michiel

Re: interactions and dummy variables

PostPosted: Mon Dec 18, 2023 7:44 pm
by Michiel Bliemer
This is not an issue or problem, the Ngene syntax is designed this way to make clear what the prior values belong to. If you use b.dummy[...]*x*y then it is unclear whether x is dummy coded, y is dummy coded, or both are dummy coded. There will be no 'fix' because it is not broken :)

Michiel