rvlenth / emmeans

Estimated marginal means
https://rvlenth.github.io/emmeans/
358 stars 31 forks source link

How to pass own degrees of freedom under multiple imputation? #499

Closed Generalized closed 3 months ago

Generalized commented 3 months ago

Let's assume I have a longitudinal study fit using GEE. Missing data are imputed using the mice algorithm.

GEE by default, depending on implementation, takes infinite DF or residual DF. But let's assume I want to provide my own df put as a single (let's say averaged) value, say, 107.

Yes, currently I can do this in emmeans, but this assignment is "late", I mean the assignment takes place after pooling the estimates.

x <- with(my_imputed_data, 
                             glmgee(response ~ predictors,
                                    id = ID,
                                    family = gaussian(link = "identity"),
                                    corstr = "unstructured") )

 emmeans(x, specs = ~predictor, df=107))  # first pooled, then 107 is assigned

So, in the output, the df will be 107 all the way down.

I would like to pass the df "earlier" to emmeans, before pooling. So the df will be different, depending on variance - the 107 will be "modified" by the pooling procedure.

Would it take a lot of work to provide some parameter say "df_early" or "df_prepool" or something like that, so the 107 assigned to this parameter was used before pooling and THEN the pooled along with the coefficients and covariances?

Say: emmeans(x, specs = ~predictor, df_prepool=107))

I know you're travelling, just leaving it for a discussion whey you return.

rvlenth commented 3 months ago

Please, no more new issues for a while.

rvlenth commented 3 months ago

Would it take a lot of work to provide some parameter say "df_early" or "df_prepool" or something like that...

Yes, it would.

Generalized commented 3 months ago

OK, though it's a pity, as it would enable one to make a more sensible analysis...