{"id":13401126,"url":"https://github.com/mkearney/tidyversity","last_synced_at":"2025-04-12T10:51:06.831Z","repository":{"id":124079941,"uuid":"131202635","full_name":"mkearney/tidyversity","owner":"mkearney","description":"🎓 Tidy tools for academics","archived":false,"fork":false,"pushed_at":"2018-08-02T21:02:20.000Z","size":492,"stargazers_count":171,"open_issues_count":3,"forks_count":16,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-07-31T19:28:52.815Z","etag":null,"topics":["academic","analysis","general-linear-model","latent-variables","linear-models","logistic-regression","mkearney-r-package","negative-binomial-regression","poisson-regression","r","regression","research","robust-regression","rstats","science","statistics","structural-equation-modeling","tidy","tidyverse","tidyversity"],"latest_commit_sha":null,"homepage":"https://github.com/mkearney/tidyversity","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/mkearney.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"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}},"created_at":"2018-04-26T19:40:57.000Z","updated_at":"2024-05-26T17:41:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"41fb563c-f063-4da9-9b78-2798614d404d","html_url":"https://github.com/mkearney/tidyversity","commit_stats":{"total_commits":63,"total_committers":2,"mean_commits":31.5,"dds":"0.031746031746031744","last_synced_commit":"06a31df36f4b647f31848bd941e86e201b0c2f55"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkearney%2Ftidyversity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkearney%2Ftidyversity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkearney%2Ftidyversity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkearney%2Ftidyversity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkearney","download_url":"https://codeload.github.com/mkearney/tidyversity/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248557844,"owners_count":21124165,"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":["academic","analysis","general-linear-model","latent-variables","linear-models","logistic-regression","mkearney-r-package","negative-binomial-regression","poisson-regression","r","regression","research","robust-regression","rstats","science","statistics","structural-equation-modeling","tidy","tidyverse","tidyversity"],"created_at":"2024-07-30T19:00:58.996Z","updated_at":"2025-04-12T10:51:06.803Z","avatar_url":"https://github.com/mkearney.png","language":"R","funding_links":[],"categories":["R"],"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 setup, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\",\n  eval = TRUE\n)\noptions(width = 100)\n```\n# tidyversity \u003cimg src=\"man/figures/logo.png\" width=\"160px\" align=\"right\" /\u003e \n\n[![lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)\n\n🎓 Tidy tools for academics\n\n\n## \\*\\*\\* This package is in very early development. Feedback is encouraged!!! \\*\\*\\*\n\n## Installation\n\n\u003c!-- You can install the released version of tidyversity from [CRAN](https://CRAN.R-project.org) with:\n\n``` r\ninstall.packages(\"tidyversity\")\n```\n--\u003e\n\nInstall the development version from [Github](https://github.com/mkearney/tidyversity) with:\n\n```{r install, eval=FALSE}\n## install devtools if not already\nif (!requireNamespace(\"devtools\", quietly = TRUE)) {\n  install.packages(\"devtools\")\n}\n## install tidyversity from Github\ndevtools::install_github(\"mkearney/tidyversity\")\n```\n\nLoad the package (it, of course, plays nicely with tidyverse).\n\n```{r library}\n## load tidyverse\nlibrary(tidyverse)\n\n## load tidyversity\nlibrary(tidyversity)\n```\n\n## Regression models\n\n### Ordinary Least Squares (OLS)\n\nConduct an Ordinary Least Squares (OLS) regression analysis.\n\n```{r ols}\npolcom %\u003e%\n  tidy_regression(follow_trump ~ news_1 + ambiv_sexism_1) %\u003e%\n  tidy_summary()\n```\n\n### Logistic (dichotomous)\n\nConduct a logistic regression analysis for binary (dichotomous) outcomes.\n\n```{r logistic}\npolcom %\u003e%\n  tidy_regression(follow_trump ~ news_1 + ambiv_sexism_1, type = \"logistic\") %\u003e%\n  tidy_summary()\n```\n\n### Poisson (count)\n\nConduct a poisson regression analysis for count data.\n\n```{r poisson}\npolcom %\u003e%\n  mutate(polarize = abs(therm_1 - therm_2)) %\u003e%\n  tidy_regression(polarize ~ news_1 + ambiv_sexism_1, type = \"poisson\") %\u003e%\n  tidy_summary()\n```\n\n### Negative binomial (overdispersed)\n\nConduct a negative binomial regression analysis for overdispersed count data.\n\n```{r, negbinom}\npolcom %\u003e%\n  mutate(polarize = abs(therm_1 - therm_2)) %\u003e%\n  tidy_regression(polarize ~ news_1 + ambiv_sexism_1, type = \"negbinom\") %\u003e%\n  tidy_summary()\n```\n\n### Robust and quasi- models\n\n```{r, robust_glm}\npolcom %\u003e%\n  mutate(polarize = abs(therm_1 - therm_2)) %\u003e%\n  tidy_regression(polarize ~ news_1 + ambiv_sexism_1, \n    type = \"quasipoisson\", robust = TRUE) %\u003e%\n  tidy_summary()\n```\n\n## Mean comparison models\n\n### ANOVA\n\nConduct an analysis of variance (ANOVA).\n\n```{r anova}\npolcom %\u003e%\n  mutate(sex = ifelse(sex == 1, \"Male\", \"Female\"),\n  vote_choice = case_when(\n    vote_2016_choice == 1 ~ \"Clinton\",\n    vote_2016_choice == 2 ~ \"Trump\",\n    TRUE ~ \"Other\")) %\u003e%\n  tidy_anova(pp_party ~ sex * vote_choice) %\u003e%\n  tidy_summary()\n```\n\n### t-tests\n\n```{r ttest}\npolcom %\u003e%\n  tidy_ttest(pp_ideology ~ follow_trump) %\u003e%\n  tidy_summary()\n```\n\n## Latent variable models\n\n### Structural equation modeling (SEM)\n\nConduct latent variable analysis using structural equation modeling.\n\n```{r sem}\n## mutate data and then specify and estimate model\nsem1 \u003c- polcom %\u003e%\n  mutate(therm_2 = therm_2 / 10, \n    therm_1 = 10 - therm_1 / 10) %\u003e%\n  tidy_sem_model(news =~ news_1 + news_2 + news_3 + news_4 + news_5 + news_6,\n    ambiv_sexism =~ ambiv_sexism_1 + ambiv_sexism_2 + ambiv_sexism_3 + \n      ambiv_sexism_4 + ambiv_sexism_5 + ambiv_sexism_6,\n    partisan =~ a*therm_1 + a*therm_2,\n    ambiv_sexism ~ age + sex + hhinc + edu + news + partisan) %\u003e%\n  tidy_sem()\n\n## print model summary\nsem1 %\u003e%\n  tidy_summary()\n```\n\n### Multilevel modeling (MLM)\n\nEstimate multilevel (mixed effects) models.\n\n```{r mlm}\nlme4::sleepstudy %\u003e%\n  tidy_mlm(Reaction ~ Days + (Days | Subject)) %\u003e%\n  summary()\n```\n\n# Data sets\n\nComes with one data set. \n\n### `polcom` \n\nConsists of survey responses to demographic, background, and likert-type attitudinal items about political communication.\n\n```{r polcom}\nprint(tibble::as_tibble(polcom), n = 5)\n```\n\n## Descriptive statistics\n\nReturn summary statistics in the form of a data frame ***(not yet added)***.\n\n```{r summarize, eval=FALSE}\n## summary stats for social media use (numeric) variables\nsummarize_numeric(polcom_survey, smuse1:smuse3)\n\n## summary stats for respondent sex and race (categorical) variables\nsummarize_categorical(polcom_survey, sex, race)\n```\n\nEstimate Cronbach's alpha for a set of variables.\n\n```{r reliability}\n## reliability of social media use items\ncronbachs_alpha(polcom, ambiv_sexism_1:ambiv_sexism_6)\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkearney%2Ftidyversity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkearney%2Ftidyversity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkearney%2Ftidyversity/lists"}