Skip to content

Commit f32c375

Browse files
committed
Update slides
1 parent 0815bd5 commit f32c375

File tree

2 files changed

+66
-33
lines changed

2 files changed

+66
-33
lines changed
File renamed without changes.

slides-00-getting-started.qmd

Lines changed: 66 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ title-slide-attributes:
77

88
---
99

10-
# Welcome {background-color='{{< brand color secondary >}}'}
10+
# Warm Up {background-color='{{< brand color secondary >}}'}
1111

1212
## Posit Cloud
1313
<!--TODO: Update this with Posit Cloud info-->
@@ -48,7 +48,7 @@ library(gt)
4848
glimpse(towny)
4949
```
5050

51-
## Your Turn {background-color='{{< brand color pink >}}' .smaller}
51+
## Your Turn {background-color='{{< brand color pink >}}'}
5252

5353
```{r}
5454
#| label: gs-ex-time
@@ -57,18 +57,9 @@ gs_ex_time <- 10
5757
gs_ex_warn <- 3
5858
```
5959

60+
- Open `getting-started_exercises.qmd`
61+
- Take `r gs_ex_time` minutes to set up Posit Cloud and finish the exercises individually. We will then go over together.
6062

61-
- Take `r gs_ex_time` minutes to set up Posit Cloud and finish these exercises individually. We will then go over together.
62-
63-
1. How many different types of CSD (`csd_type`) are there in the dataset?
64-
2. How many different types of CSD and status (`status`) are there in the dataset?
65-
3. What is the proportion of each type of CSD?
66-
4. What is the proportion of each status within type of CSD?
67-
5. What is the mean population of all of the municipalities in 2021?
68-
6. What is the mean population by CSD Type in 2021?
69-
7. What is the mean population of all of the municipalities in 1996, 2001, 2006, 2011, 2016, and 2021? Try to use the across function.
70-
8. Run a simple t-test to see if the average population in 1996 is different from the average population in 2016.
71-
7263
```{r}
7364
#| label: gs-ex-clock
7465
#| echo: false
@@ -238,9 +229,39 @@ towny %>%
238229
print(width=90)
239230
```
240231

241-
# Setup {background-color='{{< brand color secondary >}}'}
232+
## Ex. 8
233+
234+
Run a simple t-test to see if the average population in 1996 is different from the average population in 2016.
235+
236+
```{r}
237+
#| label: ex-8-code
238+
#| eval: false
239+
t.test(towny$population_1996, towny$population_2016, paired = TRUE)
240+
```
241+
242+
. . .
243+
244+
```{r}
245+
#| label: ex-8-outp-custprint
246+
#| echo: false
247+
t.test(towny$population_1996, towny$population_2016, paired = TRUE)
248+
```
249+
250+
# Packages {background-color='{{< brand color secondary >}}'}
251+
252+
## R Packages for Survey Analysis
242253

243-
## Packages
254+
- {survey} package first on CRAN in 2003
255+
- descriptive analysis
256+
- statistical testing
257+
- modeling
258+
- weighting
259+
260+
- {srvyr} package first on CRAN in 2016
261+
- “wrapper” for {survey} with {tidyverse}-style syntax
262+
- only descriptive analysis
263+
264+
## Install Packages
244265

245266
Install packages for data wrangling and survey analysis:
246267

@@ -275,15 +296,17 @@ library(srvyrexploR)
275296
Note: Installation of packages is already done for you on Posit Cloud
276297
:::
277298

299+
# Data {background-color='{{< brand color secondary >}}'}
300+
278301
## Today's Data
279302

280303
**American National Election Studies (ANES – DeBell 2010)**
281304

282-
* Stored as `anes_2020`
305+
* Stored as `anes_2020` in {srvyrexploR}
283306

284307
**Residential Energy Consumption Survey (RECS – U.S. Energy Information Administration 2023b)**
285308

286-
* Stored as `recs_2020`
309+
* Stored as `recs_2020` in {srvyrexploR}
287310

288311
## American National Election Studies (ANES) 2020 {.smaller}
289312

@@ -363,7 +386,12 @@ anes_des <- anes_2020 %>%
363386
ids = V200010c,
364387
nest = TRUE
365388
)
389+
```
366390

391+
## American National Election Studies Design Object
392+
393+
```{r}
394+
#| label: anes-des-show
367395
anes_des
368396
```
369397

@@ -380,25 +408,14 @@ recs_des <- recs_2020 %>%
380408
scale = 59 / 60,
381409
mse = TRUE
382410
)
383-
384-
recs_des
385411
```
386412

387-
# Survey Analysis Process {background-color='{{< brand color secondary >}}'}
388-
389-
## Overview of Survey Analysis using {srvyr} Package
390-
391-
::: incremental
392-
393-
1. Create a `tbl_svy` object (a survey object) using: `as_survey_design()` or `as_survey_rep()`
394-
395-
2. Subset data (if needed) using `filter()` (to create subpopulations)
396-
397-
3. Specify domains of analysis using `group_by()`
398-
399-
4. Within `summarize()`, specify variables to calculate, including means, totals, proportions, quantiles, and more
413+
## Residential Energy Consumption Survey Design Object
400414

401-
:::
415+
```{r}
416+
#| label: recs-des-show
417+
recs_des
418+
```
402419

403420
# Similarities (and Differences) Between {dplyr} and {srvyr} Functions {background-color='{{< brand color secondary >}}'}
404421

@@ -558,6 +575,22 @@ towny %>%
558575
<<sv-non-svobj>>
559576
```
560577

578+
# Survey Analysis Process {background-color='{{< brand color secondary >}}'}
579+
580+
## Overview of Survey Analysis using {srvyr} Package
581+
582+
::: incremental
583+
584+
1. Create a `tbl_svy` object (a survey object) using: `as_survey_design()` or `as_survey_rep()`
585+
586+
2. Subset data (if needed) using `filter()` (to create subpopulations)
587+
588+
3. Specify domains of analysis using `group_by()`
589+
590+
4. Within `summarize()`, specify variables to calculate, including means, totals, proportions, quantiles, and more
591+
592+
:::
593+
561594
# Wrap Up {background-color='{{< brand color secondary >}}'}
562595

563596
## Wrap Up

0 commit comments

Comments
 (0)