Setup: Load Packages

# Load the tidyverse package for data manipulation and visualization
library(tidyverse)

# Import the exercise dataset into an object named "df"
df <- read_csv("Exercise_dataset.csv")

# Preview the data
glimpse(df)
## Rows: 415
## Columns: 26
## $ ResponseId   <chr> "ID_1", "ID_2", "ID_3", "ID_4", "ID_5", "ID_6", "ID_7", "…
## $ condition    <chr> "CA_mock", "pic_enhanced", "text_single_control", "CA_moc…
## $ fear_1       <dbl> 2.00, 3.25, 1.00, 3.00, 4.00, 3.25, 3.50, 2.75, 4.00, 1.0…
## $ fear_2       <dbl> 2.00, 4.00, 1.00, 3.00, 4.00, 3.00, 3.50, 3.25, 5.00, 1.0…
## $ fear_3       <dbl> 2.00, 3.50, 1.00, 3.00, 4.00, 3.00, 3.50, 2.50, 4.00, 1.0…
## $ int_1        <dbl> 2, 3, 4, 2, 2, 3, 3, 2, 4, 4, 2, 2, 4, 4, 1, 3, 4, 2, 2, …
## $ int_2        <dbl> 3, 1, 3, 2, 3, 3, 3, 2, 4, 4, 2, 2, 3, 4, 1, 3, 4, 2, 2, …
## $ int_3        <dbl> 3, 2, 4, 2, 4, 3, 4, 2, 4, 4, 3, 3, 4, 4, 1, 3, 4, 2, 3, …
## $ peer_inter_1 <dbl> 2, 3, 3, 2, 3, 3, 4, 3, 4, 1, 3, 3, 1, 1, 3, 3, 4, 2, 2, …
## $ peer_inter_2 <dbl> 2, 3, 3, 2, 3, 3, 4, 2, 4, 1, 3, 3, 3, 1, 1, 3, 1, 2, 3, …
## $ peer_inter_3 <dbl> 3, 3, 3, 2, 4, 3, 4, 3, 4, 1, 4, 3, 1, 1, 1, 2, 1, 2, 2, …
## $ age          <chr> "21-26", "21-26", "21-26", "21-26", "21-26", "18-20", "21…
## $ race         <chr> "White", "White", "White", "Other", "White", "Other", "Wh…
## $ ethnic       <chr> "Non-Hispanic", "Non-Hispanic", "Non-Hispanic", "Non-Hisp…
## $ support_1    <dbl> 1, 3, 5, 3, 5, 3, 5, 3, 5, 1, 4, 5, 4, 4, 4, 3, 1, 3, 4, …
## $ support_2    <dbl> 1, 4, 5, 3, 5, 3, 5, 2, 5, 1, 3, 4, 1, 4, 4, 5, 3, 3, 3, …
## $ support_3    <dbl> 4, 4, 5, 3, 4, 3, 5, 3, 5, 1, 5, 3, 1, 3, 4, 3, 5, 3, 4, …
## $ support_4    <dbl> 4, 2, 4, 3, 3, 3, 5, 3, 5, 1, 5, 3, 1, 4, 4, 4, 3, 3, 4, …
## $ support_5    <dbl> 1, 3, 4, 3, 4, 3, 5, 2, 5, 1, 5, 3, 4, 4, 4, 4, 2, 3, 3, …
## $ support_6    <dbl> 5, 3, 4, 3, 3, 3, 5, 2, 5, 4, 4, 3, 2, 4, 4, 4, 5, 3, 4, …
## $ support_7    <dbl> 3, 4, 5, 3, 3, 3, 4, 2, 5, 2, 4, 4, 3, 4, 3, 4, 3, 3, 4, …
## $ support_8    <dbl> 3, 3, 4, 3, 4, 3, 4, 4, 5, 1, 4, 3, 1, 3, 4, 4, 4, 3, 3, …
## $ support_9    <dbl> 3, 4, 5, 3, 3, 3, 4, 2, 5, 1, 4, 4, 4, 4, 4, 3, 3, 3, 4, …
## $ support_10   <dbl> 3, 2, 4, 3, 4, 3, 5, 4, 5, 1, 3, 3, 4, 4, 4, 4, 3, 3, 2, …
## $ support_11   <dbl> 3, 3, 4, 3, 5, 3, 5, 3, 5, 1, 4, 2, 1, 3, 3, 4, 2, 3, 2, …
## $ support_12   <dbl> 3, 4, 4, 3, 5, 3, 5, 3, 5, 1, 3, 4, 2, 4, 5, 4, 2, 3, 4, …

