Skip to main content
1 of 3
Luna
  • 2.4k
  • 5
  • 29
  • 40

Regression with categorical factor variable and the correlation among the variables

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:

Step 1: run lm(y~x2 +1)

Step 2: 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:

  1. Does my approach make sense?
  2. 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!

Luna
  • 2.4k
  • 5
  • 29
  • 40