Skip to main content
Edit for clarity and better title.
Source Link
Ashe
  • 1.1k
  • 13
  • 27

How to handleinclude in a regression two factors where one level of one factor is necessarily nested with one level of another factor?

I've got a situation where I have a series of individuals who have two factors describing their health. Factor A has 3 levels while factor B has 4 levels. Biologically, level 1 of factor A appears if and only if factor B is level 1. Therefore, I have data structured like this:

ID   Factor A  Factor B   Score
1      a        alpha       0.1
2      a        alpha       0.2
3      b        beta        0.3
4      b        gamma       0.4
5      b        delta       0.5
6      c        beta        0.6
7      c        gamma       0.7
8      c        delta       0.8

I'm interested in studying the effects of both factors, but I'm struggling with how to properly code this. Giving each factor their own full set of dummy codes is rank deficient and leaving out a level of either factor creates a model with impossible combinations (ie level a ONLY occurs with level alpha, and vice versa). How could I code these fixed effects so that I can investigate the impact of both factors on our score? Additionally, how would I interpret this coding scheme?

EDIT: For the close vote that this is off-topic, embedded in this is a request for understanding how to partition out these effects so that I know how each factor affects the score, referenced to the baseline (a and alpha). In my experiment, I'd like to know how a change from a to b/c impacts score independent of a change from alpha to beta/gamma/delta. It just so happens that if a subject is a and alpha, both of those factors must change to new levels, which makes teasing out differences difficult.

EDIT 2: To give some further context on how this happens, Factor A is series of related diseases (each phenotypically similar, but driven differently genetically different) while Factor B is severity of that diseased state. So a is the control group while alpha is healthy severity. These two occur contemporaneously by necessity (ie a healthy severity must be a control while a control can be nothing but healthy).

How to handle two factors where one level of one factor is necessarily nested with one level of another factor?

I've got a situation where I have a series of individuals who have two factors describing their health. Factor A has 3 levels while factor B has 4 levels. Biologically, level 1 of factor A appears if and only if factor B is level 1. Therefore, I have data structured like this:

ID   Factor A  Factor B   Score
1      a        alpha       0.1
2      a        alpha       0.2
3      b        beta        0.3
4      b        gamma       0.4
5      b        delta       0.5
6      c        beta        0.6
7      c        gamma       0.7
8      c        delta       0.8

I'm interested in studying the effects of both factors, but I'm struggling with how to properly code this. Giving each factor their own full set of dummy codes is rank deficient and leaving out a level of either factor creates a model with impossible combinations (ie level a ONLY occurs with level alpha, and vice versa). How could I code these fixed effects so that I can investigate the impact of both factors on our score?

EDIT: For the close vote that this is off-topic, embedded in this is a request for understanding how to partition out these effects so that I know how each factor affects the score, referenced to the baseline (a and alpha). In my experiment, I'd like to know how a change from a to b/c impacts score independent of a change from alpha to beta/gamma/delta. It just so happens that if a subject is a and alpha, both of those factors must change to new levels, which makes teasing out differences difficult.

EDIT 2: To give some further context on how this happens, Factor A is series of related diseases (each phenotypically similar, but driven differently genetically) while Factor B is severity of that diseased state. So a is the control group while alpha is healthy severity. These two occur contemporaneously by necessity (ie a healthy severity must be a control while a control can be nothing but healthy).

How to include in a regression two factors where one level of one factor is necessarily nested with one level of another factor?

I've got a situation where I have a series of individuals who have two factors describing their health. Factor A has 3 levels while factor B has 4 levels. Biologically, level 1 of factor A appears if and only if factor B is level 1. Therefore, I have data structured like this:

ID   Factor A  Factor B   Score
1      a        alpha       0.1
2      a        alpha       0.2
3      b        beta        0.3
4      b        gamma       0.4
5      b        delta       0.5
6      c        beta        0.6
7      c        gamma       0.7
8      c        delta       0.8

