Git Product home page Git Product logo

Comments (4)

ewenharrison avatar ewenharrison commented on July 29, 2024

Any random effect structure can be specified directly. Just specify directly.

# Summary, univariable and multivariable analyses of the form:
# lme4::glmer(dependent ~ explanatory + (1 | random_effect), family="binomial")

explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor")
random_effect = "(1 | hospital) + (1 | rx.factor)"
dependent = "mort_5yr"
colon_s %>%
   finalfit(dependent, explanatory, random_effect = random_effect)

We don't include random effect variances in the output directly.

colon_s %>%
  glmmixed(dependent, explanatory, random_effect = random_effect) 

Some details here:
https://finalfit.org/articles/all_tables_examples.html#mixed-effects-random-slope-model

Hope that helps.

from finalfit.

echughes avatar echughes commented on July 29, 2024

This is really helpful, thank you! Apologies for missing this.

Is there a way to include the random effects in the univariable analyses?

from finalfit.

ewenharrison avatar ewenharrison commented on July 29, 2024

That's one we've not been asked for before, but is obviously useful.
You could do this.

colon_s %>%
  finalfit(dependent, explanatory, random_effect = random_effect, keep_fit_id = TRUE) %>% 
    ff_merge(
      explanatory %>% 
        purrr::map_df(~ glmmixed(colon_s, dependent, .x, random_effect = random_effect) %>% 
          fit2df(estimate_suffix = " (univariable with RE)")
        ), 
      last_merge = TRUE
    ) %>% 
  dplyr::relocate(7, .before = 6) # reorder columns

  Dependent: Mortality 5 year          Alive       Died          OR (univariable)  OR (univariable with RE)           OR (multilevel)
                  Obstruction  No 408 (56.7) 312 (43.3)                         -                         -                         -
                              Yes  89 (51.1)  85 (48.9) 1.25 (0.90-1.74, p=0.189) 1.23 (0.83-1.83, p=0.310) 1.23 (0.82-1.83, p=0.313)
                  Perforation  No 497 (56.0) 391 (44.0)                         -                         -                         -
                              Yes  14 (51.9)  13 (48.1) 1.18 (0.54-2.55, p=0.672) 1.07 (0.44-2.57, p=0.888) 1.02 (0.42-2.46, p=0.969)

from finalfit.

echughes avatar echughes commented on July 29, 2024

That works beautifully - many thanks!

from finalfit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.