Source the PROCESS Macro

# Source the process.R script to make the PROCESS macro available in the environment
# Update the path below to wherever process.R is saved on your machine
source("process.R")
## 
## ********************* PROCESS for R Version 4.3.1 ********************* 
##  
##            Written by Andrew F. Hayes, Ph.D.  www.afhayes.com              
##    Documentation available in Hayes (2022). www.guilford.com/p/hayes3   
##  
## *********************************************************************** 
##  
## PROCESS is now ready for use.
## Copyright 2020-2023 by Andrew F. Hayes ALL RIGHTS RESERVED
## Workshop schedule at http://haskayne.ucalgary.ca/CCRAM
## 

Part 1: Data Preparation

# --- Compute scale variables ---

# Compute fear_mean as the row mean of fear1, fear2, and fear3
# rowMeans() calculates the average across the three fear items for each participant
df <- df %>%
  mutate(
    fear_mean = rowMeans(select(., fear_1, fear_2, fear_3), na.rm = TRUE),
    
    # Compute intention_mean as the row mean of int1, int2, and int3
    intention_mean = rowMeans(select(., int_1, int_2, int_3), na.rm = TRUE)
  )

# --- Filter to relevant conditions ---

# Keep only participants in the "pic_enhanced" and "text_single_control" conditions
# These are the two groups we want to compare in the mediation analysis
df_subset <- df %>%
  filter(condition %in% c("pic_enhanced", "text_single_control"))

# --- Create numeric condition variable ---

# PROCESS requires numeric predictors, so recode condition as a dummy variable:
#   pic_enhanced (graphic warning)   = 1
#   text_single_control (text-only)  = 0
df_subset <- df_subset %>%
  mutate(
    cond_num = if_else(condition == "pic_enhanced", 1, 0)
  )

# --- Drop missing values ---

# PROCESS requires complete data (no NAs) across the key analysis variables
df_subset <- df_subset %>%
  drop_na(cond_num, fear_mean, intention_mean)

# Check the resulting subset
cat("Rows after filtering and dropping NAs:", nrow(df_subset), "\n")
## Rows after filtering and dropping NAs: 208
table(df_subset$condition)
## 
##        pic_enhanced text_single_control 
##                 102                 106

Part 2: Simple Mediation Analysis (Model 4)

Research Question: Does fear (fear_mean) mediate the relationship between the graphic warning label condition (cond_num) and cannabis use intention (intention_mean)?

# Run the simple mediation model using the PROCESS macro (Model 4)
# Arguments:
#   data     = df_subset  (our filtered, complete dataset)
#   y        = "intention_mean"  (outcome / dependent variable)
#   x        = "cond_num"        (predictor / independent variable)
#   m        = "fear_mean"       (mediator)
#   model    = 4                 (simple mediation)
#   boot     = 5000              (number of bootstrap samples for indirect effect CI)
#   seed     = 12345             (set seed for reproducibility)

