{"id":13665919,"url":"https://github.com/DeclareDesign/estimatr","last_synced_at":"2025-04-26T09:31:52.172Z","repository":{"id":40346106,"uuid":"86030420","full_name":"DeclareDesign/estimatr","owner":"DeclareDesign","description":"estimatr: Fast Estimators for Design-Based Inference","archived":false,"fork":false,"pushed_at":"2025-02-28T18:37:17.000Z","size":12779,"stargazers_count":133,"open_issues_count":71,"forks_count":20,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-02-28T21:51:00.113Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://declaredesign.org/r/estimatr","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/DeclareDesign.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":"2017-03-24T05:25:49.000Z","updated_at":"2025-02-23T02:06:08.000Z","dependencies_parsed_at":"2022-08-10T02:00:04.827Z","dependency_job_id":"56b7dc85-20b1-4ac9-8163-24c7a52cb60b","html_url":"https://github.com/DeclareDesign/estimatr","commit_stats":{"total_commits":985,"total_committers":18,"mean_commits":54.72222222222222,"dds":0.3918781725888325,"last_synced_commit":"d6859c8101371ce342113a3da00ab5d1c4884157"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeclareDesign%2Festimatr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeclareDesign%2Festimatr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeclareDesign%2Festimatr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeclareDesign%2Festimatr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DeclareDesign","download_url":"https://codeload.github.com/DeclareDesign/estimatr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250967068,"owners_count":21515526,"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":[],"created_at":"2024-08-02T06:00:53.796Z","updated_at":"2025-04-26T09:31:52.152Z","avatar_url":"https://github.com/DeclareDesign.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\ntitle: \"estimatr: Fast Estimators for Design-Based Inference\"\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE}\nset.seed(42)\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  message = FALSE,\n  comment = \"#\u003e\",\n  fig.path = \"README-\"  \n)\noptions(digits = 2)\n```\n\n[![CRAN status](https://www.r-pkg.org/badges/version/estimatr)](https://cran.r-project.org/package=estimatr)\n[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/grand-total/estimatr?color=green)](https://r-pkg.org/pkg/estimatr)\n[![Build status](https://github.com/DeclareDesign/estimatr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/DeclareDesign/estimatr/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/DeclareDesign/estimatr/graph/badge.svg)](https://app.codecov.io/gh/DeclareDesign/estimatr)\n[![Replications](https://softwarecite.com/badge/estimatr)](https://softwarecite.com/package/estimatr)\n\n**estimatr** is an `R` package providing a range of commonly-used linear estimators, designed for speed and for ease-of-use. Users can easily recover robust, cluster-robust, and other design appropriate estimates. We include two functions that implement means estimators, `difference_in_means()` and `horvitz_thompson()`, and three linear regression estimators, `lm_robust()`, `lm_lin()`, and `iv_robust()`. In each case, users can choose an estimator to reflect cluster-randomized, block-randomized, and block-and-cluster-randomized designs. The [Getting Started Guide](https://declaredesign.org/r/estimatr/articles/getting-started.html) describes each estimator provided by **estimatr** and how it can be used in your analysis.\n\nYou can also see the multiple ways you can [get regression tables out of estimatr](https://declaredesign.org/r/estimatr/articles/regression-tables.html) using commonly used `R` packages such as `texreg` and `stargazer`. Fast estimators also enable fast simulation of research designs to learn about their properties (see [DeclareDesign](https://declaredesign.org)).\n\n## Installing estimatr\n\nTo install the latest stable release of **estimatr**, please ensure that you are running version 3.5 or later of R and run the following code:\n\n```{r, eval=F}\ninstall.packages(\"estimatr\")\n```\n\n## Easy to use\n\nOnce the package is installed, getting appropriate estimates and standard errors is now both fast and easy.\n\n```{r, eval = TRUE, echo=-1}\nset.seed(42)\nlibrary(estimatr)\n\n# sample data from cluster-randomized experiment\nlibrary(fabricatr)\nlibrary(randomizr)\ndat \u003c- fabricate(\n  N = 100,\n  y = rnorm(N),\n  clusterID = sample(letters[1:10], size = N, replace = TRUE),\n  z = cluster_ra(clusterID)\n)\n\n# robust standard errors\nres_rob \u003c- lm_robust(y ~ z, data = dat)\n# tidy dataframes on command!\ntidy(res_rob)\n\n# cluster robust standard errors\nres_cl \u003c- lm_robust(y ~ z, data = dat, clusters = clusterID)\n# standard summary view also available\nsummary(res_cl)\n\n# matched-pair design learned from blocks argument\ndata(sleep)\nres_dim \u003c- difference_in_means(extra ~ group, data = sleep, blocks = ID)\n```\n\nThe [Getting Started Guide](/r/estimatr/articles/getting-started.html) has more examples and uses, as do the reference pages. The [Mathematical Notes](/r/estimatr/articles/mathematical-notes.html) provide more information about what each estimator is doing under the hood.\n\n## Fast to use\n\nGetting estimates and robust standard errors is also faster than it used to be. Compare our package to using `lm()` and the `sandwich` package to get HC2 standard errors. More speed comparisons are available [here](https://declaredesign.org/r/estimatr/articles/benchmarking-estimatr.html). Furthermore, with many blocks (or fixed effects), users can use the `fixed_effects` argument of `lm_robust` with HC1 standard errors to greatly improve estimation speed. More on [fixed effects here](https://declaredesign.org/r/estimatr/articles/absorbing-fixed-effects.html).\n\n```{r, echo=-1}\nset.seed(1)\ndat \u003c- data.frame(X = matrix(rnorm(2000*50), 2000), y = rnorm(2000))\n\nlibrary(microbenchmark)\nlibrary(lmtest)\nlibrary(sandwich)\nmb \u003c- microbenchmark(\n  `estimatr` = lm_robust(y ~ ., data = dat),\n  `lm + sandwich` = {\n    lo \u003c- lm(y ~ ., data = dat)\n    coeftest(lo, vcov = vcovHC(lo, type = 'HC2'))\n  }\n)\n```\n```{r, echo = FALSE}\nd \u003c- summary(mb)[, c(\"expr\", \"median\")]\nnames(d) \u003c- c(\"estimatr\", \"median run-time (ms)\")\nknitr::kable(d)\n```\n\n---\n\nThis project is generously supported by a grant from the [Laura and John Arnold Foundation](http://www.arnoldfoundation.org) and seed funding from [Evidence in Governance and Politics (EGAP)](http://egap.org).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDeclareDesign%2Festimatr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDeclareDesign%2Festimatr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDeclareDesign%2Festimatr/lists"}