So I have it a Generalized Linear Mixed Model and am looking to do contrasts. However, in this case, the biochemically relevant contrast is not a simple difference of differences. It is the difference in the relative effect. For simplicity here is how it is. It is a Pre/Post design. And also we have a covariate and want to compare slopes so emtrends() is the relevant function in R.
Consider 2 levels: A and B
The standard contrast of differences of differences is (Apost-Apre)-(Bpost-Bpre). I know how to compute this using emtrends as well as how to correct for multiple comparisons (in reality we have multiple levels and comparisons but for this I am showing just 2 since the answer can be applied to all).
The relevant contrast however is Apost/Apre - Bpost/BPre. And Post < Pre for all, therefore 0<=XPost/Xpre<=1. It is a bounded random variable.
I am not sure how to compute this contrast. I presume it has to be done via the user and invoking the Delta Method from the theory of Mathematical Statistics. This may be one of the few occasions where the theory is relevant to solving the problem whereas usually things are done formulaically. Also, the original data is untransformed and fitted with a Gamma GLMM and we are comparing slope coefficient of a continuous covariate (hence using emtrends).
I am thinking maybe its best to compare log(Apost/Apre)-log(Bpost/Pre) as an approximate test. This amounts to (log(Apost)-log(Apre))-(log(Bpost)-log(Bpre)).
My idea is that this is valid also since the values of A and B are always positive. Using the delta method on the emtrends() values and SE, can I compute this contrast by hand?
I would use the formula var(X-Y)=var(X)+var(Y)-2*cov(X,Y) so I would need the full covariance matrix that gives me the covariances between Apost,Apre,Bpost,Bpre etc.
This seems very complicated, but is it a valid way to get the contrast? The main issue is that the relative difference is the biochemically relevant contrast, which is inherently a nonlinear contrast.