Hierarchical mixed model to include correlation for features on the same level in R

31 Views Asked by At

I currently have a data frame in place for the triggering value of software log messages triggering each other. All features are categorical. The data frame looks as follows

From_Microservice From_component Frommessagetype To_Microservice To_component Tomessagetype Excitation
Service 1 Component 1 type 1 Service 1 Component 1 type 1 10.4
Service 1 Component 1 type 2 Service 1 Component 2 type 2 4.2
Service 2 Component 2 type 2 Service 2 Component 2 type 3 0.5
Service 2 Component 2 type 4 Service 1 Component 1 type 2 0.0

message types are within components, which are within microservices. Furthermore, each row entry is unique in the sense that we have one, and only one, excitation value for 'messages of a certain type on a component on a Microservice', triggering 'messages of a certain type on a component on a Microservice'. It should be noted that in this setup, message type 2 on component 1 is precisely the same message type as message type 2 on component 2. The same holds for a component of a microservice.

I now want to run a hierarchical mixed model in R to see how each of the six features ('from_micoservice', 'from_component', etc) contribute to the total variance. Using the lme4 package, I modeled

mymodel <- lmer(excitation ~ (1|from_microservice) + 
                             (1|from_microservice:from_components) + 
                             (1|from_microservice:from_components:from_message_type)+
                             (1|to_microservice) + 
                             (1|to_microservice:to_components) + 
                             (1|to_microservice:to_components:to_message_type), data = df)

Although this model captures the hierarchical structure, it fails to incorporate the correlation between features of the same level, i.e. (from_microservice, to_microservice), (from_component, to_component), (frommessagetype, tomessagetype). This correlation should definitely be included as excitations on the same level, (ie same microservice, component or message type) naturally tend to higher.

My question is therefore: "How do I include the correlation between features on the same level?"

0

There are 0 best solutions below