I am utilizing gamlss currently because of its flexibility in specifying 'rarer' data families but run into an error when trying to compare 2-by-2 differences in mu effects for my fixed model factors.
This is the code:
library(gamlss)
m3=gamlss(y ~ x1 + x2 + x3 + x1 : x2 + x1 : x3 + x2 : x3,
data=dataset,
family=RG(),
n.cyc=100)
drop1(m3)
summary(m3)
library(emmeans)
emmeans(m3, x1)
emmip(m3, x1 ~ x2)
However, both of these commands related to the emmeans package result into the same error, namely:
> emmeans(m3, x1)
Error in V[idx, idx, drop = FALSE] : subscript out of bounds
> emmip(m3, x1 ~ x2) #look at 2-by-2 means with tukey HSD
Error in V[idx, idx, drop = FALSE] : subscript out of bounds
After looking for solutions online, I believe it is likely related to something in the gamlss baseline code, but cannot find where the issue lies exactly. Can anyone help with understanding what I am doing wrong? Solutions proposed in Post hoc analysis for gamlss model in R and https://stackoverflow.com/questions/56253376/emmeans-error-error-in-match-argtype-arg-should-be-one-of-link-respon are not fixing the issue.
(ggemmeans from 'ggeffects' package also returns the same error)
> ggemmeans(m3,"x1")
Can't compute estimated marginal means, 'emmeans::emmeans()' returned an error.
Reason: subscript out of bounds
You may try 'ggpredict()' or 'ggeffect()'.
NULL
gamlss
is pretty sketchy. The error you see is usually due to some mismatch in dimensions, e.g. returning some extra unexpected coefficients. It might be possible to cobble together something viaqdrg()
: by obtaining the correctcoef
,vcov
, etc., examining each carefully that they match up and match theformula
. See? qdrg
in emmeans $\endgroup$