1

I am trying to pool results from a multinomial logistic regression across multiple imputations using the mice package, but I am getting this error: No tidy method recognized for this list.

I have tried loading the broom.mixed package instead of the broom package, but this did not resolve the issue. I also have tried to use the pool.scalar function but this did not work either. Any help would be appreciated!

# create reproducible dataset

data <- structure(list(ID = c(1, 2, 3, 4, 47, 49, 50, 51, 52, 54, 55, 
                              56, 58, 59, 60, 61, 64, 66, 67, 70, 73, 75, 76, 77, 78, 79, 80, 
                              81, 82, 84, 86, 88, 90, 91, 92, 93, 94, 136, 137, 138, 140, 141, 
                              142, 143, 144, 145, 146, 147, 148, 149, 150, 152, 153, 154, 156, 
                              245, 246, 247, 248, 249, 250, 251, 253, 255, 256, 367, 368, 369, 
                              370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 
                              383, 386, 387, 388, 389, 390, 391, 392, 393, 394, 396, 397, 398, 
                              399, 400, 401, 402, 403, 406, 407, 408, 409, 410, 411, 412, 413, 
                              414, 415, 469, 470, 471, 472, 474, 475, 478, 481, 483, 484, 485, 
                              487, 488, 489, 490, 491, 492, 493, 495, 496, 497, 498, 587, 588, 
                              590, 591, 592, 593, 594, 595, 596, 597, 599, 600, 601, 656, 658, 
                              659, 660, 661, 662, 663, 666, 667, 669, 670, 671, 672, 673, 675, 
                              676, 679, 680, 682, 683, 685, 686, 687, 688, 689, 690, 691, 692, 
                              694, 695, 696, 698, 751, 752, 753, 754, 755, 756, 757, 758, 759, 
                              760, 762, 763, 764, 765, 777, 778, 779, 780, 782, 783, 784, 786, 
                              787, 788, 789, 790, 791, 793, 794, 795, 797, 798, 799, 800, 1235, 
                              1237, 1238, 1239, 1240, 1241, 1242, 1244, 1245, 1246, 1247, 1248, 
                              1249, 1250, 1252, 1254, 1255, 1256, 1257, 1258, 10017, 104, 10001, 
                              10002, 10005, 10006, 10009, 10010, 10011, 10014, 10019, 10021, 
                              10022, 10023, 10024, 10027, 10029, 10153, 10154, 10156), group = c(3, 
                                                                                                 1, 1, 4, 4, 3, 4, 1, 1, 4, 3, 2, 1, 1, 2, 1, 1, 1, 4, 4, 1, 1, 
                                                                                                 1, 2, 4, 4, 3, 1, 4, 1, 2, 4, 1, 1, 4, 2, 4, 4, 4, 4, 4, 1, 2, 
                                                                                                 4, 3, 2, 1, 2, 1, 1, 4, 4, 2, 2, 4, 1, 1, 3, 2, 1, 2, 2, 2, 2, 
                                                                                                 4, 3, 2, 3, 4, 3, 2, 1, 4, 4, 1, 1, 2, 1, 4, 4, 3, 4, 3, 2, 1, 
                                                                                                 3, 2, 2, 2, 4, 2, 3, 3, 3, 1, 3, 3, 1, 2, 4, 2, 3, 3, 4, 1, 4, 
                                                                                                 2, 4, 1, 1, 3, 2, 2, 2, 4, 2, 4, 1, 4, 3, 2, 3, 4, 2, 3, 3, 2, 
                                                                                                 2, 1, 1, 3, 2, 1, 2, 2, 4, 4, 2, 2, 1, 3, 4, 4, 2, 2, 1, 4, 1, 
                                                                                                 2, 4, 3, 4, 2, 4, 4, 4, 3, 3, 1, 4, 2, 3, 1, 1, 4, 4, 4, 1, 4, 
                                                                                                 4, 2, 4, 4, 1, 4, 1, 2, 4, 3, 1, 4, 3, 2, 4, 4, 3, 1, 4, 2, 1, 
                                                                                                 3, 3, 2, 1, 1, 2, 3, 2, 3, 4, 4, 4, 2, 2, 2, 1, 1, 2, 1, 2, 1, 
                                                                                                 4, 1, 1, 2, 4, 3, 1, 4, 4, 2, 4, 4, 1, 4, 4, 4, 2, 1, 2, 3, 3, 
                                                                                                 1, 3, 1, 1, 4, 1, 4, 1, 3, 1, 1, 4, 2, 4, 3, 4, 1, 4), age = c(10, 
                                                                                                                                                                10, 8, 8, 10, 13, 11, 8, 12, 11, 13, 11, 9, 11, 12, 10, 11, 8, 
                                                                                                                                                                12, 12, 11, 10, 10, 12, 13, 8, 13, 10, 9, 9, 12, 11, 11, 9, 11, 
                                                                                                                                                                13, 10, 10, 9, 12, 10, 8, 10, 12, 10, 8, 11, 10, 10, 9, 8, 9, 
                                                                                                                                                                9, 10, 13, 12, 8, 8, 12, 10, 9, 8, 9, 12, 9, 14, 11, 12, 8, 10, 
                                                                                                                                                                8, 11, 11, 8, 9, 12, 10, 8, 11, 12, 13, 8, 10, 11, 11, 10, 13, 
                                                                                                                                                                12, 9, 14, 13, 10, 13, 13, 13, 11, 12, 9, 12, 10, 14, 10, 13, 
                                                                                                                                                                9, 9, 10, 10, 10, 11, 9, 10, 9, 11, 9, 12, 10, 10, 12, 12, 8, 
                                                                                                                                                                12, 11, 11, 14, 13, 11, 9, 13, 9, 9, 10, 10, 10, 10, 11, 10, 
                                                                                                                                                                11, 12, 13, 10, 11, 12, 10, 12, 11, 9, 13, 8, 13, 10, 11, 9, 
                                                                                                                                                                9, 10, 9, 10, 12, 10, 10, 8, 9, 12, 10, 10, 12, 10, 8, 8, 11, 
                                                                                                                                                                11, 10, 10, 10, 10, 12, 9, 13, 8, 11, 12, 11, 14, 10, 12, 8, 
                                                                                                                                                                8, 10, 11, 8, 12, 14, 13, 10, 9, 10, 8, 11, 12, 13, 9, 13, 11, 
                                                                                                                                                                13, 8, 11, 9, 9, 8, 10, 8, 8, 10, 9, 13, 9, 9, 8, 9, 13, 11, 
                                                                                                                                                                11, 9, 10, 11, 10, 8, 10, 14, 8, 12, 10, 11, 10, 9, 12, 8, 13, 
                                                                                                                                                                8, 12, 11, 13, 8, 9, 8, 11, 13, 9, 12, 8, 13), dep.comp = c(1.14285714285714, 
                                                                                                                                                                                                                            1.42857142857143, 1.83333333333333, 1.42857142857143, 1, 2.28571428571429, 
                                                                                                                                                                                                                            1.85714285714286, 1.42857142857143, 1.71428571428571, 2, 3, 1.42857142857143, 
                                                                                                                                                                                                                            1.14285714285714, 1, 1.71428571428571, 1.42857142857143, 1.28571428571429, 
                                                                                                                                                                                                                            NA, 2.28571428571429, 1.42857142857143, 2.14285714285714, 1, 
                                                                                                                                                                                                                            1, 1.14285714285714, 1.42857142857143, NA, 3.42857142857143, 
                                                                                                                                                                                                                            1, 1, 1.14285714285714, 1.42857142857143, 1.28571428571429, 2.14285714285714, 
                                                                                                                                                                                                                            1.28571428571429, 1.57142857142857, NA, 1.85714285714286, 2.14285714285714, 
                                                                                                                                                                                                                            1.71428571428571, 1, 1.71428571428571, 2.28571428571429, 1.71428571428571, 
                                                                                                                                                                                                                            2.42857142857143, 2.42857142857143, 1.28571428571429, 1, 1.28571428571429, 
                                                                                                                                                                                                                            1.14285714285714, 1.71428571428571, NA, 1.57142857142857, NA, 
                                                                                                                                                                                                                            1.57142857142857, NA, 1.14285714285714, 1.14285714285714, 1, 
                                                                                                                                                                                                                            1.14285714285714, 1, 1.57142857142857, 2.42857142857143, 1.57142857142857, 
                                                                                                                                                                                                                            1.28571428571429, 1.57142857142857, 1.57142857142857, 1.14285714285714, 
                                                                                                                                                                                                                            1.42857142857143, NA, 1.71428571428571, 2.57142857142857, 1.57142857142857, 
                                                                                                                                                                                                                            1.14285714285714, 3.42857142857143, 1, 1.71428571428571, 1.14285714285714, 
                                                                                                                                                                                                                            2.14285714285714, 1.71428571428571, 1, 1.14285714285714, 2, 1.85714285714286, 
                                                                                                                                                                                                                            1.71428571428571, 2.33333333333333, 1.71428571428571, 1.85714285714286, 
                                                                                                                                                                                                                            1.57142857142857, 2, NA, 1, 1.42857142857143, 2.42857142857143, 
                                                                                                                                                                                                                            2, 2.28571428571429, NA, 1.42857142857143, 1.85714285714286, 
                                                                                                                                                                                                                            1.42857142857143, 1.28571428571429, NA, 1.42857142857143, 1.85714285714286, 
                                                                                                                                                                                                                            1, 1.14285714285714, 1.28571428571429, 2.42857142857143, 1.42857142857143, 
                                                                                                                                                                                                                            2.85714285714286, 2, 1.85714285714286, NA, 1.28571428571429, 
                                                                                                                                                                                                                            1.28571428571429, 1.57142857142857, NA, 1.42857142857143, 1, 
                                                                                                                                                                                                                            1.85714285714286, NA, 3.14285714285714, 1.42857142857143, 2.71428571428571, 
                                                                                                                                                                                                                            1.85714285714286, 1.71428571428571, 1.85714285714286, 2.57142857142857, 
                                                                                                                                                                                                                            1.33333333333333, 1.14285714285714, 1.57142857142857, 1.42857142857143, 
                                                                                                                                                                                                                            2.42857142857143, 2, 1.71428571428571, 1.71428571428571, 1.57142857142857, 
                                                                                                                                                                                                                            2.85714285714286, 1.14285714285714, NA, 1.57142857142857, 1.42857142857143, 
                                                                                                                                                                                                                            1.85714285714286, 1.14285714285714, 2, 1.14285714285714, NA, 
                                                                                                                                                                                                                            3.14285714285714, 2, 1, 1.42857142857143, 1, NA, 2.71428571428571, 
                                                                                                                                                                                                                            2, 2.71428571428571, 1.28571428571429, 2.14285714285714, 1.14285714285714, 
                                                                                                                                                                                                                            1.14285714285714, 1.57142857142857, 2.14285714285714, 1.85714285714286, 
                                                                                                                                                                                                                            1.57142857142857, 1.42857142857143, 1.14285714285714, 1.71428571428571, 
                                                                                                                                                                                                                            1.42857142857143, NA, 1.14285714285714, 1.14285714285714, 2.57142857142857, 
                                                                                                                                                                                                                            1.85714285714286, 2.25, 2.71428571428571, 1.42857142857143, 1.14285714285714, 
                                                                                                                                                                                                                            2, 1.42857142857143, 1.57142857142857, 1.28571428571429, 1, 2.28571428571429, 
                                                                                                                                                                                                                            1.85714285714286, 1.57142857142857, 1.57142857142857, 2.71428571428571, 
                                                                                                                                                                                                                            1.71428571428571, 1.14285714285714, 1.71428571428571, 1.14285714285714, 
                                                                                                                                                                                                                            1.85714285714286, 2.57142857142857, 1.57142857142857, 1.57142857142857, 
                                                                                                                                                                                                                            1.33333333333333, 1.42857142857143, 1.85714285714286, 1.42857142857143, 
                                                                                                                                                                                                                            2, 1.14285714285714, 1.28571428571429, 2.16666666666667, 1.28571428571429, 
                                                                                                                                                                                                                            1.57142857142857, 1.28571428571429, 1.14285714285714, NA, 1.42857142857143, 
                                                                                                                                                                                                                            1.14285714285714, 1.71428571428571, 1, NA, 1.5, 1.14285714285714, 
                                                                                                                                                                                                                            1.28571428571429, 1.71428571428571, NA, 1, 1, 1.71428571428571, 
                                                                                                                                                                                                                            1.42857142857143, NA, 2.28571428571429, 1, 2.16666666666667, 
                                                                                                                                                                                                                            1.28571428571429, NA, 3.71428571428571, 1.57142857142857, 1.66666666666667, 
                                                                                                                                                                                                                            1.85714285714286, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
                                                                                                                                                                                                                            NA, NA, NA, NA, NA, NA, NA, NA), soc.anx.comp = c(2, 1.25, NA, 
                                                                                                                                                                                                                                                                              1.75, 1.5, 2.25, NA, 1.25, 1.5, NA, NA, NA, 1.25, 1, 2, 4, 1, 
                                                                                                                                                                                                                                                                              1.75, 3.75, 1, 2.5, NA, 1, 2, 1.5, 1.33333333333333, 3, 1.25, 
                                                                                                                                                                                                                                                                              1.5, 1.75, 1.75, 1.75, 1.5, 1, 1.5, 2.5, 2.5, 1.66666666666667, 
                                                                                                                                                                                                                                                                              1.5, 2.75, 1.5, 3.25, 2.25, 2.33333333333333, 1.75, 1.5, 2, 1.5, 
                                                                                                                                                                                                                                                                              1.25, 2.25, 2.25, NA, 2, 2, 3, 1.5, 1.5, 2.5, NA, 1, 1.75, 3.25, 
                                                                                                                                                                                                                                                                              2.25, 1.5, 1.25, 2, 1, 1, 1.33333333333333, 1, 1, 1.25, 2.25, 
                                                                                                                                                                                                                                                                              3, 1.5, 1.25, 1.25, NA, 1, 1, 1.75, 2, 3.25, 2, 3, 1.75, 2.5, 
                                                                                                                                                                                                                                                                              1.5, 1, 2.25, 1.5, 2.5, 3, 2.5, 3, 1, 1.25, 2.5, 1.75, 1.66666666666667, 
                                                                                                                                                                                                                                                                              1.75, 1.25, 1.5, 1.75, 1.5, NA, 1, 1.25, 2.25, 2.5, 3, 1.5, 2.25, 
                                                                                                                                                                                                                                                                              1.5, 2.25, 1, 1.75, NA, 1, 3.5, 2, 1.25, 1.25, 2, 1.5, 1, 1.25, 
                                                                                                                                                                                                                                                                              1.75, 1.25, 1.25, 1.5, 1.5, 2, 1.25, 1.5, 2, 2.75, 3.75, 3.75, 
                                                                                                                                                                                                                                                                              1.75, 1, 1.75, 1.25, 2.25, 1.5, 2, 3.5, 1.75, 1.5, 1, 1, 1.75, 
                                                                                                                                                                                                                                                                              3.25, 3.75, 2.5, 1.25, 2.75, 1.25, 1.5, 1.75, 1.75, 2.5, 1.25, 
                                                                                                                                                                                                                                                                              1.25, 3.5, 3.5, 1.5, 1, 1.5, 1.25, 3.5, NA, 3.33333333333333, 
                                                                                                                                                                                                                                                                              3.5, 1.5, 1.5, 1.25, 1, 2.5, 1.75, 1.25, 4, 1.75, 3, 3.75, 4, 
                                                                                                                                                                                                                                                                              1.5, 1.5, 1.75, NA, 1.5, 3.75, 1.25, 2.75, 1.5, 1.25, 2.25, 1.5, 
                                                                                                                                                                                                                                                                              NA, 1, NA, 1.25, 1, 1, 2.5, 1.5, 3.5, 1.25, 1, 2.25, NA, 2, 1.75, 
                                                                                                                                                                                                                                                                              3.5, 1.75, 1.75, 1.25, 1.75, 1.25, 2.5, NA, 1, 2, 2, 2.25, 1.75, 
                                                                                                                                                                                                                                                                              1, 3.25, 1.5, 2, 1.5, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
                                                                                                                                                                                                                                                                              NA, NA, NA, NA, NA, NA, NA, NA, NA)), class = "data.frame", row.names = c(NA, 
                                                                                                                                                                                                                                                                                                                                                        -250L))

