{"id":21985770,"url":"https://github.com/m-clark/mixedup","last_synced_at":"2025-04-30T07:54:02.904Z","repository":{"id":52892467,"uuid":"218112573","full_name":"m-clark/mixedup","owner":"m-clark","description":"An R package for extracting results from mixed models that are easy to use and viable for presentation.","archived":false,"fork":false,"pushed_at":"2022-10-11T15:07:37.000Z","size":173788,"stargazers_count":71,"open_issues_count":3,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-30T07:53:41.706Z","etag":null,"topics":["brms","glmmtmb","lme4","mgcv","mixed-models","nlme","random-coefficients","random-effects","variance-components"],"latest_commit_sha":null,"homepage":"http://m-clark.github.io/mixedup","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/m-clark.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-28T18:01:12.000Z","updated_at":"2025-04-27T23:41:41.000Z","dependencies_parsed_at":"2023-01-19T21:06:36.714Z","dependency_job_id":null,"html_url":"https://github.com/m-clark/mixedup","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-clark%2Fmixedup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-clark%2Fmixedup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-clark%2Fmixedup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-clark%2Fmixedup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/m-clark","download_url":"https://codeload.github.com/m-clark/mixedup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251666246,"owners_count":21624292,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["brms","glmmtmb","lme4","mgcv","mixed-models","nlme","random-coefficients","random-effects","variance-components"],"created_at":"2024-11-29T18:14:40.610Z","updated_at":"2025-04-30T07:54:02.874Z","avatar_url":"https://github.com/m-clark.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: \n  github_document:\n    # toc: true\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit here --\u003e\n\n```{r setup, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = NA,\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n\u003cimg src=\"man/figures/package_logo.png\" style=\"margin: 0 auto; width: 120px; valign: top\" align = 'right'  alt=\"mixedup Logo\" width = 120\u003e\u003cbr\u003e\n\n# mixedup \n\n##### a package for extracting clean results from mixed models \n\n\u003cbr\u003e\n\u003cbr\u003e\n\n\u003c!-- badges: start --\u003e\n\n[![Codecov test coverage](https://codecov.io/gh/m-clark/mixedup/branch/master/graph/badge.svg)](https://codecov.io/gh/m-clark/mixedup?branch=master)\n[![R-CMD-check](https://github.com/m-clark/mixedup/actions/workflows/check-standard.yaml/badge.svg)](https://github.com/m-clark/mixedup/actions/workflows/check-standard.yaml)\n[![pkgdown](https://github.com/m-clark/mixedup/actions/workflows/pkgdown.yaml/badge.svg)](https://github.com/m-clark/mixedup/actions/workflows/pkgdown.yaml)\n[![test-coverage](https://github.com/m-clark/mixedup/actions/workflows/test-coverage.yaml/badge.svg)](https://github.com/m-clark/mixedup/actions/workflows/test-coverage.yaml)\n[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)\n\u003c!-- badges: end --\u003e\n\n\n\nThis package provides extended functionality for mixed models. The goal of `mixedup` is to solve little problems I have had that slip through the cracks from the various modeling packages and others in trying to get presentable output.  Basically the idea is to create (tidy) objects that are easy to use and essentially ready for presentation, as well as *consistent* across packages and across functions.  Such objects would be things like  variance components and random effects.  I use several of these packages (including mgcv) for mixed models, and typically have to do some notable post processing to get some viable output even with `broom::tidy`, and this effort often isn't applicable if I switch to another package for the same type of model.  These functions attempt to address this issue.\n\nFor more details and examples see https://m-clark.github.io/mixedup/.\n\n\n## Installation\n\nYou can install mixedup from GitHub with `remotes`.  Use the second approach if you don't already have `rstanarm` or `brms` (they aren't required to use in general).\n\n``` r\nremotes::install_github('m-clark/mixedup')\n\n# if you don't already have rstanarm and/or brms\n\nwithr::with_envvar(c(R_REMOTES_NO_ERRORS_FROM_WARNINGS = \"true\"), \n  remotes::install_github('m-clark/mixedup')\n)\n```\n\n\n## Supported models\n\n- `lme4`\n- `glmmTMB`\n- `nlme`\n- `mgcv`\n- `rstanarm`\n- `brms`\n\n\n## Feature list\n\n- Extract Variance Components\n- Extract Random Effects\n- Extract Fixed Effects\n- Extract Random Coefficients\n- Extract Heterogeneous Variances\n- Extract Correlation Structure\n- Extract Model Data\n- Summarize Model\n- Find Typical\n\n\nNot all features are available to the various modeling packages (e.g. autocorrelation for `lme4`), and some functionality may just not be supported for this package, but most functions are applicable to the packages listed.\n\n## Examples\n\n### Setup\n\nIn the following I suppress the package startup and other information that isn't necessary for demo.\n\n```{r loadbayes, echo=FALSE}\nbrm_model \u003c- mixedup:::brms_model\nrstanarm_model \u003c- mixedup:::rstanarm_model\n```\n\n```{r mods, results='hide', message=FALSE, warning=FALSE}\nlibrary(lme4)\n\nlmer_model \u003c- lmer(Reaction ~ Days + (1 + Days | Subject), data = sleepstudy)\n\nlibrary(glmmTMB)\n\ntmb_model \u003c- glmmTMB(Reaction ~ Days + (1 + Days | Subject), data = sleepstudy)\n\nlibrary(nlme)\n\nnlme_model \u003c-  nlme(\n  height ~ SSasymp(age, Asym, R0, lrc),\n  data = Loblolly,\n  fixed = Asym + R0 + lrc ~ 1,\n  random = Asym ~ 1,\n  start = c(Asym = 103, R0 = -8.5, lrc = -3.3)\n)\n\nlibrary(brms)\n\n# brm_model = brm(\n#   Reaction ~ Days + (1 + Days | Subject), \n#   data = sleepstudy, \n#   refresh = -1,\n#   verbose = FALSE,\n#   open_progress = FALSE,\n#   cores = 4,\n#   iter = 1000\n# )\n\nlibrary(rstanarm)\n\n# rstanarm_model = stan_glmer(\n#   Reaction ~ Days + (1 + Days | Subject), \n#   data = sleepstudy, \n#   refresh = -1,\n#   verbose = FALSE,\n#   show_messages = FALSE,\n#   open_progress = FALSE,\n#   cores = 4,\n#   iter = 1000\n# )\n\nlibrary(mgcv)\n\ngam_model = gam(\n  Reaction ~  Days +\n    s(Subject, bs = 're') +\n    s(Days, Subject, bs = 're'),\n  data = lme4::sleepstudy,\n  method = 'REML'\n)\n```\n\n\n### Extract Output from a Mixed Model\n\n```{r extract-re, message=TRUE}\nlibrary(mixedup)\n\nextract_random_effects(tmb_model)\n\nextract_fixed_effects(nlme_model)\n\nextract_random_coefs(lmer_model)\n\nextract_vc(brm_model, ci_level = .8)\n\nsummarize_model(lmer_model, cor_re = TRUE, digits = 1)\n\nfind_typical(gam_model, probs = c(.25, .50, .75))\n```\n\n### Consistent output\n\n```{r samestuff}\nmods = list(\n  tmb  = tmb_model,\n  lmer = lmer_model, \n  brm  = brm_model,\n  stan = rstanarm_model,\n  gam  = gam_model\n)\n\npurrr::map_df(mods, extract_vc, .id = 'model') \n```\n\n\n\n## Code of Conduct\n\nPlease note that the 'mixedup' project is released with a [Contributor Code of Conduct](.github/CODE_OF_CONDUCT.md).\n\nBy contributing to this project, you agree to abide by its terms.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm-clark%2Fmixedup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm-clark%2Fmixedup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm-clark%2Fmixedup/lists"}