With a regular lm-object, I can extract sigma like this:
library(mice)
nhanes$group <- as.factor(c(rep("A", 12), rep("B", 13)))
m_1 <- lm(bmi ~ group + age, nhanes)
sigma(m_1)
However, extracting sigma on models conducted on imputed data sets results in an error:
imp <- mice::mice(nhanes, maxit = 2, m = 2)
m_2 <- with(imp, lm(bmi ~ group + age))
sigma(m_2)
# numeric(0)
# Warning message:
# In nobs.default(object, use.fallback = use.fallback) :
# no 'nobs' method is available
How would one proceed to extract sigma in the above example?
I have tried various combinations of with() and pool(), but they result in one of two errors:
with(m_2, sigma())
# Error in sigma.default() : argument "object" is missing, with no default
sigma(pool(m_2))
# numeric(0)
# Warning message:
# In nobs.default(object, use.fallback = use.fallback) :
# no 'nobs' method is available