Contributor
Posts: 30

# how to control interaction of class variables in GLM ...

Hi,

I am using GLM regression with two class variable A  &  B.  I do want A * B, but not in a explode way. For example, A has 4 elements, and B has 3 elements, I do not want final 4 * 3 = 12 parameters, I want 4 parameters for A and 3 parameters for B, and these 4 parameters times these 3 paramters are my 12 paramters for estimation. In other way, I do not care the correlation between A and B. Thanks.

Jian

Posts: 2,982

## Re: how to control interaction of class variables in GLM ...

Posted in reply to jzhang332002

I'm confused. On the one hand, it sounds like you are saying you want the A*B interaction but then it sounds to me like you say you don't want it. If you include the A*B interaction in the model, it will have 12 parameters, some of which cannot be estimated, resulting in (4-1)*(3-1)=6 degrees of freedom (assuming you also include the main effects in the model)

--
Paige Miller
Super User
Posts: 13,500

## Re: how to control interaction of class variables in GLM ...

Posted in reply to jzhang332002

This comes under the heading of wild a** guess, or possibly entertaining. Add a dummy variable to the data which always has the value of 1 and use

A*dummy B*dummy

I have no evidence this will work but should prevent 12 parameters.

Posts: 5,521

## Re: how to control interaction of class variables in GLM ...

Posted in reply to jzhang332002

When you say "I do not care the correlation between A and B", do you mean that you do not care if the effect of B is not the same on every level of A? Or equivalently, if the effect of A is not the same on every level of B? If you do not care or if you want to assume that the effect of A is independent from the effect of B, i.e. that the effect of A and B is simply the sum of the effect of A and the effect of B, then you don't need the interaction effect in your model. [model y = A B;]

If, on the other hand, you don't care about the individual effects of A and B but only care for their combined effect, then you don't need the main effects in your model [model y = A*B;].

But if you can't assume independence (of A and B) or do care about main effects (of A or B), then you need to test the full model [model y = A B A*B;] first.

PG

PG
Discussion stats
• 3 replies
• 253 views
• 0 likes
• 4 in conversation