
Generate cross-domain quiz pairs comparing acute and chronic risks
Source:R/combined_quiz.R
combined_quiz_pairs.RdCreates candidate question pairs mixing acute risks from common_risks()
(micromorts per event) with chronic risks from chronic_risks() (microlives
per day), converting both to a common microlife scale so they can be
directly compared. Each pair pits one acute activity against one chronic
lifestyle factor and asks which has a larger total impact over
time_period_days.
Arguments
- n
Integer. Number of pairs to generate. Default
10.- time_period_days
Numeric. Time period for chronic risk accumulation. Default
365(1 year). For chronic risks, the cumulative impact isabs(microlives_per_day) × time_period_days.- seed
Integer or
NULL. Random seed for reproducibility. DefaultNULL(random each call).
Value
A tibble with columns:
activity_a,type_a("acute"),value_a,unit_a("micromorts"),category_a,period_afactor_b,type_b("chronic"),value_b,unit_b("microlives/day"),category_b,direction_bcommon_unit("microlives"),common_value_a,common_value_bcorrect_answer("a" or "b" — whichever has higher impact in common unit)ratio(larger / smaller common value)explanationdescribing both values and the conversion
Details
The conversion from micromorts to microlives uses the factor
0.7 (1 micromort ≈ 0.7 microlives at age 40). Chronic impact over the
time period is abs(microlives_per_day) × time_period_days.
Examples
pairs <- combined_quiz_pairs(n = 5, seed = 42)
pairs[, c("activity_a", "factor_b", "correct_answer", "ratio")]
#> # A tibble: 5 × 4
#> activity_a factor_b correct_answer ratio
#> <chr> <chr> <chr> <dbl>
#> 1 Spanish flu infection Smoking 10 cigarettes a 1.15
#> 2 Base jumping (per jump) Glass of wine daily b 1.21
#> 3 Living (one day, age 90) Glass of wine daily b 1.13
#> 4 Matterhorn ascent Average cancer diagnosis b 1.10
#> 5 Living (one day, age 90) 2-3 cups coffee (men) b 1.13
# One year time period (default)
pairs_year <- combined_quiz_pairs(n = 10, time_period_days = 365, seed = 1)