I'm interested in studying the effects of both factors, but I'm struggling with how to properly code this. Giving each factor their own full set of dummy codes is rank deficient and leaving out a level of either factor creates a model with impossible combinations (ie level a ONLY occurs with level alpha, and vice versa). How could I code these fixed effects so that I can investigate the impact of both factors on our score? Additionally, how would I interpret this coding scheme?

EDIT: To give some further context on how this happens, Factor A is series of related diseases (each phenotypically similar, but genetically different) while Factor B is severity of that diseased state. So a is the control group while alpha is healthy severity. These two occur contemporaneously by necessity (ie a healthy severity must be a control while a control can be nothing but healthy).

added 416 characters in body
Source Link
Ashe
  • 1.1k
  • 13
  • 27

I've got a situation where I have a series of individuals who have two factors describing their health. Factor A has 3 levels while factor B has 4 levels. Biologically, level 1 of factor A appears if and only if factor B is level 1. Therefore, I have data structured like this:

ID   Factor A  Factor B   Score
1      a        alpha       0.1
2      a        alpha       0.2
3      b        beta        0.3
4      b        gamma       0.4
5      b        delta       0.5
6      c        beta        0.6
7      c        gamma       0.7
8      c        delta       0.8

I'm interested in studying the effects of both factors, but I'm struggling with how to properly code this. Giving each factor their own full set of dummy codes is rank deficient and leaving out a level of either factor creates a model with impossible combinations (ie level a ONLY occurs with level alpha, and vice versa). How could I code these fixed effects so that I can investigate the impact of both factors on our score?

EDIT: For the close vote that this is off-topic, embedded in this is a request for understanding how to partition out these effects so that I know how each factor affects the score, referenced to the baseline (a and alpha). In my experiment, I'd like to know how a change from a to b/c impacts score independent of a change from alpha to beta/gamma/delta. It just so happens that if a subject is a and alpha, both of those factors must change to new levels, which makes teasing out differences difficult.

EDIT 2: To give some further context on how this happens, Factor A is series of related diseases (each phenotypically similar, but driven differently genetically) while Factor B is severity of that diseased state. So a is the control group while alpha is healthy severity. These two occur contemporaneously by necessity (ie a healthy severity must be a control while a control can be nothing but healthy).

I've got a situation where I have a series of individuals who have two factors describing their health. Factor A has 3 levels while factor B has 4 levels. Biologically, level 1 of factor A appears if and only if factor B is level 1. Therefore, I have data structured like this:

ID   Factor A  Factor B   Score
1      a        alpha       0.1
2      a        alpha       0.2
3      b        beta        0.3
4      b        gamma       0.4
5      b        delta       0.5
6      c        beta        0.6
7      c        gamma       0.7
8      c        delta       0.8

I'm interested in studying the effects of both factors, but I'm struggling with how to properly code this. Giving each factor their own full set of dummy codes is rank deficient and leaving out a level of either factor creates a model with impossible combinations (ie level a ONLY occurs with level alpha, and vice versa). How could I code these fixed effects so that I can investigate the impact of both factors on our score?

EDIT: For the close vote that this is off-topic, embedded in this is a request for understanding how to partition out these effects so that I know how each factor affects the score, referenced to the baseline (a and alpha). In my experiment, I'd like to know how a change from a to b/c impacts score independent of a change from alpha to beta/gamma/delta. It just so happens that if a subject is a and alpha, both of those factors must change to new levels, which makes teasing out differences difficult.

I've got a situation where I have a series of individuals who have two factors describing their health. Factor A has 3 levels while factor B has 4 levels. Biologically, level 1 of factor A appears if and only if factor B is level 1. Therefore, I have data structured like this:

ID   Factor A  Factor B   Score
1      a        alpha       0.1
2      a        alpha       0.2
3      b        beta        0.3
4      b        gamma       0.4
5      b        delta       0.5
6      c        beta        0.6
7      c        gamma       0.7
8      c        delta       0.8

I'm interested in studying the effects of both factors, but I'm struggling with how to properly code this. Giving each factor their own full set of dummy codes is rank deficient and leaving out a level of either factor creates a model with impossible combinations (ie level a ONLY occurs with level alpha, and vice versa). How could I code these fixed effects so that I can investigate the impact of both factors on our score?

