From 4b831cad5518f2c6e15960d8f530d1c4b3bb7165 Mon Sep 17 00:00:00 2001 From: Daniel Ibsen Date: Tue, 28 May 2024 21:33:45 +0200 Subject: [PATCH] updated group work solution --- sessions/group_work_day2.qmd | 9 +-- sessions/group_work_day2_solution.qmd | 94 +++++++++++++++++++++++++++ sessions/reporting-guidelines.qmd | 8 ++- 3 files changed, 104 insertions(+), 7 deletions(-) create mode 100644 sessions/group_work_day2_solution.qmd diff --git a/sessions/group_work_day2.qmd b/sessions/group_work_day2.qmd index 8a4b031..31d3cb3 100644 --- a/sessions/group_work_day2.qmd +++ b/sessions/group_work_day2.qmd @@ -4,8 +4,7 @@ ## Objective of this session In this session, We will get hands on practice using the Framingham -dataset. You will conduct a proper causal mediation analysis, -considering: +dataset. You will conduct a causal mediation analysis, considering: - Conduct causal mediation analyses with exposure induced mediator-outcome confounder or multiple mediators @@ -31,6 +30,8 @@ can either use the **mediation** package or **CMAverse** package. 2. Perform a causal mediation analysis -3. Conduct a sensitivity analyses and discuss the results +3. Conduct a sensitivity analyses for uncontrolled confounding and + discuss the results -4. Write a short report of your mediation models +4. Write a short report of your mediation models. Focus on item + 6,9,10,11,14,15,18,19,20,21,22 in the long Agrema checklist. diff --git a/sessions/group_work_day2_solution.qmd b/sessions/group_work_day2_solution.qmd new file mode 100644 index 0000000..f25c9b9 --- /dev/null +++ b/sessions/group_work_day2_solution.qmd @@ -0,0 +1,94 @@ +# Day 2: Group work + +::: callout-note +## Objective of this session + +In this session, We will get hands on practice using the Framingham +dataset. You will conduct a causal mediation analysis, considering: + +- Conduct causal mediation analyses with exposure induced + mediator-outcome confounder or multiple mediators +- Conduct sensitivity analyses +- Report the results following the guidelines +::: + +We will continue working with the obesity and cardiovascular disease +example. + +First, reflect on the group work from yesterday and discuss the +following questions with your group members: + +- Review the assumptions of causal mediation, and discuss the + robustness of your estimates +- Are there other mediators than systolic blood pressure? +- Are there interactions between obesity and the mediators? + +Re-conduct the mediation analysis and address the discussion points. You +can either use the **mediation** package or **CMAverse** package. + +1. Re-do the DAG, and investigate the potential pathways + +2. Perform a causal mediation analysis + +Load data: + +```{r setup} +library(here) +library(tidyverse) + +load(here::here("data/frmghamdata.RData")) +``` + +Clean the data: + +```{r} +frmgham_clean <- frmgham %>% + select( + id = randid, + w1 = sex, + w2 = age, + w3 = cursmoke, + w4 = educ, + a = bmi, # this is the exposure + m = sysbp, # this is the mediator + y = cvd # this is the outcome + ) %>% + na.omit() + +frmgham_clean <- frmgham_clean %>% + mutate(a = case_when(a >= 30 ~ 1, + TRUE ~ 0)) + +``` + +Do causal mediation analysis: + +```{r} +library(CMAverse) + +res_rb <- cmest( + data = frmgham_clean, model = "rb", outcome = "y", exposure = "a", + mediator = "m", basec = c("w1", "w2", "w3", "w4"), EMint = TRUE, + mreg = list("linear"), yreg = "logistic", + astar = 0, a = 1, mval = list(120), + estimation = "paramfunc", inference = "delta" +) + +summary(res_rb) +``` + +3. Conduct a sensitivity analyses for uncontrolled confounding and + discuss the results + +```{r} +uc_sens <- cmsens( + object = res_rb, + sens = "uc" +) + +uc_sens + +``` + +4. Write a short report of your mediation models. Focus on item + 6,9,10,11,14,15,18,19,20,21,22 in the long Agrema checklist. diff --git a/sessions/reporting-guidelines.qmd b/sessions/reporting-guidelines.qmd index 0d87026..1c71d49 100644 --- a/sessions/reporting-guidelines.qmd +++ b/sessions/reporting-guidelines.qmd @@ -50,10 +50,12 @@ report. See @fig-agrema-checklist-sf. ![AGReMA checklist from Lee et al.](/images/agrema-checklist-sf.PNG){#fig-agrema-checklist-sf} -## Exercise +::: callout-note \## Exercise - 15 min -- how many of the items are reported in the mediation analysis papers +- How many of the items are reported in the mediation analysis papers you reviewed in the beginning of the course? -- what do you think are the most important things missing? +- What do you think are the most important things missing? + +::: ## References