{"id":16857548,"url":"https://github.com/tysonstanley/marginalmediation","last_synced_at":"2025-04-11T01:24:05.556Z","repository":{"id":54402123,"uuid":"83768629","full_name":"TysonStanley/MarginalMediation","owner":"TysonStanley","description":"R package that provides functions to perform and interpret marginal mediation analysis.","archived":false,"fork":false,"pushed_at":"2024-02-02T16:15:03.000Z","size":1974,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T22:39:51.811Z","etag":null,"topics":["average-marginal-effects","margins","mediation","mediation-analysis","mediator","partial-effects","r","rstudio"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TysonStanley.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-03T07:06:48.000Z","updated_at":"2022-11-08T14:34:02.000Z","dependencies_parsed_at":"2024-11-24T18:36:04.720Z","dependency_job_id":null,"html_url":"https://github.com/TysonStanley/MarginalMediation","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TysonStanley%2FMarginalMediation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TysonStanley%2FMarginalMediation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TysonStanley%2FMarginalMediation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TysonStanley%2FMarginalMediation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TysonStanley","download_url":"https://codeload.github.com/TysonStanley/MarginalMediation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248323572,"owners_count":21084533,"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":["average-marginal-effects","margins","mediation","mediation-analysis","mediator","partial-effects","r","rstudio"],"created_at":"2024-10-13T14:08:22.586Z","updated_at":"2025-04-11T01:24:05.540Z","avatar_url":"https://github.com/TysonStanley.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"README-\"\n)\nset.seed(84322)\n```\n\n\n\u003c!-- badges: start --\u003e\n  \n[![CRAN](https://www.r-pkg.org/badges/version/MarginalMediation)](https://www.r-pkg.org/badges/version/MarginalMediation)\n[![Downloads](http://cranlogs.r-pkg.org/badges/grand-total/MarginalMediation)](https://cranlogs.r-pkg.org/badges/grand-total/MarginalMediation)\n[![R build status](https://github.com/TysonStanley/MarginalMediation/workflows/R-CMD-check/badge.svg)](https://github.com/TysonStanley/MarginalMediation/actions)\n[![R-CMD-check](https://github.com/TysonStanley/MarginalMediation/workflows/R-CMD-check/badge.svg)](https://github.com/TysonStanley/MarginalMediation/actions)\n\u003c!-- badges: end --\u003e\n\n\n# MarginalMediation: `v 0.7.2`  \u003cimg src=\"man/figures/mma_hex.jpg\" align=\"right\" width=\"30%\" height=\"30%\"/\u003e\n\nThe `MarginalMediation` package provides the ability to perform **marginal mediation analysis**. It provides a useful statistical framework from which to interpret the coefficients in a mediation analysis, especially when the mediator(s) and/or outcome is binary or a count (other types of outcomes will be added).\n\nYou can install it via:\n```{r, eval=FALSE}\ninstall.packages(\"MarginalMediation\")\n```\nor\n```{r, eval=FALSE}\ninstall.packages(\"remotes\")\nremotes::install_github(\"tysonstanley/MarginalMediation\")\n```\n\nThe main function is `mma()`:\n```{r, eval=FALSE}\nmma(...,\n    ind_effects = c(\"apath-bpath\"))\n```\nwhere `...` consists of 2 or more model objects. The first is the `b` and `c'` path model, while the others are the `a` path models.\n\nThe `ind_effects` is a vector of requested mediated paths. These estimates are in terms of the average marginal effects using the `a x b` method of estimating indirect paths. Any number of these can be included, although it is limited to the number of variables available in the models.\n\n### A Quick Example\n\nBelow is an example, where the theoretical backing of such a model is not very stable, but it is useful to show how to use the function and the output.\n\n```{r}\n## Data for the example\nlibrary(furniture)\ndata(nhanes_2010)\n```\n\n\n```{r, eval = FALSE}\n## The MarginalMediation package\nlibrary(MarginalMediation)\n```\n```{r, echo = FALSE}\ndevtools::load_all()\n```\n\n```{r}\npathbc \u003c- glm(marijuana ~ home_meals + gender + age + asthma, \n              data = nhanes_2010, \n              family = \"binomial\")\npatha \u003c- glm(home_meals ~ gender + age + asthma,\n             data = nhanes_2010, \n             family = \"gaussian\")\nmma(pathbc, patha,\n    ind_effects = c(\"genderFemale-home_meals\",\n                    \"age-home_meals\",\n                    \"asthmaNo-home_meals\"),\n    boot = 500)\n```\n\nThe print method provides:\n\n1. the individual regression results,\n2. the `a` paths, \n3. the `b` paths, \n4. the indirect effect with the confidence interval, and\n5. the direct effect with the confidence interval. \n\nThe regressions are in their original (non-AME) units while the indirect and direct effects are in the AME units---the units of the outcome---in this case, risk of using marijuana.\n\n### Conclusions\n\nLet me know if you find any bugs or want to discuss the method (\u003ct.barrett@aggiemail.usu.edu\u003e).\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftysonstanley%2Fmarginalmediation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftysonstanley%2Fmarginalmediation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftysonstanley%2Fmarginalmediation/lists"}