Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ansible/templates/facebook-params-prod.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"Survey of COVID-Like Illness - Wave 10": "fb-survey",
"Survey of COVID-Like Illness - Wave 11": "fb-survey",
"Survey of COVID-Like Illness - Wave 12": "fb-survey",
"Survey of COVID-Like Illness - Wave 12 - Full Launch": "fb-survey",
"Survey of COVID-Like Illness - Wave 4": "fb-survey",
"Survey of COVID-Like Illness - Wave 5": "fb-survey",
"Survey of COVID-Like Illness - Wave 6": "fb-survey",
Expand Down
25 changes: 24 additions & 1 deletion facebook/delphiFacebook/R/binary.R
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ get_binary_indicators <- function() {

"smoothed_vaccinate_children", "weight_unif", "v_vaccinate_children", 6, compute_binary_response, jeffreys_binary,
"smoothed_wvaccinate_children", "weight", "v_vaccinate_children", 6, compute_binary_response, jeffreys_binary,
"smoothed_vaccinate_child_oldest", "weight_unif", "v_vaccinate_child_oldest", 6, compute_binary_response, jeffreys_binary,
"smoothed_wvaccinate_child_oldest", "weight", "v_vaccinate_child_oldest", 6, compute_binary_response, jeffreys_binary,

"smoothed_try_vaccinate_1m", "weight_unif", "v_try_vaccinate_1m", 6, compute_binary_response, jeffreys_binary,
"smoothed_wtry_vaccinate_1m", "weight", "v_try_vaccinate_1m", 6, compute_binary_response, jeffreys_binary,

Expand Down Expand Up @@ -193,7 +196,9 @@ get_binary_indicators <- function() {
"smoothed_whesitancy_reason_pregnant", "weight", "v_hesitancy_reason_pregnant", 6, compute_binary_response, jeffreys_binary,
"smoothed_hesitancy_reason_religious", "weight_unif", "v_hesitancy_reason_religious", 6, compute_binary_response, jeffreys_binary,
"smoothed_whesitancy_reason_religious", "weight", "v_hesitancy_reason_religious", 6, compute_binary_response, jeffreys_binary,

"smoothed_hesitancy_reason_dislike_vaccines_generally", "weight_unif", "v_hesitancy_reason_dislike_vaccines_generally", 6, compute_binary_response, jeffreys_binary,
"smoothed_whesitancy_reason_dislike_vaccines_generally", "weight", "v_hesitancy_reason_dislike_vaccines_generally", 6, compute_binary_response, jeffreys_binary,

# vaccine barriers
"smoothed_vaccine_barrier_eligible", "weight_unif", "v_vaccine_barrier_eligible", 6, compute_binary_response, jeffreys_binary,
"smoothed_wvaccine_barrier_eligible", "weight", "v_vaccine_barrier_eligible", 6, compute_binary_response, jeffreys_binary,
Expand All @@ -219,6 +224,10 @@ get_binary_indicators <- function() {
"smoothed_wvaccine_barrier_type", "weight", "v_vaccine_barrier_type", 6, compute_binary_response, jeffreys_binary,
"smoothed_vaccine_barrier_none", "weight_unif", "v_vaccine_barrier_none", 6, compute_binary_response, jeffreys_binary,
"smoothed_wvaccine_barrier_none", "weight", "v_vaccine_barrier_none", 6, compute_binary_response, jeffreys_binary,
"smoothed_vaccine_barrier_appointment_location", "weight_unif", "v_vaccine_barrier_appointment_location", 6, compute_binary_response, jeffreys_binary,
"smoothed_wvaccine_barrier_appointment_location", "weight", "v_vaccine_barrier_appointment_location", 6, compute_binary_response, jeffreys_binary,
"smoothed_vaccine_barrier_other", "weight_unif", "v_vaccine_barrier_other", 6, compute_binary_response, jeffreys_binary,
"smoothed_wvaccine_barrier_other", "weight", "v_vaccine_barrier_other", 6, compute_binary_response, jeffreys_binary,

# vaccine barriers for vaccinated
"smoothed_vaccine_barrier_eligible_has", "weight_unif", "v_vaccine_barrier_eligible_has", 6, compute_binary_response, jeffreys_binary,
Expand All @@ -245,6 +254,10 @@ get_binary_indicators <- function() {
"smoothed_wvaccine_barrier_type_has", "weight", "v_vaccine_barrier_type_has", 6, compute_binary_response, jeffreys_binary,
"smoothed_vaccine_barrier_none_has", "weight_unif", "v_vaccine_barrier_none_has", 6, compute_binary_response, jeffreys_binary,
"smoothed_wvaccine_barrier_none_has", "weight", "v_vaccine_barrier_none_has", 6, compute_binary_response, jeffreys_binary,
"smoothed_vaccine_barrier_appointment_location_has", "weight_unif", "v_vaccine_barrier_appointment_location_has", 6, compute_binary_response, jeffreys_binary,
"smoothed_wvaccine_barrier_appointment_location_has", "weight", "v_vaccine_barrier_appointment_location_has", 6, compute_binary_response, jeffreys_binary,
"smoothed_vaccine_barrier_other_has", "weight_unif", "v_vaccine_barrier_other_has", 6, compute_binary_response, jeffreys_binary,
"smoothed_wvaccine_barrier_other_has", "weight", "v_vaccine_barrier_other_has", 6, compute_binary_response, jeffreys_binary,

# vaccine barriers for attempted vaccinated
"smoothed_vaccine_barrier_eligible_tried", "weight_unif", "v_vaccine_barrier_eligible_tried", 6, compute_binary_response, jeffreys_binary,
Expand All @@ -271,6 +284,11 @@ get_binary_indicators <- function() {
"smoothed_wvaccine_barrier_type_tried", "weight", "v_vaccine_barrier_type_tried", 6, compute_binary_response, jeffreys_binary,
"smoothed_vaccine_barrier_none_tried", "weight_unif", "v_vaccine_barrier_none_tried", 6, compute_binary_response, jeffreys_binary,
"smoothed_wvaccine_barrier_none_tried", "weight", "v_vaccine_barrier_none_tried", 6, compute_binary_response, jeffreys_binary,
"smoothed_vaccine_barrier_appointment_location_tried", "weight_unif", "v_vaccine_barrier_appointment_location_tried", 6, compute_binary_response, jeffreys_binary,
"smoothed_wvaccine_barrier_appointment_location_tried", "weight", "v_vaccine_barrier_appointment_location_tried", 6, compute_binary_response, jeffreys_binary,
"smoothed_vaccine_barrier_other_tried", "weight_unif", "v_vaccine_barrier_other_tried", 6, compute_binary_response, jeffreys_binary,
"smoothed_wvaccine_barrier_other_tried", "weight", "v_vaccine_barrier_other_tried", 6, compute_binary_response, jeffreys_binary,


# reasons for belief that vaccine is unnecessary
"smoothed_dontneed_reason_had_covid", "weight_unif", "v_dontneed_reason_had_covid", 6, compute_binary_response, jeffreys_binary,
Expand All @@ -294,6 +312,11 @@ get_binary_indicators <- function() {
"smoothed_inperson_school_parttime", "weight_unif", "s_inperson_school_parttime", 6, compute_binary_response, jeffreys_binary,
"smoothed_winperson_school_parttime", "weight", "s_inperson_school_parttime", 6, compute_binary_response, jeffreys_binary,

"smoothed_inperson_school_fulltime_oldest", "weight_unif", "s_inperson_school_fulltime_oldest", 6, compute_binary_response, jeffreys_binary,
"smoothed_winperson_school_fulltime_oldest", "weight", "s_inperson_school_fulltime_oldest", 6, compute_binary_response, jeffreys_binary,
"smoothed_inperson_school_parttime_oldest", "weight_unif", "s_inperson_school_parttime_oldest", 6, compute_binary_response, jeffreys_binary,
"smoothed_winperson_school_parttime_oldest", "weight", "s_inperson_school_parttime_oldest", 6, compute_binary_response, jeffreys_binary,

# beliefs
"smoothed_belief_masking_effective", "weight_unif", "b_belief_masking_effective", 6, compute_binary_response, jeffreys_binary,
"smoothed_wbelief_masking_effective", "weight", "b_belief_masking_effective", 6, compute_binary_response, jeffreys_binary,
Expand Down
12 changes: 11 additions & 1 deletion facebook/delphiFacebook/R/contingency_indicators.R
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ get_aggs <- function() {
"pct_covid_vaccinated_friends", "v_covid_vaccinated_friends", compute_binary, jeffreys_binary,

"pct_vaccinate_children", "v_vaccinate_children", compute_binary, jeffreys_binary,
"pct_vaccinate_child_oldest", "v_vaccinate_child_oldest", compute_binary, jeffreys_binary,

"pct_accept_vaccine_defyes", "v_accept_vaccine_defyes", compute_binary, jeffreys_multinomial_factory(4),
"pct_accept_vaccine_probyes", "v_accept_vaccine_probyes", compute_binary, jeffreys_multinomial_factory(4),
Expand Down Expand Up @@ -203,6 +204,7 @@ get_aggs <- function() {
"pct_hesitant_barrier_health_condition", "v_hesitant_barrier_health_condition", compute_binary, jeffreys_binary,
"pct_hesitant_barrier_pregnant", "v_hesitant_barrier_pregnant", compute_binary, jeffreys_binary,
"pct_hesitant_barrier_other", "v_hesitant_barrier_other", compute_binary, jeffreys_binary,
"pct_hesitant_barrier_dislike_vaccines_generally", "v_hesitant_barrier_dislike_vaccines_generally", compute_binary, jeffreys_binary,

"pct_hesitant_dontneed_reason_had_covid", "v_hesitant_dontneed_reason_had_covid", compute_binary, jeffreys_binary,
"pct_hesitant_dontneed_reason_dont_spend_time", "v_hesitant_dontneed_reason_dont_spend_time", compute_binary, jeffreys_binary,
Expand All @@ -227,6 +229,7 @@ get_aggs <- function() {
"pct_barrier_health_condition", "v_hesitancy_reason_health_condition", compute_binary, jeffreys_binary,
"pct_barrier_pregnant", "v_hesitancy_reason_pregnant", compute_binary, jeffreys_binary,
"pct_barrier_other", "v_hesitancy_reason_other", compute_binary, jeffreys_binary,
"pct_barrier_dislike_vaccines_generally", "v_hesitancy_reason_dislike_vaccines_generally", compute_binary, jeffreys_binary,

# vaccine "don't need" reasons
"pct_dontneed_reason_had_covid", "v_dontneed_reason_had_covid_5abc_6", compute_binary, jeffreys_binary,
Expand All @@ -252,6 +255,7 @@ get_aggs <- function() {
"pct_defno_barrier_health_condition", "v_defno_barrier_health_condition", compute_binary, jeffreys_binary,
"pct_defno_barrier_pregnant", "v_defno_barrier_pregnant", compute_binary, jeffreys_binary,
"pct_defno_barrier_other", "v_defno_barrier_other", compute_binary, jeffreys_binary,
"pct_defno_barrier_dislike_vaccines_generally", "v_defno_barrier_dislike_vaccines_generally", compute_binary, jeffreys_binary,

"pct_defno_dontneed_reason_had_covid", "v_defno_dontneed_reason_had_covid", compute_binary, jeffreys_binary,
"pct_defno_dontneed_reason_dont_spend_time", "v_defno_dontneed_reason_dont_spend_time", compute_binary, jeffreys_binary,
Expand Down Expand Up @@ -284,6 +288,8 @@ get_aggs <- function() {
"pct_vaccine_barrier_time", "v_vaccine_barrier_time", compute_binary, jeffreys_binary,
"pct_vaccine_barrier_type", "v_vaccine_barrier_type", compute_binary, jeffreys_binary,
"pct_vaccine_barrier_none", "v_vaccine_barrier_none", compute_binary, jeffreys_binary,
"pct_vaccine_barrier_appointment_location", "v_vaccine_barrier_appointment_location", compute_binary, jeffreys_binary,
"pct_vaccine_barrier_other", "v_vaccine_barrier_other", compute_binary, jeffreys_binary,

# beliefs
"pct_belief_masking_effective", "b_belief_masking_effective", compute_binary, jeffreys_binary,
Expand Down Expand Up @@ -397,6 +403,8 @@ get_aggs <- function() {
"pct_vaccine_barrier_time_has", "v_vaccine_barrier_time_has", compute_binary, jeffreys_binary,
"pct_vaccine_barrier_type_has", "v_vaccine_barrier_type_has", compute_binary, jeffreys_binary,
"pct_vaccine_barrier_none_has", "v_vaccine_barrier_none_has", compute_binary, jeffreys_binary,
"pct_vaccine_barrier_appointment_location_has", "v_vaccine_barrier_appointment_location_has", compute_binary, jeffreys_binary,
"pct_vaccine_barrier_other_has", "v_vaccine_barrier_other_has", compute_binary, jeffreys_binary,

# vaccine barriers for tried vaccinated
"pct_vaccine_barrier_eligible_tried", "v_vaccine_barrier_eligible_tried", compute_binary, jeffreys_binary,
Expand All @@ -410,7 +418,9 @@ get_aggs <- function() {
"pct_vaccine_barrier_childcare_tried", "v_vaccine_barrier_childcare_tried", compute_binary, jeffreys_binary,
"pct_vaccine_barrier_time_tried", "v_vaccine_barrier_time_tried", compute_binary, jeffreys_binary,
"pct_vaccine_barrier_type_tried", "v_vaccine_barrier_type_tried", compute_binary, jeffreys_binary,
"pct_vaccine_barrier_none_tried", "v_vaccine_barrier_none_tried", compute_binary, jeffreys_binary
"pct_vaccine_barrier_none_tried", "v_vaccine_barrier_none_tried", compute_binary, jeffreys_binary,
"pct_vaccine_barrier_appointment_location_tried", "v_vaccine_barrier_appointment_location_tried", compute_binary, jeffreys_binary,
"pct_vaccine_barrier_other_tried", "v_vaccine_barrier_other_tried", compute_binary, jeffreys_binary
)

aggs <- create_aggs_product(regions, groups, indicators)
Expand Down
62 changes: 43 additions & 19 deletions facebook/delphiFacebook/R/contingency_variables.R
Original file line number Diff line number Diff line change
Expand Up @@ -567,16 +567,27 @@ code_vaccine_barriers <- function(input_data, wave) {
input_data$v_hesitant_barrier_other <- is_selected(hesitancy_reasons, "13")
input_data$v_hesitant_barrier_pregnant <- is_selected(hesitancy_reasons, "14")
input_data$v_hesitant_barrier_religious <- is_selected(hesitancy_reasons, "15")
input_data$v_hesitant_barrier_dislike_vaccines_generally <- is_selected(hesitancy_reasons, "16") # replacing choice 5 as of Wave 12

# These response choices were removed starting in Wave 11. They are explicitly set to missing
# for waves 11 and later since `is_selected` will return FALSE (meaning "not selected") for
# them if the respondent selected at least once answer choice.
input_data$v_hesitant_barrier_allergic[input_data$wave >= 11] <- NA
input_data$v_hesitant_barrier_not_recommended[input_data$wave >= 11] <- NA
input_data$v_hesitant_barrier_distrust_vaccines[input_data$wave >= 11] <- NA
input_data$v_hesitant_barrier_health_condition[input_data$wave >= 11] <- NA
input_data$v_hesitant_barrier_pregnant[input_data$wave >= 11] <- NA

# For waves before a given response choice existed, explicitly set the
# derived field to missing since `is_selected` will return FALSE (meaning
# "not selected") for them if the respondent selected at least once answer
# choice.
if (wave >= 11) {
input_data$v_hesitant_barrier_allergic <- NA
input_data$v_hesitant_barrier_not_recommended <- NA
input_data$v_hesitant_barrier_health_condition <- NA
input_data$v_hesitant_barrier_pregnant <- NA
}
if (wave == 11) {
input_data$v_hesitant_barrier_distrust_vaccines <- NA
}
if (wave < 12) {
input_data$v_hesitant_barrier_dislike_vaccines_generally <- NA
}
if (wave >= 12) {
input_data$v_hesitant_barrier_dislike_vaccines <- NA
}
} else {
input_data$v_hesitant_barrier_sideeffects <- NA
input_data$v_hesitant_barrier_allergic <- NA
Expand All @@ -593,6 +604,7 @@ code_vaccine_barriers <- function(input_data, wave) {
input_data$v_hesitant_barrier_other <- NA
input_data$v_hesitant_barrier_pregnant <- NA
input_data$v_hesitant_barrier_religious <- NA
input_data$v_hesitant_barrier_dislike_vaccines_generally <- NA
}

# defno_barrier_<reason>
Expand All @@ -618,16 +630,27 @@ code_vaccine_barriers <- function(input_data, wave) {
input_data$v_defno_barrier_other <- is_selected(defno_reasons, "13")
input_data$v_defno_barrier_pregnant <- is_selected(defno_reasons, "14")
input_data$v_defno_barrier_religious <- is_selected(defno_reasons, "15")

# These response choices were removed starting in Wave 11. They are explicitly set to missing
# for waves 11 and later since `is_selected` will return FALSE (meaning "not selected") for
# them if the respondent selected at least once answer choice.
input_data$v_defno_barrier_allergic[input_data$wave >= 11] <- NA
input_data$v_defno_barrier_not_recommended[input_data$wave >= 11] <- NA
input_data$v_defno_barrier_distrust_vaccines[input_data$wave >= 11] <- NA
input_data$v_defno_barrier_health_condition[input_data$wave >= 11] <- NA
input_data$v_defno_barrier_pregnant[input_data$wave >= 11] <- NA

input_data$v_defno_barrier_dislike_vaccines_generally <- is_selected(defno_reasons, "16") # replacing choice 5 as of Wave 12

# For waves before a given response choice existed, explicitly set the
# derived field to missing since `is_selected` will return FALSE (meaning
# "not selected") for them if the respondent selected at least once answer
# choice.
if (wave >= 11) {
input_data$v_defno_barrier_allergic <- NA
input_data$v_defno_barrier_not_recommended <- NA
input_data$v_defno_barrier_health_condition <- NA
input_data$v_defno_barrier_pregnant <- NA
}
if (wave == 11) {
input_data$v_defno_barrier_distrust_vaccines <- NA
}
if (wave < 12) {
input_data$v_defno_barrier_dislike_vaccines_generally <- NA
}
if (wave >= 12) {
input_data$v_defno_barrier_dislike_vaccines <- NA
}
} else {
input_data$v_defno_barrier_sideeffects <- NA
input_data$v_defno_barrier_allergic <- NA
Expand All @@ -644,6 +667,7 @@ code_vaccine_barriers <- function(input_data, wave) {
input_data$v_defno_barrier_other <- NA
input_data$v_defno_barrier_pregnant <- NA
input_data$v_defno_barrier_religious <- NA
input_data$v_defno_barrier_dislike_vaccines_generally <- NA
}

# dontneed_reason_<reason>
Expand Down
2 changes: 1 addition & 1 deletion facebook/delphiFacebook/R/responses.R
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ surveyID_to_wave <- Vectorize(function(surveyID) {
"SV_6PADB8DyF9SIyXk" = 10,
"SV_4VEaeffqQtDo33M" = 11,
"SV_3TL0r243mLkDzCK" = 12.5, # experimental version of Wave 12
"TBD finalized version" = 12 # finalized version of Wave 12
"SV_eDISRi5wQcNU70G" = 12 # finalized version of Wave 12
)

if ( any(names(waves) == surveyID) ) {
Expand Down
Loading