easystats/parameters

pool_parameters df_error Infinity

ndsubison2178 opened this issue · 1 comments

What is the reason for seeing values like "Inf" in column df_error ? when using pool_parameter function to pool results after fitting model on mice imputed dataset ? Thanks.

Thanks, this is actually a lack of documentation. See this page how parameters resp. model_parameters() calculates DF. You can, however, pass down ci_method to get same df's as for summary(pool()), see example below. I have added this example to the docs.

library(parameters)
library(mice)
#> 
#> Attaching package: 'mice'
#> The following object is masked from 'package:stats':
#> 
#>     filter
#> The following objects are masked from 'package:base':
#> 
#>     cbind, rbind
data("nhanes2")
nhanes2$hyp <- datawizard::slide(as.numeric(nhanes2$hyp))
imp <- mice(nhanes2, printFlag = FALSE)

# example for multiple imputed datasets
models <- lapply(1:5, function(i) {
  glm(hyp ~ age + chl, family = binomial, data = complete(imp, action = i))
})
pool_parameters(models, ci_method = "residual")
#> # Fixed Effects
#> 
#> Parameter   | Log-Odds |      SE |              95% CI | Statistic |    df |     p
#> ----------------------------------------------------------------------------------
#> (Intercept) |   -24.25 | 3705.79 | [-7773.81, 7725.30] | -6.54e-03 | 19.25 | 0.995
#> age [40-59] |    19.15 | 3705.79 | [-7730.39, 7768.69] |  5.17e-03 | 19.25 | 0.996
#> age [60-99] |    19.20 | 3705.79 | [-7730.34, 7768.75] |  5.18e-03 | 19.25 | 0.996
#> chl         |     0.02 |    0.03 | [   -0.06,    0.10] |      0.66 |  7.05 | 0.529
#> 
#> Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
#>   using a Wald distribution approximation.

m <- with(data = imp, exp = glm(hyp ~ age + chl, family = binomial))
summary(pool(m))
#>          term     estimate    std.error    statistic        df   p.value
#> 1 (Intercept) -24.25308549 3.705795e+03 -0.006544638 19.248074 0.9948455
#> 2    age40-59  19.14995832 3.705788e+03  0.005167580 19.248074 0.9959301
#> 3    age60-99  19.20461747 3.705789e+03  0.005182330 19.248074 0.9959185
#> 4         chl   0.02245509 3.393717e-02  0.661666585  7.047894 0.5292163

Created on 2024-01-04 with reprex v2.0.2