Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
graemeblair committed Jul 28, 2023
1 parent 6c0bc21 commit 29c265d
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 33 deletions.
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,12 @@ about their properties (see [DeclareDesign](https://declaredesign.org)).
## Installing estimatr

To install the latest stable release of **estimatr**, please ensure that
you are running version 3.4 or later of R and run the following code:
you are running version 3.5 or later of R and run the following code:

``` r
install.packages("estimatr")
```

If you would like to use the latest development release of **estimatr**,
please ensure that you are running version 3.4 or later of R and run the
following code:

``` r
install.packages("estimatr", dependencies = TRUE,
repos = c("http://r.declaredesign.org", "https://cloud.r-project.org"))
```

## Easy to use

Once the package is installed, getting appropriate estimates and
Expand Down Expand Up @@ -130,12 +121,15 @@ mb <- microbenchmark(
coeftest(lo, vcov = vcovHC(lo, type = 'HC2'))
}
)
#> Warning in microbenchmark(estimatr = lm_robust(y ~ ., data = dat), `lm +
#> sandwich` = {: less accurate nanosecond times to avoid potential integer
#> overflows
```

| estimatr | median run-time (ms) |
|:--------------|---------------------:|
| estimatr | 21 |
| lm + sandwich | 41 |
| estimatr | 7.2 |
| lm + sandwich | 24.6 |

------------------------------------------------------------------------

Expand Down
27 changes: 17 additions & 10 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
url: https://declaredesign.org/r/estimatr

template:
package: ddpkgdowntemplate
bootstrap: 5
bslib:
primary: "#0054AD"
border-radius: 0.5rem
btn-border-radius: 0.25rem

url: https://declaredesign.org/r/estimatr
development:
mode: auto

navbar:
left:
right:
- text: "Software"
menu:
- text: DeclareDesign
href: http://declaredesign.org/r/declaredesign/
href: https://declaredesign.org/r/DeclareDesign/
- text: randomizr
href: https://declaredesign.org/r/randomizr/
- text: fabricatr
href: https://declaredesign.org/r/fabricatr/
- text: estimatr
href: https://declaredesign.org/r/estimatr/
- text: DesignLibrary
href: https://declaredesign.org/r/designlibrary/
- text: "Help"
href: http://discuss.declaredesign.org
right:
- text: Get started
- text: declaredesign.org
href: https://declaredesign.org
left:
- text: Getting started
href: articles/getting-started.html
- text: Reference
href: reference/index.html
Expand All @@ -44,5 +53,3 @@ navbar:
href: articles/simulations-ols-variance.html
- text: How Stata's hat matrix differs with weights
href: articles/stata-wls-hat.html
- text: estimatr home
href: https://declaredesign.org/r/estimatr/
24 changes: 13 additions & 11 deletions vignettes/simulations-debiasing-dim.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ simp_blocks <- declare_model(
)
)
# Complete random assignment of half of units in each block
blocked_assign <- declare_assignment(Z = block_ra(blocks = blocks, prob = 0.5), legacy = FALSE)
blocked_assign <- declare_assignment(Z = block_ra(blocks = blocks, prob = 0.5))
# Estimand is the ATE
ate <- declare_inquiry(ATE = mean(Y_Z_1 - Y_Z_0))
outcomes <- declare_measurement(Y = reveal_outcomes(Y ~ Z))
Expand All @@ -65,7 +65,7 @@ Now let's define our two estimators, one that doesn't account for blocking and o

```{r}
dim <- declare_estimator(Y ~ Z, inquiry = "ATE", label = "DIM")
dim_bl <- declare_estimator(Y ~ Z, blocks = blocks, inquiry = "ATE", label = "DIM blocked")
dim_bl <- declare_estimator(Y ~ Z, .method = difference_in_means, blocks = blocks, inquiry = "ATE", label = "DIM blocked")
# Our design
simp_bl_des <- simp_blocks +
Expand Down Expand Up @@ -136,10 +136,11 @@ corr_blocks <- declare_model(
),
individual = add_level(
N = indivs_per_block,
epsilon = rnorm(N, sd = 3),
potential_outcomes(Y ~ Z * 0.5 * block_shock + epsilon)
epsilon = rnorm(N, sd = 3)
)
)
) +
declare_model(potential_outcomes(Y ~ Z * 0.5 * block_shock + epsilon))
# Use same potential outcomes as above, but now treatment probability varies across blocks
corr_blocked_assign <- declare_assignment(
Z = block_ra(
Expand All @@ -150,7 +151,8 @@ corr_blocked_assign <- declare_assignment(
),
legacy = FALSE
)
corr_bl_des <- corr_blocks +
corr_bl_des <-
corr_blocks +
corr_blocked_assign +
ate +
outcomes +
Expand Down Expand Up @@ -295,18 +297,18 @@ diff_size_cls <- declare_model(
),
individual = add_level(
N = indivs_per_clust,
epsilon = rnorm(N, sd = 3),
potential_outcomes(Y ~ Z * 0.4 * clust_shock + epsilon)
epsilon = rnorm(N, sd = 3)
)
)
clustered_assign <- declare_assignment(Z = cluster_ra(clusters = clusters, prob = 0.5), legacy = FALSE)
) +
declare_model(potential_outcomes(Y ~ Z * 0.4 * clust_shock + epsilon))
clustered_assign <- declare_assignment(Z = cluster_ra(clusters = clusters, prob = 0.5))
ht_cl <- declare_estimator(
formula = Y ~ Z,
clusters = clusters,
condition_prs = condition_pr,
simple = FALSE,
model = estimatr::horvitz_thompson,
.method = estimatr::horvitz_thompson,
inquiry = "ATE",
label = "Horvitz-Thompson Clustered"
)
Expand Down
Binary file modified vignettes/simulations-ols-var.rda
Binary file not shown.

0 comments on commit 29c265d

Please sign in to comment.