Hi Statalist community,
I am trying to specify and interpret models with interactions between a continuous variable and a factor variable. Below is a toy dataset. The outcome of interest is a binary variable for being employed with 1 being employed and 0 otherwise. I have a 7 category factor variable to describe a person's prior education. I also have a continuous variable for age. I am trying to create an interaction between the education and age variable. I have never seen a continuous variable interacted with a factor variable that has more than two levels. Is this the correct way to do it?
Also, would it be correct to interpret the interaction terms as "for a particular education level, a one year increase in age is associated with a ______ unit increase in being employed." Thank you so much.
I am trying to specify and interpret models with interactions between a continuous variable and a factor variable. Below is a toy dataset. The outcome of interest is a binary variable for being employed with 1 being employed and 0 otherwise. I have a 7 category factor variable to describe a person's prior education. I also have a continuous variable for age. I am trying to create an interaction between the education and age variable. I have never seen a continuous variable interacted with a factor variable that has more than two levels. Is this the correct way to do it?
Also, would it be correct to interpret the interaction terms as "for a particular education level, a one year increase in age is associated with a ______ unit increase in being employed." Thank you so much.
Code:
clear all set obs 1000 *Dummy for whether someone is employed generate employ = runiformint(0, 1) *Education level generate education = runiformint(1, 7) label define education 1 "less than hs" 2 "hs only" 3 "associates degree" 4 "ba/bs" 5 "masters" 6 "doctorate" 7 "postdoc training" label val education education *Age generate age = runiformint(18, 64) *Run logit model estimating employment with education and age interaction logit employ i.education##c.age
Comment