Skip to content

Commit 263b758

Browse files
acoppockclaude
andcommitted
Fix the README title, three help-page titles, and the reference index blurbs
README.md was titled 'randomizr: Tools for random assignment and random sampling': README.Rmd had the right title and had not been re-knit. It now also says how to install rdss and 'interference', and shows one helper in use. conjoint_measurement's title called it an assignment handler, copied from conjoint_assignment; it now says what it does. Typos fixed in tidy_stan (regresion, the the), foos_etal (from from), and lag_by_group (withing). The pkgdown section blurbs for Tidiers, Data, and Utilities were copied from DeclareDesign's site and described none of their contents; tidy_stan moves to Tidiers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 3929efb commit 263b758

11 files changed

Lines changed: 113 additions & 16 deletions

‎R/data.R‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#' @format A data.frame
2525
"bonilla_tillery"
2626

27-
#' Replication data for Foos, John, Muller, and Cunningham (2021), Journal of Politics (derived from from Dataverse 10.7910/DVN/NDPXND)
27+
#' Replication data for Foos, John, Muller, and Cunningham (2021), Journal of Politics (derived from Dataverse 10.7910/DVN/NDPXND)
2828
#'
2929
#' @format A data.frame
3030
"foos_etal"

‎R/helpers-bayesian-regression.R‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22

3-
#' Tidy results from a stanreg regresion and exponentiate the estimated coefficient
3+
#' Tidy results from a stanreg regression, optionally exponentiating the coefficients
44
#'
55
#' Note no standard errors or other summary statistics are provided
66
#'
@@ -9,7 +9,7 @@
99
#' @param x A stanreg fit from stan_glm
1010
#' @param conf.int Logical indicating whether or not to include a confidence interval in the tidied output. Defaults to FALSE.
1111
#' @param conf.level The confidence level to use for the confidence interval if conf.int = TRUE. Must be strictly greater than 0 and less than 1. Defaults to 0.95, which corresponds to a 95 percent confidence interval.
12-
#' @param exponentiate Logical indicating whether or not to exponentiate the the coefficient estimates. Defaults to FALSE. Note that standard errors are not included when \code{exponentiate = TRUE}.
12+
#' @param exponentiate Logical indicating whether or not to exponentiate the coefficient estimates. Defaults to FALSE. Note that standard errors are not included when \code{exponentiate = TRUE}.
1313
#' @param ... Other arguments to broom.mixed::tidy
1414
#'
1515
#' @return data.frame of results

‎R/helpers-conjoint-experiments.R‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ conjoint_assignment <-
8585
data
8686
}
8787

88-
#' Conjoint experiment assignment handler: conducts complete random assignment of all attribute levels
88+
#' Conjoint experiment measurement handler: records which profile in each task is chosen
89+
#'
90+
#' Applies `utility_fn` and, within each subject and task, compares the two profiles and sets `choice` to 1 for the one with the higher utility `U` (the second profile on a tie).
8991
#'
9092
#' See https://book.declaredesign.org/experimental-descriptive.html#conjoint-experiments
9193
#'

‎R/helpers-difference-in-differences.R‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#' @param x Vector of values
66
#' @param groups Grouping variable
77
#' @param n Positive integer of length 1, giving the number of positions to lead or lag by
8-
#' @param order_by Ordering variable withing group (e.g., time)
8+
#' @param order_by Ordering variable within group (e.g., time)
99
#' @param default Value used for non-existent rows. Defaults to NA.
1010
#'
1111
#' @return vector of lagged values

