1
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ Note that log(Apost/Apre)-log(Bpost/Pre) = log[(Apost/Apre)/(Bpost/Pre)]; Is that ratio-of-ratios meaningful? I many cases it's actually more meaningful than a difference of ratios. If that were the case you might be best to look at a log-link GLM. $\endgroup$ – Glen_b -Reinstate Monica Oct 13 '19 at 2:25
  • $\begingroup$ Ratio of ratios would be fine too. Can't use log-link though because it will distort the linearity in this case. The thing is that A and B are basically slopes of a continuous variable (that is how the physical theory works for this system) $\endgroup$ – Vattaka Oct 14 '19 at 0:02
  • $\begingroup$ Look at the regrid function in emmeans. It offers the possibility of converting results to the log scale, so that subsequent comparisons are expressive as ratios. See also the vignette on transformations, where there are examples. Also the vignette on comparisons has examples of contrasts of contrasts. $\endgroup$ – rvl Oct 14 '19 at 3:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.