{"id":15047411,"url":"https://github.com/pachadotdev/capybara","last_synced_at":"2026-03-04T20:05:31.212Z","repository":{"id":217898175,"uuid":"740231832","full_name":"pachadotdev/capybara","owner":"pachadotdev","description":"tldr; If you have a 2-4GB dataset and you need to estimate a (generalized) linear model with a large number of fixed effects, this package is for you.","archived":false,"fork":false,"pushed_at":"2026-02-24T01:46:30.000Z","size":4597,"stargazers_count":22,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-24T03:13:34.873Z","etag":null,"topics":["cpp11","econometrics","linear-models","rstats"],"latest_commit_sha":null,"homepage":"http://pacha.dev/capybara/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pachadotdev.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":"codemeta.json","zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-01-07T22:25:44.000Z","updated_at":"2026-02-24T01:46:30.000Z","dependencies_parsed_at":"2024-04-09T15:44:33.170Z","dependency_job_id":"90d38fcf-4d24-4099-97fb-576370cd260d","html_url":"https://github.com/pachadotdev/capybara","commit_stats":{"total_commits":52,"total_committers":1,"mean_commits":52.0,"dds":0.0,"last_synced_commit":"293a2652e35d46b2529f0e5906023a1f3f68195d"},"previous_names":["pachadotdev/capybara"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pachadotdev/capybara","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pachadotdev%2Fcapybara","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pachadotdev%2Fcapybara/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pachadotdev%2Fcapybara/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pachadotdev%2Fcapybara/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pachadotdev","download_url":"https://codeload.github.com/pachadotdev/capybara/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pachadotdev%2Fcapybara/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30091608,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T19:41:02.502Z","status":"ssl_error","status_checked_at":"2026-03-04T19:40:05.550Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cpp11","econometrics","linear-models","rstats"],"created_at":"2024-09-24T20:57:58.323Z","updated_at":"2026-03-04T20:05:31.200Z","avatar_url":"https://github.com/pachadotdev.png","language":"R","readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# capybara \u003cimg src=\"man/figures/logo.svg\" align=\"right\" height=\"139\" alt=\"\" /\u003e\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/pachadotdev/capybara/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/pachadotdev/capybara/actions/workflows/R-CMD-check.yaml)\n[![codecov](https://app.codecov.io/gh/pachadotdev/capybara/graph/badge.svg?token=kDP0pWmfRk)](https://app.codecov.io/gh/pachadotdev/capybara)\n[![BuyMeACoffee](https://raw.githubusercontent.com/pachadotdev/buymeacoffee-badges/main/bmc-donate-yellow.svg)](https://buymeacoffee.com/pacha)\n[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)\n[![CRAN status](https://www.r-pkg.org/badges/version/capybara)](https://CRAN.R-project.org/package=capybara)\n\u003c!-- badges: end --\u003e\n\n## About\n\nPlease read my article for the full details about capybara 1.x.y (Open Access):\n\n\u003e Vargas Sepulveda, Mauricio. 2025. 'Capybara: Efficient Estimation of Generalized Linear Models with High-Dimensional Fixed Effects'. *PLOS ONE* 20 (9): e0331178. https://doi.org/10.1371/journal.pone.0331178.\n\nI am preparing the manuscript for capybara 2.x.y that is about speed and memory improvements.\n\nIf you have a 2-4GB dataset and you need to estimate a (generalized)\nlinear model with a large number of fixed effects, this package is for you. It\nworks with larger datasets as well and facilites computing clustered standard\nerrors.\n\n'capybara' is a fast and small footprint software that provides efficient\nfunctions for demeaning variables before conducting a GLM estimation. This\ntechnique is particularly useful when estimating linear models with multiple\ngroup fixed effects. It is a fork of the excellent Alpaca package created and\nmaintained by [Dr. Amrei Stammann](https://github.com/amrei-stammann). The\nsoftware can estimate Exponential Family models (e.g., Poisson) and Negative\nBinomial models.\n\nTraditional QR estimation on the full design matrix can be unfeasible due to\nadditional memory requirements. The method, which is based on Halperin (1962)\nvector projections offers important time and memory savings without compromising\nnumerical stability in the estimation process.\n\nThe software heavily borrows from Gaure (2013), Stammann (2018) and Berge (2018)\nworks on OLS and GLM estimation with large fixed effects implemented in the 'lfe',\n'alpaca' and 'fixest' packages. The differences are that 'capybara' does not use C\nnor Rcpp code, instead it uses cpp4r and\n[armadillo4r](https://github.com/pachadotdev/armadillo4r).\n\nThe summary tables borrow from Stata outputs. I have also provided integrations\nwith 'broom' to facilitate the inclusion of statistical tables in Quarto/Jupyter\nnotebooks.\n\nIf this software is useful to you, please consider donating on\n[Buy Me A Coffee](https://buymeacoffee.com/pacha). All donations will\nbe used to continue improving `capybara`.\n\n## Installation\n\nYou can install the development version of capybara like so:\n\n```r\ninstall.packages(\"capybara\", repos = \"https://cloud.r-project.org/\")\n```\n\nYou can install the development version of capybara like so:\n\n```r\nremotes::install_github(\"pachadotdev/capybara\")\n```\n\n## Examples\n\nSee the documentation: https://pacha.dev/capybara/.\n\nHere is simple example of estimating a linear model and a Poisson model with fixed effects:\n\n```r\nm1 \u003c- felm(mpg ~ wt | cyl, mtcars)\nm2 \u003c- fepoisson(mpg ~ wt | cyl, mtcars)\nsummary_table(m1, m2, model_names = c(\"Linear\", \"Poisson\"))\n\n|     Variable     |       Linear        |      Poisson      |\n|------------------|---------------------|-------------------|\n| wt               |           -3.206*** |           -0.180* |\n|                  |             (0.295) |           (0.072) |\n|                  |                     |                   |\n| Fixed effects    |                     |                   |\n| cyl              |                 Yes |               Yes |\n|                  |                     |                   |\n| N                |                  32 |                32 |\n| R-squared        |               0.837 |             0.616 |\n\nStandard errors in parenthesis\nSignificance levels: *** p \u003c 0.001; ** p \u003c 0.01; * p \u003c 0.05; . p \u003c 0.1\n```\n\n## Installing with compiler optimizations\n\nCRAN packages are built with the `-O2` compiler flag, which is\nsufficient for most packages, including capybara. However, if you want to use\nthe maximum compiler optimizations, you can do so by setting the `-O3`\ncompiler flag.\n\nTo do that, create a user Makevars file in your home directory\n(`~/.R/Makevars`) and add the following lines:\n\n```makefile\n# Copy to ~/.R/Makevars if you want to override R's default optimization\nCXXFLAGS = -O3\nCXX11FLAGS = -O3\nCXX14FLAGS = -O3\nCXX17FLAGS = -O3\nCXX20FLAGS = -O3\n```\n\nAdditional optimizations can be enabled by setting the `CAPYBARA_OPTIMIZATIONS`\nenvironment variable to \"yes\" and choosing the number of cores to use for parallel\nprocessing (the default is to use 50% of the available cores). You can do this in your\nR session like so:\n\n```r\n# Install local version\n\nSys.setenv(CAPYBARA_OPTIMIZATIONS = \"yes\")\nSys.setenv(CAPYBARA_CORES = 4) # Set the number of cores to use (optional)\n\ninstall.packages(\".\", repos = NULL, type = \"source\")\n# or\ndevtools::install()\n```\n\nThis will determine if your hardware allows hardware-specific compiler flags\nthat provide significant performance improvements (sometimes 2-4x faster than\njust using portable flags).\n\n## Code of Conduct\n\nPlease note that the capybara project is released with a\n[Contributor Code of Conduct](https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html).\nBy contributing to this project, you agree to abide by its terms.\n\n## Acknowledgements\n\nThanks a lot to [Prof. Yoto Yotov](https://yotoyotov.com/) for reviewing the summary functions.\n","funding_links":["https://buymeacoffee.com/pacha"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpachadotdev%2Fcapybara","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpachadotdev%2Fcapybara","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpachadotdev%2Fcapybara/lists"}