‎README.Rmd‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,42 @@ title: "rdss: Helper functions for Research Design in the Social Sciences book"
99
[![Codecov test coverage](https://codecov.io/gh/DeclareDesign/rdss/graph/badge.svg)](https://app.codecov.io/gh/DeclareDesign/rdss)
1010

1111
Helper functions for using the book [*Research Design in the Social Sciences: Declaration, Diagnosis, Redesign*](https://book.declaredesign.org/) by Blair, Coppock, and Humphreys 2023 (Princeton University Press).
12+
13+
## Installation
14+
15+
Install the released version from CRAN:
16+
17+
```{r, eval = FALSE}
18+
install.packages("rdss")
19+
```
20+
21+
or the development version from GitHub:
22+
23+
```{r, eval = FALSE}
24+
remotes::install_github("DeclareDesign/rdss")
25+
```
26+
27+
`estimator_AS_tidy()`, used in the book's section on experiments over networks, also needs the 'interference' package, which is not on CRAN:
28+
29+
```{r, eval = FALSE}
30+
remotes::install_github("szonszein/interference")
31+
```
32+
33+
## Example
34+
35+
Each helper fills one step of a declaration in the book, and its help page links to the section that uses it. `lag_by_group()`, for instance, builds the lagged treatment indicator in the difference-in-differences design:
36+
37+
```{r, message = FALSE}
38+
library(rdss)
39+
library(dplyr)
40+
41+
panel <-
42+
tibble(
43+
unit = rep(c("a", "b"), each = 3),
44+
period = rep(1:3, times = 2),
45+
D = c(0, 1, 1, 0, 0, 1)
46+
) |>
47+
mutate(D_lag = lag_by_group(D, groups = unit, n = 1, order_by = period))
48+
49+
panel
50+
```

‎README.md‎

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
randomizr: Tools for random assignment and random sampling
1+
rdss: Helper functions for Research Design in the Social Sciences book
22
================
33

44
[![CRAN
@@ -14,3 +14,56 @@ Helper functions for using the book [*Research Design in the Social
1414
Sciences: Declaration, Diagnosis,
1515
Redesign*](https://book.declaredesign.org/) by Blair, Coppock, and
1616
Humphreys 2023 (Princeton University Press).
17+
18+
## Installation
19+
20+
Install the released version from CRAN:
21+
22+
``` r
23+
install.packages("rdss")
24+
```
25+
26+
or the development version from GitHub:
27+
28+
``` r
29+
remotes::install_github("DeclareDesign/rdss")
30+
```
31+
32+
`estimator_AS_tidy()`, used in the book’s section on experiments over
33+
networks, also needs the ‘interference’ package, which is not on CRAN:
34+
35+
``` r
36+
remotes::install_github("szonszein/interference")
37+
```
38+
39+
## Example
40+
41+
Each helper fills one step of a declaration in the book, and its help
42+
page links to the section that uses it. `lag_by_group()`, for instance,
43+
builds the lagged treatment indicator in the difference-in-differences
44+
design:
45+
46+
``` r
47+
library(rdss)
48+
library(dplyr)
49+
50+
panel <-
51+
tibble(
52+
unit = rep(c("a", "b"), each = 3),
53+
period = rep(1:3, times = 2),
54+
D = c(0, 1, 1, 0, 0, 1)
55+
) |>
56+
mutate(D_lag = lag_by_group(D, groups = unit, n = 1, order_by = period))
57+
58+
panel
59+
```
60+
61+
## # A tibble: 6 × 4
62+
## unit period D D_lag
63+
## <chr> <int> <dbl> <dbl>
64+
## 1 a 1 0 NA
65+
## 2 a 2 1 0
66+
## 3 a 3 1 1
67+
## 4 b 1 0 NA
68+
## 5 b 2 0 0
69+
## 6 b 3 1 0

‎_pkgdown.yml‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ reference:
4444
- get_rdss_file
4545

4646
- title: Tidy helpers
47-
description: These functions declare research design steps
47+
description: Wrap estimators from other packages for use in design steps such as `declare_estimator()`
4848
contents:
4949
- causal_forest_handler
5050
- rma_helper
@@ -65,13 +65,14 @@ reference:
6565
- lag_by_group
6666

6767
- title: Tidiers
68-
description: These functions declare research design steps
68+
description: Return model fits from other packages as tidy data frames
6969
contents:
7070
- tidy.amce
7171
- tidy.rdrobust
72+
- tidy_stan
7273

7374
- title: Data
74-
description: These functions operate on declared designs
75+
description: Datasets used in the book's examples and exercises
7576
contents:
7677
- bonilla_tillery
7778
- clingingsmith_etal
@@ -81,7 +82,7 @@ reference:
8182
- lapop_brazil
8283

8384
- title: Utilities
84-
description: These functions operate on declared designs
85+
description: Format numbers for tables, and the book's ggplot theme and palette
8586
contents:
8687
- add_parens
8788
- format_num
@@ -90,4 +91,3 @@ reference:
9091
- theme_dd
9192
- dd_palette
9293
- hex_add_alpha
93-
- tidy_stan

‎man/conjoint_measurement.Rd‎

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎man/foos_etal.Rd‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎man/lag_by_group.Rd‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)