I have panel data for people over a number of years. People can be categorised based on a certain characteristic, X. Individual's yearly observations can be categorised based on whether a particular event, E, occurred for that person in a year or not.
The characteristic, X, and event, E, can be further subdivided into two mutually exhaustive groups each, X1 and X2, and E1 and E2, respectively (i.e. if X then either X1 or X2, and similarly for E).
My aim is to write a simple linear regression model of Y versus these categories and their interaction effects (and an additional explanatory variable Z).
My proposed idea is to define the following dummy variables that cover the full space of X and E:
- X1=1 if person is in category X1, =0 otherwise,
- X2=1 if person is in category X2, =0 otherwise,
- notX=1 if person is not in category X1 and is not in category X2, 0 otherwise
- E1=1 if event E1 occurred in a year for a person, =0 otherwise,
- E2=1 if event E2 occurred in a year for a person, =0 otherwise,
- notE=1 if event E1 did not occur and event E2 did not occur in a year for a person, 0 otherwise
There would be 9 possible interaction terms: X1*E1, X1*E2, X1*notE, X2*E1, ..., notX*notE.
Is this the right approach to take and if so which variables do I put in my model and which do I leave out as a base case? Do I need to include the levels of X1, X2, etc if I have all the interactions?
There is also one continuous explanatory variable I wish to include in the model as well, Z, and I would like to include the dummy interactions interacted with Z as well. If I include the level Z and Z interacted with each of the 9 dummy interactions (i.e. Z*X1*E1, etc.) do I also need to include Z interacted with the level dummies (i.e. Z*E1, etc.)?
Your help is very much appreciated.