r - Mixed Interaction terms in linear model -
i testing mixed model 4 predictors : 2 categorical predictors (with 6 , 7 levels respectively) , 2 quantitative predictors.
i know if allowed, while testing model, create interaction terms in mix categorical , quantitative predictors.
suppose y = f(a, b)
model want test, a
quantitative predictor , b
categorical predictor.
am allowed search (example in r):
linfit <- lm(y ~ +b +a:b, data=mydata)
the interpretation of results similar of 1 have when mixing quantitative predictors?
first, code wrote right, r give result. , if class of b been set factor, r regression considering b categorical predictor.
second, assume asking statistical interpretation of interaction term. statistical meaning of below 3 situations not same, (1) , b quantitative predictors. in regression result r, there 4 rows, a, b, ab, interception. regression process takes ab quantitative variable , linear regression.
y = β0 + β1⋅a + β2⋅b + β3⋅a*b
(2) , b categorical predictors. suppose has 3 levels , b has 2. draw out the design matrix consisted 1 or 0;
y = β0 + β1⋅a2 + β2⋅a3 + β3⋅b2 + β4⋅a2*b2 + β5⋅a3*b2
(3) categorical , b quantitative predictor. suppose has 3 levels.
y = β0 + β1⋅a2 + β2⋅a3 + β3⋅b + β4⋅a2*b + β5⋅a3*b
for more details of interaction term , design matrix, generalized linear model talk more it. also, it's easy try out in r regression results.
Comments
Post a Comment