sigma() for mmrm - what does it exactly do? #362
-
I'd like to calculate Coheh's d effect sizes over a set of emmeans (changes-from-baseline at subsequent timepoints in a non-RCT) obtained from a mmrm model. The emmeans package has a helper function for it, e.g. Unfortunately, I cannot share the data but I can provide some details for easier discussion. I fit the same models using mmrm and nlme::gls() for comparisons. The two calls are equivalent. mmrm: Let's check: overall coefficients:
... and the LS-means with Satterthwaite DoF:
Lets also compare the residuals (they vary a little, but at this level it's negligible):
OK. Now let's find the residual SD (called eternally in R "residual standard error"...)
But
OK, not that much different, but I'm curious why both "sigmas" return different values for (asymptotically) same residuals. It alters the effect sizes then:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Thanks @Generalized for the question - honestly the generic library(mmrm)
fit <- mmrm(
formula = FEV1 ~ RACE + SEX + ARMCD * AVISIT + us(AVISIT | USUBJID),
data = fev_data
)
sigma(fit)
# 2.537345
methods("sigma")
# sigma.default* sigma.glm* sigma.gls* sigma.lme* sigma.lmList* sigma.mlm*
stats:::sigma.default
# function (object, use.fallback = TRUE, ...)
# sqrt(deviance(object, ...)/(nobs(object, use.fallback = use.fallback) -
#. sum(!is.na(coef(object))))) Here we have The nlme:::sigma.gls
# function (object, ...)
# object$sigma and one would need to find out from https://github.com/cran/nlme/blob/master/R/lme.R how exactly that is defined I guess. |
Beta Was this translation helpful? Give feedback.
Thanks @Generalized for the question - honestly the generic
sigma()
function was not on our radar so far at all!I would recommend that for now you implement that yourself manually so you know what is going on. I can see that currently the default method does something for
mmrm
objects but that is probably not what you want to do for the MMRMs: