lm(y~x1 + x2 -1)
where x1
is a continuous numerical variable and x2
is a categorical factor variable with 4 levels.
Is there a way to measure the "correlation" between the x1
variable and each level of the factor variable x2
? By putting correlation into double quotes, I admit that I don't really know what is a good definition for the associatedness between a continuous variable and a specific level of the factor variable. Hopefully readers get my intuition. I mean that some levels of x2
may associated with x1
more actively than other levels of x2
.
Not knowing how to measure it, I am thinking of the following procedure:
run
lm(y~x2 +1)
run
lm(y~x2 + x1 -1)
i.e. replace the intercept in "Step 1" by the continous variable x1
in "Step 2" and then see which $\beta$ (of associated factor level) changed most.
My questions are:
- Does my approach make sense?
- How do I measure if a beta (of a specific associated factor level) changed and by how much? Is there a way to make fair comparison and draw some meaningful conclusions?
Could anybody please shed some lights on me?
Thanks a lot!
x1
andx2
? $\endgroup$