If I use the example from the documentation:
data(puppy_love, package = "modelbased")
cond_tx <- cbind("no treatment" = c(1, 0, 0), "treatment" = c(0, 0.5, 0.5))
model <- lm(happiness ~ puppy_love * dose, data = puppy_love)
estimate_slopes(model, "puppy_love", by = "dose", comparison = cond_tx)
things look fine, but if I specify the backend:
estimate_slopes(model, "puppy_love", by = "dose", comparison = cond_tx, backend = "emmeans")
estimate_slopes(model, "puppy_love", by = "dose", comparison = cond_tx, backend = "marginaleffects")
The emmeans gives output of:
Estimated Marginal Effects
dose | Slope | SE | 95% CI | t(24) | p
---------------------------------------------------------
No puppies | 0.76 | 0.27 | [ 0.21, 1.31] | 2.86 | 0.009
15 mins | 0.82 | 0.34 | [ 0.11, 1.53] | 2.40 | 0.025
30 mins | -0.22 | 0.28 | [-0.79, 0.35] | -0.79 | 0.436
where the marginaleffects one gives output for the custom contrasts:
Estimated Marginal Effects
Parameter | Slope | SE | 95% CI | t(24) | p
-----------------------------------------------------------
no treatment | 0.76 | 0.27 | [ 0.21, 1.31] | 2.86 | 0.009
treatment | 0.30 | 0.22 | [-0.15, 0.75] | 1.37 | 0.184
Marginal effects estimated for puppy_love
If I use the example from the documentation:
things look fine, but if I specify the backend:
The emmeans gives output of:
where the marginaleffects one gives output for the custom contrasts: