Understanding coxme model results with 1 or 2 factors I'm confused about the outcomes of two mixed-effects cox proportional hazard models on the same data set.
In my experiment, I'm investigating the survival of insects that are exposed to two different chemicals (either to one or to both combined) in a full-factorial design. Let's say the chemicals are "A" and "B". The insects were kept in groups (-> I have to include groups as random term in my models).
For each individual insect, I noted the number of days it survived before death (days.survived). For censoring (status), I used 1=censored, 2=dead.
I analysed my data in two ways:

*

*with the 4-level factor "treatment" as response variable (1 factor analysis). The levels are "A", "B", "both" and "control"

*with two 2-level factors, "Presence_A" (+A if A was applied,-A otherwise), "Presence_B" (+B if B was applied, -B otherwise".

I run my models as follows:
fit1 <- coxme(Surv(days.survived,status) ~ treatment + (1|group), data = survival)
fit2 <- coxme(Surv(days.survived,status) ~ A*B + (1|group), data = survival)

When looking at the results, I noted that the coefficients and p-values for the individual treatment levels in fit1 (e.g. "A") are exactly the same as for the ones in fit2 (e.g. "Presence_A:+A)
fit1:
Model:  Surv(days.survived, status) ~ treatment + (1 | group) 
Fixed coefficients
                                coef exp(coef)  se(coef)     z    p
A                           --------- 1.5       --------  ----- 0.2
B                           --------- 1.4       --------  ----- 0.5
both                        --------- ---       -------- ------ ---



fit2
Model:  Surv(days.survived, status) ~ A * B + (1 | group) 
Fixed coefficients
                                coef exp(coef)  se(coef)     z    p
presence_A+A                --------- 1.5       --------  ----- 0.2
presence_B+B                --------- 1.4       --------  ----- 0.5
presence_A+A:presence_B+B   --------- ---       -------- ------ ---


I think I'm missing something important here. Because for me it makes no sense that the results should be identical. E.g. in the case the 2-factor analysis, presence_A+A refers to all treatments where A is present (treatments "A" and "both"). So +A basically compares treatments "A" & "both" vs. treatments "B" & "control". Whereas in the 1-factor analysis, a treatment (e.g. "A") group is compared to the "control". So even the underlying sample sizes are different.
Can anyone explain to me how these models can produce the same outputs? I also tried something similar with coxph, and got the same outcome. In the end, I'd be really interested to see the "main" effect of chemical A or B, but I don't really trust the analysis right now.
Thank you very much for your help!
All the best,
Asuka
 A: I will let others on this forum answer your question, but wanted to comment on something that you may find useful.
If you are ultimately interested in the "main" effects of A and B, then you should consider using the Anova() function from the car package of R with the appropriate type option for your setting, which will be a choice among type II or type III. This function would need to be applied to your fit2 model, which includes an interaction between A and B.
If you simply apply the anova function to your coxme model (note the lowercase a in its name), you will end up performing a type I (or sequential) anova, which is not what you need.
This nice post explains why you may want to consider a type III anova in your case (though ultimately you have to decide what makes most sense for your setting):
https://towardsdatascience.com/anovas-three-types-of-estimating-sums-of-squares-don-t-make-the-wrong-choice-91107c77a27a?gi=25c0f9e695cc
The post is titled ANOVA’s three types of estimating Sums of Squares: don’t make the wrong choice! and is written by Joos Korstanje for Towards Data Science.
The R commands you would therefore need are:
library(car)

Anova(fit2, type = "III") 

Note:
Another nice post is https://mcfromnz.wordpress.com/2011/03/02/anova-type-iiiiii-ss-explained/.
P.S. Can you list all estimated coefficients for your output? Some are missing.
