{"id":32176358,"url":"https://github.com/jacob-long/interactions","last_synced_at":"2025-10-21T19:58:57.825Z","repository":{"id":52888755,"uuid":"166895560","full_name":"jacob-long/interactions","owner":"jacob-long","description":"A comprehensive, user-friendly toolkit for visualizing and analyzing statistical interactions. A spinoff from the `jtools` package.","archived":false,"fork":false,"pushed_at":"2024-08-05T13:07:59.000Z","size":42440,"stargazers_count":133,"open_issues_count":37,"forks_count":20,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-10-21T19:58:51.798Z","etag":null,"topics":["interactions","moderation","r","r-package","rstats","social-sciences","statistics"],"latest_commit_sha":null,"homepage":"https://interactions.jacob-long.com","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jacob-long.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","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":"2019-01-21T23:38:23.000Z","updated_at":"2025-08-23T07:39:19.000Z","dependencies_parsed_at":"2024-01-10T16:11:01.510Z","dependency_job_id":"4f323ba8-c620-45c2-8fcd-dd757ce0fd9e","html_url":"https://github.com/jacob-long/interactions","commit_stats":{"total_commits":863,"total_committers":3,"mean_commits":287.6666666666667,"dds":0.01969872537659323,"last_synced_commit":"ada5e7593db3c13c74241f507ce695ddc0d79080"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/jacob-long/interactions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacob-long%2Finteractions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacob-long%2Finteractions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacob-long%2Finteractions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacob-long%2Finteractions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jacob-long","download_url":"https://codeload.github.com/jacob-long/interactions/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacob-long%2Finteractions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280325298,"owners_count":26311419,"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","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["interactions","moderation","r","r-package","rstats","social-sciences","statistics"],"created_at":"2025-10-21T19:58:56.820Z","updated_at":"2025-10-21T19:58:57.820Z","avatar_url":"https://github.com/jacob-long.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 = FALSE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/\",\n  fig.width = 6.5,\n  fig.height = 4,\n  #render = knitr::normal_print,\n  #dev.args=list(type=\"cairo\"),\n  # dev = \"png\",\n  dpi = 300,\n  retina = 1\n)\nlibrary(jtools)\n```\n\n# interactions  \u003cimg src=\"man/figures/logo.png\" alt=\"interactions\" height=\"250px\" align=\"right\" /\u003e\n\n\u003c!-- badges: start --\u003e\n[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version-ago/interactions)](https://cran.r-project.org/package=interactions)\n[![GitHub tag](https://img.shields.io/github/tag/jacob-long/interactions.svg?label=Github)](https://github.com/jacob-long/interactions)\n[![Total Downloads](https://cranlogs.r-pkg.org/badges/grand-total/interactions)](https://cran.r-project.org/package=interactions)\n[![R-CMD-check](https://github.com/jacob-long/interactions/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jacob-long/interactions/actions/workflows/R-CMD-check.yaml)\n[![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/qfyn5cwomufqxath?svg=true)](https://ci.appveyor.com/project/jacob-long/interactions)\n[![codecov](https://codecov.io/gh/jacob-long/interactions/branch/master/graph/badge.svg)](https://app.codecov.io/gh/jacob-long/interactions) \n[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://opensource.org/licenses/MIT)\n\u003c!-- badges: end --\u003e\n\n\nThis package consists of a number of tools for the analysis and \ninterpretation of statistical interactions in regression models. Some of these\nfeatures, especially  those that pertain to visualization, are not highly \nlabor-intensive to do oneself but are tedious and error-prone when done\n\"by hand.\" \n\nQuick rundown of features:\n\n* simple slopes analysis\n* calculation of Johnson-Neyman intervals\n* visualization of predicted and observed values using `ggplot2`\n\nAll of these are implemented in a consistent interface designed to be as\nsimple as possible with tweaks and guts available to advanced users. \nGLMs, models from the `survey` package, and multilevel models from `lme4`\nare fully supported as is visualization for Bayesian models from `rstanaram` \nand `brms`. Several other model types work \"out of the box\" even though they \nare not officially supported.\n\n\n## Installation\n\nThe package is available via CRAN.\n\n```r\ninstall.packages(\"interactions\")\n```\n\n## Usage\n\nUnless you have a keen eye and good familiarity with both the \nunderlying mathematics and the scale of your variables, it can be very\ndifficult to look at the output of regression model that includes an \ninteraction and completely understand what the model is telling you.\n\nThis package contains several means of aiding the understanding of and\ndoing statistical inference with interactions.\n\n### Johnson-Neyman intervals and simple slopes analysis\n\nThe \"classic\" way of probing an interaction effect is to calculate the\nslope of the focal predictor at different values of the moderator. When\nthe moderator is categorical, this is especially informative---e.g., what is \nthe slope for cats vs. dogs? But you can also arbitrarily choose points\nfor continuous moderators.\n\nWith that said, the more statistically rigorous way to explore these effects\nis to find the Johnson-Neyman interval, which tells you the range of values\nof the moderator in which the slope of the predictor is significant vs. \nnonsignificant at a specified alpha level.\n\nThe `sim_slopes` function will by default find the Johnson-Neyman interval\nand tell you the predictor's slope at specified values of the moderator;\nby default either both values of binary predictors or the mean and the\nmean +/- one standard deviation for continuous moderators.\n\n```{r j-n-plot}\nlibrary(interactions)\nfiti \u003c- lm(mpg ~ hp * wt, data = mtcars)\nsim_slopes(fiti, pred = hp, modx = wt, jnplot = TRUE)\n```\n\nThe Johnson-Neyman plot can help you get a handle on what the interval\nis telling you, too. Note that you can look at the Johnson-Neyman interval\ndirectly with the `johnson_neyman()` function.\n\nThe above all generalize to three-way interactions, too, although \nJohnson-Neyman intervals do not handle the second moderator in the way that \nthey do the first.\n\n### Visualizing interaction effects\n\nThis function plots two- and three-way interactions using `ggplot2` with a \nsimilar interface to the aforementioned `sim_slopes` function. Users can \ncustomize the appearance with familiar `ggplot2` commands. It supports several \ncustomizations, like confidence intervals.\n\n```{r interact_plot_continuous}\ninteract_plot(fiti, pred = hp, modx = wt, interval = TRUE)\n```\n\nYou can also plot the observed data for comparison:\n\n```{r interact_plot_continuous_points}\ninteract_plot(fiti, pred = hp, modx = wt, plot.points = TRUE)\n```\n\nThe function also supports categorical moderators---plotting observed data\nin these cases can reveal striking patterns.\n\n```{r interact_plot_factor}\nfitiris \u003c- lm(Petal.Length ~ Petal.Width * Species, data = iris)\ninteract_plot(fitiris, pred = Petal.Width, modx = Species, plot.points = TRUE)\n```\n\nYou may also combine the plotting and simple slopes functions by using\n`probe_interaction`, which calls both functions simultaneously. Categorical by\ncategorical interactions can be investigated using the `cat_plot()` function.\n\n## Contributing\n\nI'm happy to receive bug reports, suggestions, questions, and (most of all) \ncontributions to fix problems and add features. I prefer you use the Github \nissues system over trying to reach out to me in other ways. Pull requests for\ncontributions are encouraged.\n\nPlease note that this project is released with a \n[Contributor Code of Conduct](https://github.com/jacob-long/interactions/blob/master/CONDUCT.md).\nBy participating in this project you agree to abide by its terms.\n\n## License\n\nThe source code of this package is licensed under the\n[MIT License](https://opensource.org/licenses/mit-license.php).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacob-long%2Finteractions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacob-long%2Finteractions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacob-long%2Finteractions/lists"}