EDIT: For the close vote that this is off-topic, embedded in this is a request for understanding how to partition out these effects so that I know how each factor affects the score, referenced to the baseline (a and alpha). In my experiment, I'd like to know how a change from a to b/c impacts score independent of a change from alpha to beta/gamma/delta. It just so happens that if a subject is a and alpha, both of those factors must change to new levels, which makes teasing out differences difficult.

EDIT 2: To give some further context on how this happens, Factor A is series of related diseases (each phenotypically similar, but driven differently genetically) while Factor B is severity of that diseased state. So a is the control group while alpha is healthy severity. These two occur contemporaneously by necessity (ie a healthy severity must be a control while a control can be nothing but healthy).

added 533 characters in body
Source Link
Ashe
  • 1.1k
  • 13
  • 27

I've got a situation where I have a series of individuals who have two factors describing their health. Factor A has 3 levels while factor B has 4 levels. Biologically, level 1 of factor A appears if and only if factor B is level 1. Therefore, I have data structured like this:

ID   Factor A  Factor B   Score
1      a        alpha       0.1
2      a        alpha       0.2
3      b        beta        0.3
4      b        gamma       0.4
5      b        delta       0.5
6      c        beta        0.6
7      c        gamma       0.7
8      c        delta       0.8

I'm interested in studying the effects of both factors, but I'm struggling with how to properly code this. Giving each factor their own full set of dummy codes is rank deficient and leaving out a level of either factor creates a model with impossible combinations (ie level a ONLY occurs with level alpha, and vice versa). How could I code these fixed effects so that I can investigate the impact of both factors on our score?

EDIT: For the close vote that this is off-topic, embedded in this is a request for understanding how to partition out these effects so that I know how each factor affects the score, referenced to the baseline (a and alpha). In my experiment, I'd like to know how a change from a to b/c impacts score independent of a change from alpha to beta/gamma/delta. It just so happens that if a subject is a and alpha, both of those factors must change to new levels, which makes teasing out differences difficult.

I've got a situation where I have a series of individuals who have two factors describing their health. Factor A has 3 levels while factor B has 4 levels. Biologically, level 1 of factor A appears if and only if factor B is level 1. Therefore, I have data structured like this:

ID   Factor A  Factor B   Score
1      a        alpha       0.1
2      a        alpha       0.2
3      b        beta        0.3
4      b        gamma       0.4
5      b        delta       0.5
6      c        beta        0.6
7      c        gamma       0.7
8      c        delta       0.8

I'm interested in studying the effects of both factors, but I'm struggling with how to properly code this. Giving each factor their own full set of dummy codes is rank deficient and leaving out a level of either factor creates a model with impossible combinations (ie level a ONLY occurs with level alpha, and vice versa). How could I code these fixed effects so that I can investigate the impact of both factors on our score?

I've got a situation where I have a series of individuals who have two factors describing their health. Factor A has 3 levels while factor B has 4 levels. Biologically, level 1 of factor A appears if and only if factor B is level 1. Therefore, I have data structured like this:

ID   Factor A  Factor B   Score
1      a        alpha       0.1
2      a        alpha       0.2
3      b        beta        0.3
4      b        gamma       0.4
5      b        delta       0.5
6      c        beta        0.6
7      c        gamma       0.7
8      c        delta       0.8

I'm interested in studying the effects of both factors, but I'm struggling with how to properly code this. Giving each factor their own full set of dummy codes is rank deficient and leaving out a level of either factor creates a model with impossible combinations (ie level a ONLY occurs with level alpha, and vice versa). How could I code these fixed effects so that I can investigate the impact of both factors on our score?

EDIT: For the close vote that this is off-topic, embedded in this is a request for understanding how to partition out these effects so that I know how each factor affects the score, referenced to the baseline (a and alpha). In my experiment, I'd like to know how a change from a to b/c impacts score independent of a change from alpha to beta/gamma/delta. It just so happens that if a subject is a and alpha, both of those factors must change to new levels, which makes teasing out differences difficult.

Source Link
Ashe
  • 1.1k
  • 13
  • 27
Loading