Skip to content

Commit 4ef3d7f

Browse files
committed
Initial commit
1 parent 5bce27e commit 4ef3d7f

12 files changed

+27
-27
lines changed

AgePeriodCohort/births_tv.Rmd

+8-8
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,14 @@ v %>%
111111
A helper function to set the mortality rates for all years to that of a given year.
112112

113113
```{r}
114-
set_rates <- function(.data, rate_year) {
115-
.data %>%
114+
set_rates <- function(data, rate_year) {
115+
data %>%
116116
left_join(
117-
.data %>%
117+
data %>%
118118
filter(year == rate_year) %>%
119119
mutate(rate = deaths / population * 1e5) %>%
120120
select(!c(year, deaths, population)),
121-
by = names(.data) %>% setdiff(c("year", "deaths", "population"))
121+
by = names(data) %>% setdiff(c("year", "deaths", "population"))
122122
)
123123
}
124124
```
@@ -160,13 +160,13 @@ From 1999 to 2013, the unadjusted mortality rate increased from 382 to 415 death
160160
A helper function to add the weights for age adjustment.
161161

162162
```{r}
163-
add_weight <- function(.data, weight_year) {
164-
.data %>%
163+
add_weight <- function(data, weight_year) {
164+
data %>%
165165
left_join(
166-
.data %>%
166+
data %>%
167167
filter(year == weight_year) %>%
168168
select(!c(year, deaths), weight = population),
169-
by = names(.data) %>% setdiff(c("year", "deaths", "population"))
169+
by = names(data) %>% setdiff(c("year", "deaths", "population"))
170170
)
171171
}
172172
```

AgePeriodCohort/births_tv.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Regression and Other Stories: AgePeriodCohort
22
================
33
Andrew Gelman, Jennifer Hill, Aki Vehtari
4-
2021-04-20
4+
2021-06-23
55

66
- [2 Data and measurement](#2-data-and-measurement)
77
- [2.4 Data and adjustment: trends in mortality
@@ -136,14 +136,14 @@ A helper function to set the mortality rates for all years to that of a
136136
given year.
137137

138138
``` r
139-
set_rates <- function(.data, rate_year) {
140-
.data %>%
139+
set_rates <- function(data, rate_year) {
140+
data %>%
141141
left_join(
142-
.data %>%
142+
data %>%
143143
filter(year == rate_year) %>%
144144
mutate(rate = deaths / population * 1e5) %>%
145145
select(!c(year, deaths, population)),
146-
by = names(.data) %>% setdiff(c("year", "deaths", "population"))
146+
by = names(data) %>% setdiff(c("year", "deaths", "population"))
147147
)
148148
}
149149
```
@@ -193,13 +193,13 @@ substantial role in the increase of the unadjusted mortality.
193193
A helper function to add the weights for age adjustment.
194194

195195
``` r
196-
add_weight <- function(.data, weight_year) {
197-
.data %>%
196+
add_weight <- function(data, weight_year) {
197+
data %>%
198198
left_join(
199-
.data %>%
199+
data %>%
200200
filter(year == weight_year) %>%
201201
select(!c(year, deaths), weight = population),
202-
by = names(.data) %>% setdiff(c("year", "deaths", "population"))
202+
by = names(data) %>% setdiff(c("year", "deaths", "population"))
203203
)
204204
}
205205
```

Arsenic/arsenic_logistic_residuals_tv.Rmd

+2-2
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ binned_means <- function(x, y, n_bins = 40) {
134134
Plot binned residuals.
135135

136136
```{r}
137-
plot_binned_residuals <- function(.data) {
138-
.data %>%
137+
plot_binned_residuals <- function(data) {
138+
data %>%
139139
ggplot(aes(x_mean)) +
140140
geom_hline(yintercept = 0, color = "white", size = 2) +
141141
geom_line(aes(y = 2 * y_se), color = "grey60") +

Arsenic/arsenic_logistic_residuals_tv.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Regression and Other Stories: Arsenic model residuals
22
================
33
Andrew Gelman, Jennifer Hill, Aki Vehtari
4-
2021-04-20
4+
2021-06-23
55

66
- [14 Working with logistic
77
regression](#14-working-with-logistic-regression)
@@ -193,8 +193,8 @@ binned_means <- function(x, y, n_bins = 40) {
193193
Plot binned residuals.
194194

195195
``` r
196-
plot_binned_residuals <- function(.data) {
197-
.data %>%
196+
plot_binned_residuals <- function(data) {
197+
data %>%
198198
ggplot(aes(x_mean)) +
199199
geom_hline(yintercept = 0, color = "white", size = 2) +
200200
geom_line(aes(y = 2 * y_se), color = "grey60") +
Loading
Loading
Loading
Loading
Loading
Loading

Student/student_tv.Rmd

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ plot_coef <- function(fit, prob_outer = 1, xlim = NULL) {
4949
theme(text = element_text(family = "sans"))
5050
}
5151
# Plot implied prior and Bayesian R^2 distributions
52-
plot_r2 <- function(.data) {
53-
.data %>%
52+
plot_r2 <- function(data) {
53+
data %>%
5454
pivot_longer(cols = everything()) %>%
5555
ggplot(aes(value)) +
5656
geom_histogram(binwidth = 0.01, boundary = 0) +

Student/student_tv.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Regression and Other Stories: Student
22
================
33
Andrew Gelman, Jennifer Hill, Aki Vehtari
4-
2021-04-20
4+
2021-06-23
55

66
- [12 Transformations and
77
regression](#12-transformations-and-regression)
@@ -51,8 +51,8 @@ plot_coef <- function(fit, prob_outer = 1, xlim = NULL) {
5151
theme(text = element_text(family = "sans"))
5252
}
5353
# Plot implied prior and Bayesian R^2 distributions
54-
plot_r2 <- function(.data) {
55-
.data %>%
54+
plot_r2 <- function(data) {
55+
data %>%
5656
pivot_longer(cols = everything()) %>%
5757
ggplot(aes(value)) +
5858
geom_histogram(binwidth = 0.01, boundary = 0) +

0 commit comments

Comments
 (0)