Attempted code:

library(tidyverse)
library(mice)
library(nnet)
set.seed(123)
# specifying each ref category for 4 groups
ref_list<- with(data,
                list(ref1= c("1", "2", "3", "4"),
                     ref2= c("2", "1", "3", "4"),
                     ref3= c("3", "1", "2", "4"),
                     ref4= c("4", "1", "2", "3")))    

# create a factored variable that has all four different reference possibilities
factor_list<-map(ref_list, ~factor(data$group, levels =.)) 

# standardize variables
data_scale<-as_tibble(scale(data))

# Impute missing data
imputed_data <- mice(data_scale, m = 10)

# Fit multinomial logistic regression model for each imputed dataset
models <- with(imputed_data, map(factor_list, ~multinom(. ~ age + dep.comp + soc.anx.comp)))
summary(pool(models))
meghanborg
  • 11
  • 2
  • Can you make your post reproducible and provide `dput(data)`? See more here: https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – jrcalabrese May 02 '23 at 15:29
  • @jrcalabrese Hi there-- I have edited the post to make it reproducible. Thank you! – meghanborg May 02 '23 at 19:55
  • Hi @meghanborg! Great question here - could you edit your question to include only the external libraries that are needed to reproduce this issue? I would but I dont know which ones are required. Also, there are a lot of packages listed that may not be needed and you include code that resets global options (i.e., `options(...)` - folks typically dont like resetting these for SO questions, and they are not critical to the question. If you parse your attempted code down to the *minimal* amount of code needed to recreate the issue, you may get better, faster help. Just trying to help, good luck! – jpsmith May 02 '23 at 20:31
  • Hi @jpsmith-- thank you so much for that suggestion! I have made those edits to only include necessary external libraries and remove the code that resets global options. – meghanborg May 02 '23 at 21:33

0 Answers0