{"id":20207547,"url":"https://github.com/alexiajm/legit","last_synced_at":"2025-04-10T12:34:27.014Z","repository":{"id":177429342,"uuid":"81841351","full_name":"AlexiaJM/LEGIT","owner":"AlexiaJM","description":"An R package for the Latent Environmental \u0026 Genetic InTeraction (LEGIT) model","archived":false,"fork":false,"pushed_at":"2021-02-11T15:46:15.000Z","size":2363,"stargazers_count":12,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T11:21:20.292Z","etag":null,"topics":["environment","genetic-variants","genetics","glm","gxe","gxe-modelling","interactions","latent-variable-models","latent-variables","r"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlexiaJM.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS","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":"2017-02-13T15:42:43.000Z","updated_at":"2023-08-31T07:45:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"91c2eb3d-e602-4974-8984-600803358ed4","html_url":"https://github.com/AlexiaJM/LEGIT","commit_stats":null,"previous_names":["alexiajm/legit"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexiaJM%2FLEGIT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexiaJM%2FLEGIT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexiaJM%2FLEGIT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexiaJM%2FLEGIT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlexiaJM","download_url":"https://codeload.github.com/AlexiaJM/LEGIT/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248217146,"owners_count":21066633,"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":["environment","genetic-variants","genetics","glm","gxe","gxe-modelling","interactions","latent-variable-models","latent-variables","r"],"created_at":"2024-11-14T05:29:44.666Z","updated_at":"2025-04-10T12:34:27.003Z","avatar_url":"https://github.com/AlexiaJM.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Latent Environmental and Genetic InTeraction model (LEGIT) and tools for GxE testing\r\n\r\n[![](http://cranlogs.r-pkg.org/badges/LEGIT)](http://cran.rstudio.com/web/packages/LEGIT/index.html)\r\n[![](http://cranlogs.r-pkg.org/badges/grand-total/LEGIT)](http://cran.rstudio.com/web/packages/LEGIT/index.html)\r\n\r\nThis package contains the official R implementation of the *Latent Environmental \u0026amp; Genetic InTeraction* (LEGIT) model and additional tools for gene-by-environment (GxE) testing. \r\n\r\n![](https://raw.githubusercontent.com/AlexiaJM/LEGIT/master/images/LEGIT.png)\r\n\r\n## Citation\r\n\r\nIf you use this software, please cite:\r\n\r\n``\r\nJolicoeur-Martineau, A., Wazana, A., Szekely, E., Steiner, M., Fleming, A. S., Kennedy, J. L., ... \u0026 Greenwood, C. M. (2018). Alternating optimization for G× E modelling with weighted genetic and environmental scores: Examples from the MAVAN study. Psychological methods.\r\n``\r\n\r\nPaper: https://www.dropbox.com/s/swkwcnc4b4bvx8f/Jolicoeur-Martineau%20et%20al.%2C%202019_alt.pdf?dl=0\r\n\r\nIf you use the function for GxE interaction testing, please also cite:\r\n\r\n``\r\nJolicoeur-Martineau, A., Belsky, J., Szekely, E., Widaman, K., Pluess, M., Greenwood, C., \u0026 Wazana, A. (2020). Distinguishing differential susceptibility, diathesis-stress, and vantage sensitivity: Beyond the single gene and environment model. Development and Psychopathology, 32(1), 73-83. doi:10.1017/S0954579418001438\r\n``\r\n\r\nPaper: https://www.dropbox.com/s/py5r3ye5cyl3prw/Jolicoeur-Martineau%20et%20al.%2C%202019.pdf?dl=0\r\n\r\n##  Description\r\n\r\nThe LEGIT model is an interaction model with two latent variables: a weighted sum of genetic variants (genetic score) and a weighted sum of environmental variables (environmental score). Alternating optimization is used to estimate the model parameters (https://arxiv.org/abs/1703.08111). This approach has greatly enhanced predictive power over traditional GxE models which include only a single genetic variant and a single environmental exposure. Although this approach was originally made for GxE modelling, it is flexible and does not require the use of genetic and environmental variables. It can also handle more than 2 latent variables (rather than just G and E) and 3-way interactions or more. The LEGIT model produces highly interpretable results and is very parameter-efficient thus it can even be used with small sample sizes (n \u003c 250). Tools to determine the type of interaction (vantage sensitivity, diathesis-stress or differential susceptibility), with any number of genetic variants or environments, are available (https://psyarxiv.com/27uw8).\r\n\r\n## How to use\r\n\r\nThere are a few vignettes available to help in using the package:\r\n\r\n* For usage of the LEGIT models, see: https://cran.r-project.org/web/packages/LEGIT/vignettes/LEGIT.html\r\n* For usage of the GxE testing as per [Belsky et al. (2013)](https://www.researchgate.net/publication/256600905_FormalGXEtestJCPP2013), see: https://cran.r-project.org/web/packages/LEGIT/vignettes/GxE_testing.html\r\n* For usage of elastic net with LEGIT models, see: https://cran.r-project.org/web/packages/LEGIT/vignettes/ElasticNet.html\r\n\r\nFor the rest, please refer to the reference manual: https://cran.r-project.org/web/packages/LEGIT/LEGIT.pdf\r\n\r\n## Important note: What if I only have one gene and environment?\r\n\r\nMany are interested in using the package only for GxE testing with a standard GxE model with only one gene and one environment (so non-LEGIT). To make it work with one gene and one environment, you can simply use the GxE_interaction_test function and set ``genes=data.frame(G=mydata$mygene)`` and ``env=data.frame(E=mydata$myenvironment)``. Same goes for the LEGIT function.\r\n\r\nThe benefits of using this package for GxE testing is that it has more functionalities and output information than other SAS/SPSS software. \r\nFurthermore:\r\n1. It also tests for vantage sensitivity, while most software doesn't.\r\n2. It allows plotting the GxE easily with the [plot function](https://www.rdocumentation.org/packages/LEGIT/versions/1.3.1/topics/plot.LEGIT).\r\n3. It allows testing for rGE (gene-by-environment correlation) with the [rGE function](https://www.rdocumentation.org/packages/LEGIT/versions/1.3.1/topics/rGE.LEGIT).\r\n\r\n\r\n## How to install\r\n\r\nTo install the latest stable version, run in R :\r\n\r\n* install.packages(\"LEGIT\")\r\n\r\nTo install the latest GitHub development version which could contain new or experimental features, run in R :\r\n\r\n* install.packages(\"devtools\")\r\n* devtools::install_github(\"AlexiaJM/LEGIT\")\r\n\r\nRegarding the GitHub installation. When it ask \"Enter one or more numbers, or an empty line to skip updates:\", just write nothing and press enter. Otherwise, you risk getting a \"Cannot remove prior package X\" error.\r\n\r\n## Examples\r\n\r\nHere is an example with 2 latent variables and a 2-way interaction (see https://arxiv.org/abs/1703.08111) :\r\n![](https://raw.githubusercontent.com/AlexiaJM/LEGIT/master/images/LEGIT_2way.png)\r\n\r\nHere is an example with 3 latent variables and a 3-way interaction (see https://arxiv.org/abs/1703.08111) :\r\n![](https://raw.githubusercontent.com/AlexiaJM/LEGIT/master/images/LEGIT_3way.png)\r\n\r\n## References\r\n\r\n* https://arxiv.org/abs/1703.08111\r\n* https://psyarxiv.com/27uw8\r\n* https://ajolicoeur.wordpress.com/legit/\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexiajm%2Flegit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexiajm%2Flegit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexiajm%2Flegit/lists"}