|
36 | 36 | survey data. The COVIDcast API, which serves these estimates and is updated |
37 | 37 | daily, is a much larger effort run by the Delphi group, and our entire |
38 | 38 | engineering team is owed a lot of credit here. Ryan came up with the |
39 | | - idea of running the surveys, and worked with Facebook to make this a reality. |
| 39 | + idea of running the surveys, and worked with Facebook to make this a reality. |
40 | 40 | On the Facebook side, Curtiss Cobb and Jonathan McKay played big roles. The |
41 | 41 | University of Maryland team, including Adrianne Bradford and Samantha Chiu and |
42 | 42 | led by Frauke Kreuter, made many contributions to the survey design. |
|
47 | 47 | toc: true |
48 | 48 | --- |
49 | 49 |
|
50 | | -<script src="/rmarkdown-libs/header-attrs/header-attrs.js"></script> |
51 | 50 | <link href="/rmarkdown-libs/anchor-sections/anchor-sections.css" rel="stylesheet" /> |
52 | 51 | <script src="/rmarkdown-libs/anchor-sections/anchor-sections.js"></script> |
53 | 52 |
|
|
57 | 56 | <li><a href="#why-run-these-surveys">Why Run These Surveys?</a></li> |
58 | 57 | <li><a href="#whats-in-the-survey">What’s in the Survey?</a></li> |
59 | 58 | <li><a href="#some-interesting-examples">Some Interesting Examples</a></li> |
60 | | -<li><a href="#basic-correlation-analysis">Basic Correlation Analysis</a> |
61 | | -<ul> |
| 59 | +<li><a href="#basic-correlation-analysis">Basic Correlation Analysis</a><ul> |
62 | 60 | <li><a href="#correlations-sliced-by-time">Correlations Sliced by Time</a></li> |
63 | 61 | <li><a href="#correlations-sliced-by-county">Correlations Sliced by County</a></li> |
64 | 62 | </ul></li> |
@@ -156,22 +154,23 @@ <h2>Short Background</h2> |
156 | 154 | df_fb_avg = df_fb %>% group_by(geo_value) %>% summarize(value = mean(value)) |
157 | 155 | df_in_avg = df_in %>% group_by(geo_value) %>% summarize(value = mean(value)) |
158 | 156 |
|
159 | | -# Set a bunch of fields so that the data frames know how to plot themselves |
160 | | -df_fb_avg$time_value = df_in_avg$time_value = start_day |
161 | | -df_fb_avg$issue = df_in_avg$issue = start_day |
162 | | -attributes(df_fb_avg)$metadata$geo_type = "state" |
163 | | -attributes(df_in_avg)$metadata$geo_type = "state" |
164 | | -class(df_fb_avg) = c("covidcast_signal", class(df_fb_avg)) |
165 | | -class(df_in_avg) = c("covidcast_signal", class(df_in_avg)) |
| 157 | +# Turn these into covidcast_signal data frames that can be mapped |
| 158 | +df_fb_avg = df_fb_avg %>% |
| 159 | + mutate(time_value = start_day) %>% |
| 160 | + as.covidcast_signal(signal = "fb_avg", geo_type = "state") |
| 161 | + |
| 162 | +df_in_avg = df_in_avg %>% |
| 163 | + mutate(time_value = start_day) %>% |
| 164 | + as.covidcast_signal(signal = "in_avg", geo_type = "state") |
166 | 165 |
|
167 | 166 | # Plot choropleth maps, using the covidcast plotting functionality |
168 | 167 | subtitle = paste("Averaged over", start_day, "to", end_day) |
169 | 168 | p1 = plot(df_fb_avg, |
170 | 169 | title = "% of people with COVID symptoms, based on Facebook surveys", |
171 | | - range=c(0, 1), choro_params = list(subtitle = subtitle)) |
| 170 | + range = c(0, 1), choro_params = list(subtitle = subtitle)) |
172 | 171 | p2 = plot(df_in_avg, |
173 | 172 | title = "Daily new confirmed COVID-19 cases per 100,000 people", |
174 | | - range=c(0, 30), choro_params = list(subtitle = subtitle)) |
| 173 | + range = c(0, 30), choro_params = list(subtitle = subtitle)) |
175 | 174 | grid.arrange(p1, p2, nrow = 1)</code></pre> |
176 | 175 | <p><img src="/blog/2020-08-26-fb-survey_files/figure-html/unnamed-chunk-2-1.svg" width="960" class="wide-figure" /></p> |
177 | 176 | <p>We generated these plots using our <a href="https://cmu-delphi.github.io/covidcast/covidcastR/">covidcast R |
@@ -517,12 +516,13 @@ <h3>Correlations Sliced by County</h3> |
517 | 516 | either that county had below 500 cumulative COVID-19 cases, |
518 | 517 | or we didn’t have enough data from the surveys in |
519 | 518 | order to estimate % CLI and % CLI-in-community signals there.</p> |
520 | | -<pre class="r"><code># Set a bunch of fields so that the data frames know how to plot themselves |
521 | | -df_cor1$time_value = df_cor2$time_value = start_day |
522 | | -df_cor1$issue = df_cor2$issue = start_day |
523 | | -attributes(df_cor1)$metadata$geo_type = "county" |
524 | | -attributes(df_cor2)$metadata$geo_type = "county" |
525 | | -class(df_cor1) = class(df_cor2) = c("covidcast_signal", "data.frame") |
| 519 | +<pre class="r"><code># Use as.covidcast_signal to turn these into mappable signals |
| 520 | +df_cor1 = df_cor1 %>% |
| 521 | + mutate(time_value = start_day) %>% |
| 522 | + as.covidcast_signal(signal = "cor1") |
| 523 | +df_cor2 = df_cor2 %>% |
| 524 | + mutate(time_value = start_day) %>% |
| 525 | + as.covidcast_signal(signal = "cor1") |
526 | 526 |
|
527 | 527 | # Plot choropleth maps, using the covidcast plotting functionality |
528 | 528 | p1 = plot(df_cor1, title = "Correlation between % CLI and case rates", |
|
0 commit comments