behinger / project-ocd

0 stars 0 forks source link

Contrast #3

Closed behinger closed 2 weeks ago

behinger commented 2 months ago

https://github.com/behinger/project-ocd/blob/1a262243a300d1c70244614d00184a5970fac063/scripts/2024-08-13_Hypotheses.Rmd#L351

Your comments says "longer", which implies a direction. If you want to have that direction in the contrast function, maybe you can use "groupocd:stim_ocd - groupocd:stim_neg >= 0" (I hope I got ">=" right and it is not "<="...)

behinger commented 2 months ago

else the contrasts look ok to me

celinalianemueller commented 1 month ago

Nice, then I will include the directionality as well.

While extracting the coefficients of these contrasts necessary for the correlation between attentional control and biases for H3&4, it seemed to me as if the first contrasts were "too simple" by just considering the interaction effects. So the original version was as follows:

"Original" version:

g = (glht(h1_fm_excl_triplet_item, (c("groupocd:stim_ocd - groupocd = 0", # Patients with OCD look at idiosyncratic OCD-relevant material longer compared to neutral material (maintenance bias within group)
                            "groupocd:stim_ocd - groupocd:stim_neg = 0", # Patients with OCD look at idiosyncratic OCD-relevant material longer compared to negative material (maintenance bias within group)
                            "groupocd:stim_ocd - stim_ocd = 0", # Patients with OCD will show a more pronounced maintenance bias compared to healthy participants (maintenance bias between groups)
                            "groupocd:stim_ocd -  groupspider:stim_pho = 0" # Patients with OCD will show a more pronounced maintenance to idiosyncratic disorder-specific material compared to patients with spider phobia (maintenance bias between group)

And I was wondering whether it should be more like that New version including main and interaction effects:

g = (glht(h1_fm_excl_triplet_item, (c("stim_ocd + groupocd:stim_ocd = 0", # Patients with OCD look at idiosyncratic OCD-relevant material longer compared to neutral material (maintenance bias within group)
                            "(stim_ocd + groupocd:stim_ocd) - (stim_neg + groupocd:stim_neg) = 0", # Patients with OCD look at idiosyncratic OCD-relevant material longer compared to negative material (maintenance bias within group)
                            "groupocd + groupocd:stim_ocd = 0", # Patients with OCD will show a more pronounced maintenance bias compared to healthy participants (maintenance bias between groups)
                            "(groupocd + stim_ocd + groupocd:stim_ocd) -  (groupspider + stim_pho + groupspider:stim_pho) = 0" # Patients with OCD will show a more pronounced maintenance to idiosyncratic disorder-specific material compared to patients with spider phobia (maintenance bias between group)
behinger commented 1 month ago

I think you are 100% right. the group main-effect cancels, but not the individual condition ones.. good catch!

Edit: if you want to play around, a simple LLM-based simulation


# Set the seed for reproducibility
set.seed(123)

# Define the factors and their levels

factor1 <- factor(rep(c("Level1", "Level2"), each = 3))
factor2 <- factor(rep(c("LevelA", "LevelB", "LevelC"), times = 2))

# Define parameters
mean_level1 <- 10
mean_level2 <- 15
mean_levelA <- 5
mean_levelB <- 10
mean_levelC <- 15
interaction_effect <- 40
sd <- 2

# Calculate response values based on parameters

response <- (factor1 == "Level1") * mean_level1 +
  (factor1 == "Level2") * mean_level2 +
  (factor2 == "LevelA") * mean_levelA +
  (factor2 == "LevelB") * mean_levelB +
  (factor2 == "LevelC") * mean_levelC +
  (factor1 == "Level2" & factor2 == "LevelC") * interaction_effect +
  rnorm(6, mean = 0, sd = sd)

# Create a data frame
data <- data.frame(factor1, factor2, response)

model <- glm(response ~ factor1 * factor2, data = data)

library(multcomp)
glht(model,linfct=c("factor1Level2 == 0"))