Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tidy.mipo(x, ...) passes ... to summary(x, ...) #276

Merged
merged 1 commit into from
Oct 24, 2020
Merged

tidy.mipo(x, ...) passes ... to summary(x, ...) #276

merged 1 commit into from
Oct 24, 2020

Conversation

vincentarelbundock
Copy link
Contributor

This PR changes 2 lines of code.

Motivation: It would often be useful for tidy.mipo to pass ... to summary. For example, to use the exponentiate=TRUE option in logistic regression:

    library(mice)
    library(tidyverse)
    data("toenail2")

    xdata <- tidyr::complete(toenail2, patientID, visit) %>%
      tidyr::fill(treatment) %>%
      dplyr::select(-time) %>%
      dplyr::mutate(patientID = as.integer(patientID))

    z1imp <- mice(xdata, method = "pmm", maxit = 1, m = 5, seed = 1)
    z1model <- with(z1imp, glm(outcome ~ treatment, binomial))
    z1model.pool <- pool(z1model)

    tidy(z1model.pool)
    #>                   term   estimate  std.error  statistic   p.value            b
    #> 1          (Intercept) -1.2671348 0.07899231 -16.041242 0.0000000 0.0004436482
    #> 2 treatmentterbinafine -0.1558574 0.11681645  -1.334208 0.1835811 0.0014746179
    #>         df dfcom        fmi     lambda m        riv        ubar
    #> 1 425.1451  2056 0.08959265 0.08531989 5 0.09327839 0.005707408
    #> 2 209.9417  2056 0.13784827 0.12967396 5 0.14899469 0.011876541

    tidy(z1model.pool, exponentiate=TRUE)
    #>                   term  estimate  std.error  statistic   p.value            b
    #> 1          (Intercept) 0.2816374 0.07899231 -16.041242 0.0000000 0.0004436482
    #> 2 treatmentterbinafine 0.8556812 0.11681645  -1.334208 0.1835811 0.0014746179
    #>         df dfcom        fmi     lambda m        riv        ubar
    #> 1 425.1451  2056 0.08959265 0.08531989 5 0.09327839 0.005707408
    #> 2 209.9417  2056 0.13784827 0.12967396 5 0.14899469 0.011876541

@stefvanbuuren stefvanbuuren merged commit 42050e0 into amices:master Oct 24, 2020
@stefvanbuuren
Copy link
Member

Useful extension. Thanks.

@mcomsa
Copy link

mcomsa commented Oct 25, 2020

Thank you so much for the change. Now estimates are exponentiated, but standard errors are not. Please, see the same example.

@vincentarelbundock
Copy link
Contributor Author

@mcomsa this is broom issue. Please see my reproducible example in the linked issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants