Hi @Sofía Mendoza,
Sorry, I had to use Google translate to provide response to your comments. Instead of modeling the interaction between the building key and material as a single random effect, you can create separate random effects for each material. This would allow you to capture the variability in responses attributable to different materials independently. Here is how you might modify your model:
lme = fitlme(data_table, 'logxi ~ logH + Material + (1|Material:key)', ... 'FitMethod', 'REML', ... 'CovariancePattern', {'Full', 'Diagonal'});
In this modified model, 1|Material:key allows you to estimate a random intercept for each combination of building material and building key, thus treating each material's influence independently while still accounting for the nested structure of your data. After fitting your model, you can extract the variance components associated with each random effect. This can be done using the `anova` function or by accessing the VarianceComponents property of your fitted LMM object:
varComp = lme.VarianceComponents;
This will give you insight into how much variance is explained by the building and material interactions. To further validate your approach, consider comparing models with different structures using Akaike Information Criterion (AIC) or Bayesian Information Criterion (BIC). This will help you assess whether separating out materials leads to a significantly better fit compared to your original model. After obtaining your variance estimates, visualizing them can provide additional insights. You might create plots showing the distribution of logxi across different materials or boxplots comparing variability in responses across material types.
Make sure that your data meets the assumptions required for LMMs, including normality and homoscedasticity of residuals and consider using cross-validation techniques to assess the robustness of your findings across different subsets of your data.
Hope this helps.