title: “Analysis Plan” output: html_document date: “2026-05-02”

Analysis

1. Packages and Read in Data:

library(tidyverse)

data <- read.csv(‘/Users/sophiajaletfasihi/Desktop/Psychologie /6. /Empirische Forschung /Instagram /Daten /resultssurvey211595r.csv’)

2. Data Cleaning:

*Exclude Participants who don`t fit criteria:

data <- data[!is.na(data$G03Q34), ]

3. Compute value of each item by combining frequency + intensity:

data$v_pre_1 <- rowMeans(data[, c(“Q1before.SQ001.”,“Q1before.SQ002.”)],na.rm = TRUE)

Turn x into numeric value

data\(Q1before.SQ001. <- as.numeric(gsub("[^0-9]", "", data\)Q1before.SQ001.))

Mean Score:

data$v_pre_1 <- rowMeans(data[, c(“Q1before.SQ001.”,“Q1before.SQ002.”)],na.rm = TRUE)

data$v_post_1 <- rowMeans(data[, c(“Q1after.SQ001.”,“Q1after.SQ002.”)],na.rm = TRUE)

Mean v_pre_overall:

data$v_pre <- rowMeans(data[, c(“v_pre_1”,“v_pre_2”,“v_pre_3”,“v_pre_4”)],na.rm = TRUE)

Mean_v_post_overall:

data$v_post <- rowMeans(data[, c(“v_post_1”,“v_post_2”,“v_post_3”,“v_post_4”)],na.rm = TRUE)

4. Long-Format:

data_long <- data %>% select(id, randomization, v_pre, v_post) %>% pivot_longer( cols = c(v_pre, v_post), names_to = “time”, values_to = “value” )¨

5. Mixed Anova

library(afex)

aov_ez(id = “id”, dv = “value”, data = data_long, within = “time”, between = “randomization”)

Anova Table (Type 3 tests)

  -> Response: value
          Effect    df  MSE        F  ges p.value
 1      randomization 1, 88 1.55     0.16 .002    .694
 2               time 1, 88 0.19 10.67 ** .013    .002
 3 randomization:time 1, 88 0.19  7.10 ** .009    .009
    

model <- aov_ez(id =“id”, dv = “value”, data = data_long, within = “time”, between = “randomization”)

6. Assumptions ANOVA:

6.1 Residuals

res <- residuals(model$lm)

shapiro.test(res) W = 0.99121, p-value = 0.3403 *-> okay, value greater than p > .05

qqnorm(res) png(“res_plot.png”) plot(1:10, main=“res_plot.png”)

qqline(res)

6.2 Variance homogenity (Levene Test)

library(car) leveneTest(value ~ randomization, data = data_long)

data_long\(randomization <- factor(data_long\)randomization)

library(car) data_long\(randomization <- factor(data_long\)randomization)

Levene’s Test for Homogeneity of Variance (center = median) Df F value Pr(>F) group 1 0.9346 0.335 178

  -> unproblematic result (p = 0.335 > .05) 
  

6.3 Sphericity

= does not need to be tested in this design (as only two measurment time ppoints are included > only two levels of within-subject factor > assumptions of sphericity is automatically met)

7. Visualization of the results (ANOVA)

library(ggplot2) ggplot(data_long, aes(x=time, y=value, color=randomization, group=randomization))+stat_summary(fun=mean, geom = “line”) + stat_summary(fun=mean, geom=“point”)

data_long\(time <- factor(data_long\)time, levels = c(“v_pre”, “v_post”)) ggplot(data_long, aes(x = time, y = value, color = randomization, group = randomization)) + stat_summary(fun = mean, geom = “line”) + stat_summary(fun = mean, geom = “point”) + ggtitle(“Mixed ANOVA Results”)

ggplot(data_long, aes(x = time, y = value, fill = randomization)) + geom_boxplot() + ggtitle(“Distribution and Variance”)