process(
  data  = df_subset,
  y     = "intention_mean",
  x     = "cond_num",
  m     = "fear_mean",
  model = 4,
  boot  = 5000,
  seed  = 12345
)
## 
## ********************* PROCESS for R Version 4.3.1 ********************* 
##  
##            Written by Andrew F. Hayes, Ph.D.  www.afhayes.com              
##    Documentation available in Hayes (2022). www.guilford.com/p/hayes3   
##  
## *********************************************************************** 
##                       
## Model : 4             
##     Y : intention_mean
##     X : cond_num      
##     M : fear_mean     
## 
## Sample size: 208
## 
## Custom seed: 12345
## 
## 
## *********************************************************************** 
## Outcome Variable: fear_mean
## 
## Model Summary: 
##           R      R-sq       MSE         F       df1       df2         p
##      0.0572    0.0033    0.8791    0.6773    1.0000  206.0000    0.4115
## 
## Model: 
##              coeff        se         t         p      LLCI      ULCI
## constant    2.4167    0.0911   26.5374    0.0000    2.2371    2.5962
## cond_num    0.1070    0.1300    0.8230    0.4115   -0.1494    0.3634
## 
## *********************************************************************** 
## Outcome Variable: intention_mean
## 
## Model Summary: 
##           R      R-sq       MSE         F       df1       df2         p
##      0.3450    0.1190    0.6661   13.8472    2.0000  205.0000    0.0000
## 
## Model: 
##               coeff        se         t         p      LLCI      ULCI
## constant     3.5250    0.1666   21.1541    0.0000    3.1965    3.8536
## cond_num    -0.0278    0.1134   -0.2452    0.8065   -0.2514    0.1958
## fear_mean   -0.3175    0.0607   -5.2342    0.0000   -0.4370   -0.1979
## 
## *********************************************************************** 
## Bootstrapping progress:
##   |                                                                      |                                                              |   0%  |                                                                      |                                                              |   1%  |                                                                      |>                                                             |   1%  |                                                                      |>                                                             |   2%  |                                                                      |>>                                                            |   2%  |                                                                      |>>                                                            |   3%  |                                                                      |>>                                                            |   4%  |                                                                      |>>>                                                           |   4%  |                                                                      |>>>                                                           |   5%  |                                                                      |>>>                                                           |   6%  |                                                                      |>>>>                                                          |   6%  |                                                                      |>>>>                                                          |   7%  |                                                                      |>>>>>                                                         |   7%  |                                                                      |>>>>>                                                         |   8%  |                                                                      |>>>>>                                                         |   9%  |                                                                      |>>>>>>                                                        |   9%  |                                                                      |>>>>>>                                                        |  10%  |                                                                      |>>>>>>>                                                       |  10%  |                                                                      |>>>>>>>                                                       |  11%  |                                                                      |>>>>>>>                                                       |  12%  |                                                                      |>>>>>>>>                                                      |  12%  |                                                                      |>>>>>>>>                                                      |  13%  |                                                                      |>>>>>>>>                                                      |  14%  |                                                                      |>>>>>>>>>                                                     |  14%  |                                                                      |>>>>>>>>>                                                     |  15%  |                                                                      |>>>>>>>>>>                                                    |  15%  |                                                                      |>>>>>>>>>>                                                    |  16%  |                                                                      |>>>>>>>>>>                                                    |  17%  |                                                                      |>>>>>>>>>>>                                                   |  17%  |                                                                      |>>>>>>>>>>>                                                   |  18%  |                                                                      |>>>>>>>>>>>                                                   |  19%  |                                                                      |>>>>>>>>>>>>                                                  |  19%  |                                                                      |>>>>>>>>>>>>                                                  |  20%  |                                                                      |>>>>>>>>>>>>>                                                 |  20%  |                                                                      |>>>>>>>>>>>>>                                                 |  21%  |                                                                      |>>>>>>>>>>>>>                                                 |  22%  |                                                                      |>>>>>>>>>>>>>>                                                |  22%  |                                                                      |>>>>>>>>>>>>>>                                                |  23%  |                                                                      |>>>>>>>>>>>>>>>                                               |  23%  |                                                                      |>>>>>>>>>>>>>>>                                               |  24%  |                                                                      |>>>>>>>>>>>>>>>                                               |  25%  |                                                                      |>>>>>>>>>>>>>>>>                                              |  25%  |                                                                      |>>>>>>>>>>>>>>>>                                              |  26%  |                                                                      |>>>>>>>>>>>>>>>>                                              |  27%  |                                                                      |>>>>>>>>>>>>>>>>>                                             |  27%  |                                                                      |>>>>>>>>>>>>>>>>>                                             |  28%  |                                                                      |>>>>>>>>>>>>>>>>>>                                            |  28%  |                                                                      |>>>>>>>>>>>>>>>>>>                                            |  29%  |                                                                      |>>>>>>>>>>>>>>>>>>                                            |  30%  |                                                                      |>>>>>>>>>>>>>>>>>>>                                           |  30%  |                                                                      |>>>>>>>>>>>>>>>>>>>                                           |  31%  |                                                                      |>>>>>>>>>>>>>>>>>>>>                                          |  31%  |                                                                      |>>>>>>>>>>>>>>>>>>>>                                          |  32%  |                                                                      |>>>>>>>>>>>>>>>>>>>>                                          |  33%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>                                         |  33%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>                                         |  34%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>                                         |  35%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>                                        |  35%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>                                        |  36%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>                                       |  36%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>                                       |  37%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>                                       |  38%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>                                      |  38%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>                                      |  39%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>                                      |  40%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>                                     |  40%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>                                     |  41%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>                                    |  41%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>                                    |  42%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>                                    |  43%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>                                   |  43%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>                                   |  44%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>                                  |  44%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>                                  |  45%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>                                  |  46%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                                 |  46%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                                 |  47%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                                 |  48%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                                |  48%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                                |  49%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                               |  49%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                               |  50%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                               |  51%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                              |  51%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                              |  52%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                             |  52%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                             |  53%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                             |  54%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                            |  54%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                            |  55%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                            |  56%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                           |  56%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                           |  57%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                          |  57%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                          |  58%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                          |  59%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                         |  59%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                         |  60%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                        |  60%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                        |  61%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                        |  62%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                       |  62%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                       |  63%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                       |  64%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                      |  64%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                      |  65%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                     |  65%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                     |  66%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                     |  67%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                    |  67%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                    |  68%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                    |  69%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                   |  69%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                   |  70%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                  |  70%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                  |  71%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                  |  72%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                 |  72%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                 |  73%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                |  73%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                |  74%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                |  75%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>               |  75%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>               |  76%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>               |  77%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>              |  77%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>              |  78%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>             |  78%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>             |  79%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>             |  80%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>            |  80%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>            |  81%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>           |  81%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>           |  82%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>           |  83%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>          |  83%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>          |  84%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>          |  85%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>         |  85%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>         |  86%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>        |  86%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>        |  87%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>        |  88%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>       |  88%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>       |  89%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>       |  90%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>      |  90%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>      |  91%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>     |  91%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>     |  92%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>     |  93%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>    |  93%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>    |  94%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>   |  94%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>   |  95%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>   |  96%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  |  96%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  |  97%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  |  98%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |  98%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |  99%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>|  99%  |                                                                      |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>| 100%
## 
## **************** DIRECT AND INDIRECT EFFECTS OF X ON Y ****************
## 
## Direct effect of X on Y:
##      effect        se         t         p      LLCI      ULCI
##     -0.0278    0.1134   -0.2452    0.8065   -0.2514    0.1958
## 
## Indirect effect(s) of X on Y:
##              Effect    BootSE  BootLLCI  BootULCI
## fear_mean   -0.0340    0.0425   -0.1201    0.0473
## 
## ******************** ANALYSIS NOTES AND ERRORS ************************ 
## 
## Level of confidence for all confidence intervals in output: 95
## 
## Number of bootstraps for percentile bootstrap confidence intervals: 5000

