kimanh358 / HUPH_decision_policy_nutrition

MIT License
0 stars 0 forks source link

Risk = Likelihood x Impact #1

Open CWWhitney opened 5 months ago

CWWhitney commented 5 months ago

We might use ifelse instead of nested if else statements for evaluating various risks.

# Apply the effects of each risk
staff_effects <- c(
  staff_knowledge_food_safety = ifelse(positive_board == 1, staff_knowledge_food_safety, staff_knowledge_food_safety * (1 - positive_board)),
  staff_knowledge_nutrition = ifelse(positive_board == 1, staff_knowledge_nutrition, staff_knowledge_nutrition * (1 - positive_board)),
  health_lessons_class = ifelse(overwork_teacher == 1, health_lessons_class * (1 - overwork_teacher), health_lessons_class),
  food_safety_practices_staff = ifelse(bad_belief_staff == 1 | bad_practice_staff == 1, food_safety_practices_staff * (1 - max(bad_belief_staff, bad_practice_staff)), food_safety_practices_staff),
  meal_nutrition_practices_staff = ifelse(bad_belief_staff == 1 | bad_practice_staff == 1, meal_nutrition_practices_staff * (1 - max(bad_belief_staff, bad_practice_staff)), meal_nutrition_practices_staff)
)

children_effects <- c(
  children_access_healthy_food = ifelse(bad_gate_food == 1 | bad_canteen_food == 1, children_access_healthy_food * (1 - max(bad_gate_food, bad_canteen_food)), children_access_healthy_food),
  children_consume_healthy_food = ifelse(bad_gate_food == 1 | bad_canteen_food == 1, children_consume_healthy_food * (1 - max(bad_gate_food, bad_canteen_food)), children_consume_healthy_food)
)

# Adjust the budget based on the risk
school_meet_mealrequirement <- ifelse(budget_lacking == 1, school_meet_mealrequirement * (1 - budget_lacking), school_meet_mealrequirement)
CWWhitney commented 5 months ago

We can also separate the risk into likelihood and impact components to better understand and manage them. i.e. staff_knowledge_food_safety = ifelse(positive_board == 1, 1, staff_knowledge_food_safety (1 - positive_board)) Could be staff_knowledge_food_safety = ifelse(positive_board == 1, staff_knowledge_food_safety impact_if_positive_board, staff_knowledge_food_safety) impact_if_positive_board would be a positive value in the input table that reflects the positive effect of a board that makes good choices