Interpretation of Results

Path a – Effect of Condition on Fear (X → M)

# The 'a' path tests whether the graphic warning label (vs. text control) increases fear.
# Look at the coefficient for cond_num in the model where fear_mean is the outcome.
#
# Interpretation example (update with your actual output values):
#   - If the coefficient is positive and significant (p < .05), the graphic warning label
#     produced significantly higher fear compared to the text-only control.
#   - If p > .05, there is no significant difference in fear between conditions.

cat("**Path a:** The 'a' path coefficient represents the effect of the graphic warning 
label condition (1 = pic_enhanced, 0 = text_single_control) on fear. 
A significant positive coefficient would indicate that participants exposed to 
the graphic warning reported higher fear than those in the text-only control.")

Path a: The ‘a’ path coefficient represents the effect of the graphic warning label condition (1 = pic_enhanced, 0 = text_single_control) on fear. A significant positive coefficient would indicate that participants exposed to the graphic warning reported higher fear than those in the text-only control.

Path b – Effect of Fear on Intention (M → Y, controlling for X)

# The 'b' path tests whether fear predicts intention to use cannabis,
# after accounting for the effect of condition.
#
# Interpretation:
#   - A significant negative coefficient would indicate that greater fear is associated
#     with lower intention to use cannabis (i.e., fear deters use).
#   - If not significant, fear does not independently predict intention once
#     condition is controlled.

cat("**Path b:** The 'b' path coefficient represents the effect of fear on cannabis 
use intention, controlling for condition. A significant negative coefficient would 
indicate that higher fear is associated with lower intention to use cannabis.")

Path b: The ‘b’ path coefficient represents the effect of fear on cannabis use intention, controlling for condition. A significant negative coefficient would indicate that higher fear is associated with lower intention to use cannabis.

Direct Effect (c’) – Effect of Condition on Intention, Controlling for Fear

# The direct effect (c') tests whether condition still predicts intention
# *after* accounting for the mediating role of fear.
#
# Interpretation:
#   - If c' is not significant, it suggests that fear fully mediates the
#     condition-intention relationship (full mediation).
#   - If c' remains significant, it suggests partial mediation.

cat("**Direct Effect (c'):** The direct effect tests whether the graphic warning condition 
predicts cannabis use intention after controlling for fear. If this effect is 
non-significant, it suggests full mediation through fear.")

Direct Effect (c’): The direct effect tests whether the graphic warning condition predicts cannabis use intention after controlling for fear. If this effect is non-significant, it suggests full mediation through fear.

Indirect Effect (ab) – Bootstrap Test of Mediation

# The indirect effect (ab) = a * b, tested via bootstrapped confidence intervals (CI).
# PROCESS uses bootstrapping because indirect effects are not normally distributed.
#
# Decision rule:
#   - If the 95% bootstrap CI does NOT include zero, the indirect effect is significant,
#     providing evidence of mediation.
#   - If the CI includes zero, there is no significant indirect effect.

cat("**Indirect Effect (ab):** The indirect effect represents the portion of the 
condition-intention relationship that operates through fear (a × b). 
If the 95% bootstrapped confidence interval excludes zero, this provides 
evidence that fear significantly mediates the relationship.")

Indirect Effect (ab): The indirect effect represents the portion of the condition-intention relationship that operates through fear (a × b). If the 95% bootstrapped confidence interval excludes zero, this provides evidence that fear significantly mediates the relationship.


APA-Style Write-Up

# Update the bracketed values below with your actual output numbers before submitting.

cat("
A simple mediation analysis (Model 4; Hayes, 2022) was conducted to test whether 
fear mediated the effect of warning label condition on cannabis use intention. 
Condition was dummy coded such that the graphic warning label (pic_enhanced) = 1 
and the text-only control (text_single_control) = 0. 

The results indicated that the graphic warning label condition significantly 
[or did not significantly] predict fear (Path a: b = [value], SE = [value], 
p = [value]), and fear significantly [or did not significantly] predict cannabis 
use intention after controlling for condition (Path b: b = [value], SE = [value], 
p = [value]). The direct effect of condition on intention was [significant / 
non-significant] (c' = [value], SE = [value], p = [value]). 

Bootstrapping with 5,000 resamples indicated that the indirect effect of condition 
on cannabis use intention through fear was [significant / non-significant] 
(ab = [value], 95% CI [lower, upper]). Because the confidence interval 
[did not include / included] zero, these results [support / do not support] 
fear as a mediator of the relationship between warning label condition and 
cannabis use intention.

Reference: Hayes, A. F. (2022). *Introduction to mediation, moderation, and 
conditional process analysis* (3rd ed.). Guilford Press.
")

A simple mediation analysis (Model 4; Hayes, 2022) was conducted to test whether fear mediated the effect of warning label condition on cannabis use intention. Condition was dummy coded such that the graphic warning label (pic_enhanced) = 1 and the text-only control (text_single_control) = 0.

The results indicated that the graphic warning label condition significantly [or did not significantly] predict fear (Path a: b = [value], SE = [value], p = [value]), and fear significantly [or did not significantly] predict cannabis use intention after controlling for condition (Path b: b = [value], SE = [value], p = [value]). The direct effect of condition on intention was [significant / non-significant] (c’ = [value], SE = [value], p = [value]).

Bootstrapping with 5,000 resamples indicated that the indirect effect of condition on cannabis use intention through fear was [significant / non-significant] (ab = [value], 95% CI [lower, upper]). Because the confidence interval [did not include / included] zero, these results [support / do not support] fear as a mediator of the relationship between warning label condition and cannabis use intention.

Reference: Hayes, A. F. (2022). Introduction to mediation, moderation, and conditional process analysis (3rd ed.). Guilford Press.